Adytum
Launch app

How it works

The program has eight instructions, chosen by the first byte of the instruction data.

TagInstructionSignerEffect
0init_domainpayer and domainCreates the domain account and its vault, records the sequencer key, the auditor key and the inactivity window. Logs domain open.
1depositmemberMoves lamports from the member to the vault and records them on the member's receipt account. Logs entered domain.
2batch_settlesequencerChecks one signed exit per member, pays each from the vault, moves the batch number forward. Logs settled batch.
3force_exitmemberAfter N quiet slots, pays a member from the vault without the sequencer. Logs inactivity exit.
4set_auditorsequencerReplaces the auditor key stored in the domain account.
5close_receiptmemberReturns the receipt's rent to the member, once the domain is closed.
6close_domainsequencerCloses the domain and vault when the vault holds no member money.
7init_token_domainpayer and domainOpens a domain for one SPL token, such as USDC: records the mint, its decimals and symbol, and creates the vault's token account. Logs token domain open.

The loop

  1. A member deposits BNB. The program moves it into the vault and logs entered domain.
  2. The next settle batch, a few seconds later, makes the deposit spendable inside.
  3. The member signs a transfer in their wallet and hands it to the sequencer. No transaction is sent.
  4. The sequencer records it in its encrypted ledger, and seals a copy to the auditor key if one is named.
  5. To leave, the member signs readable exit words in their wallet.
  6. The sequencer posts batch_settle with that signature. The program checks it and the vault pays the member's wallet.

USDC

Each asset has its own domain. A USDC domain runs the same loop with the vault's USDC account in place of its lamports: a deposit moves USDC from the member's token account, and an exit pays the member's own USDC account and nothing else. The exit words a member signs name the amount in USDC and the USDC mint, so the wallet shows exactly which token leaves. The program counts every USDC that came in and every USDC paid out, and closes the domain only when the two match; USDC sent to the vault from outside goes to the sequencer when it closes, so it can never keep the domain open. Classic SPL tokens only.

Inside the domain

A transfer between two members never reaches the chain. The member signs this text in their wallet, and the sequencer checks the signature before it changes both balances:

Adytum transfer
Domain: <domain address>
From: <sender>
To: <recipient>
Amount: 0.700000000 BNB
Nonce: 0

Back out

To leave, a member signs these words. The vault rebuilds the same text on BSC and pays only the wallet whose key signed it:

Adytum exit
Domain: <domain address>
Amount: 1.100000000 BNB
Batch: 2

The sequencer puts the signature into the settle transaction as an ed25519 verification instruction, before batch_settle. The program accepts the proof only when the key, the signature and the text sit inside that instruction itself, so what it reads is what was signed. In the test run a member who had deposited 0.5 BNB and received 0.7 BNB inside exited with 1.1 BNB, which shows the private ledger drives what the vault pays.

If the sequencer stops

Every settle resets a clock. If no settle lands for N slots (150 slots, about a minute), the vault opens to the members directly. A member can take the balance the sequencer signed for them at the last batch (the app keeps that receipt in the browser), or the deposits they made since it. Each pays once.

Because those receipts are signed at the last batch, once anyone uses one, the sequencer returns the private ledger to that batch: transfers made after it are undone. The program refuses the sequencer's next settle until it has counted every inactivity exit the vault paid.

Account layout

The domain account is 104 bytes: sequencer key (32), auditor key (32), batch number (8), total deposited (8), slot of the last settle (8), inactivity window in slots (8), inactivity exits paid (8). The vault address is derived from the seeds "vault" and the domain address.

Each member's receipt account is 40 bytes, at the address derived from "u", the domain and the member: deposits since the last batch (8), the batch they were made in (8), the batch whose sequencer receipt was claimed (8), the batch of any inactivity exit (8), and the member's lifetime deposits (8).

Connect BSC wallet

BNB Smart Chain · 56

BSC contract not deployed. No deposits or transactions available.

BSC preview · Contract not deployed · Figures illustrate the design, not BSC test results