Adytum
Launch app

How it works

The program has seven 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.

The loop

  1. A member deposits SOL. 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.

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 SOL
Nonce: 0

Back out

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

Adytum exit
Domain: <domain address>
Amount: 1.100000000 SOL
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 SOL and received 0.7 SOL inside exited with 1.1 SOL, 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).