Program accounts
The program id, every account the program keeps, byte by byte, and the events it emits.
Talaria is one Anchor program, talaria, built with Anchor 0.31.1. Its id is 5hJVoxABR1b9QqnQ7FfZDtY2fgNGkUsQtPBqjyBLPTU3.
Every account below is a program derived address under that id. Accounts with data begin with Anchor's 8-byte discriminator, sha256("account:<Name>")[0..8]. Config, Inbox and Nullifier are Borsh-encoded: integers little-endian, pubkey and byte arrays as raw bytes, no padding. Pool is zero-copy, laid out as a repr(C) struct. Sizes below include the discriminator.
| Account | Seeds | Owner | Bytes |
|---|---|---|---|
| Config | "config" | the program | 83 |
| Pool | "pool" | the program | 2,920 |
| Vault | "vault" | System Program | 0 |
| FeeVault | "fee_vault" | System Program | 0 |
| Inbox | "inbox", wallet (32 bytes) | the program | 101 |
| Nullifier | "nullifier", day (u64 LE, 8 bytes), nullifier (32 bytes) | the program | 81 |
The four singleton accounts derive to these addresses under the program id:
| Account | Address | Bump |
|---|---|---|
| Config | 9eWP5iWsxMAYYqRBLG8GTJBzQnScMd1Ro36YMT5Bibiu | 255 |
| Pool | 5z8GA27zDs5xo3pbYZrahSrfZqQHwk1b7otRdMC7QFq1 | 253 |
| Vault | 4wPUDUEf9ffq1sM4idp39sFTtSgL1LcbzvFAe6a4pyUk | 255 |
| FeeVault | DVHs6t1p31ZyaLfY1J3kKW2VFYhUNA3dRDqPEeqpvyou | 254 |
| Event authority | B4hL9AnMVu4J3yoeMgauQsrRcA74NREJKbawQeYBRTP1 | 255 |
The instructions that create, change and close each account are on Instructions.
Accounts#
Config#
The protocol's prices, pass tiers, day length and root history. One per program.
- Discriminator:
[155, 12, 170, 224, 30, 250, 204, 130] - Created by
initialize. The admin pays its rent. - Changed by
set_config, which replaces every field exceptadminandbump. - Never closed. No instruction changes
admin.
- discriminator[u8; 8], 8 bytes
- Offset 0.
- adminpubkey, 32 bytes
- Offset 8. The upgrade authority that ran
initialize. The only signerset_configaccepts. - message_feeu64, 8 bytes
- Offset 40. Lamports one message costs inside a pass's price.
- relay_feeu64, 8 bytes
- Offset 48. Lamports the Vault pays the relay for each
post. - protocol_share_bpsu16, 2 bytes
- Offset 56. The protocol's share of each pass sale, in basis points, 0 to 10,000.
- tiers[u32; 3], 12 bytes
- Offset 58. Daily message limits of the three pass tiers, strictly increasing.
buy_passtakes an index into this array. - lengths[u16; 3], 6 bytes
- Offset 70. The pass lengths on sale, in days, strictly increasing.
- day_length_secondsu32, 4 bytes
- Offset 76. Length of one day. The day number is
floor(unix_timestamp / day_length_seconds)from the chain clock. - root_history_sizeu16, 2 bytes
- Offset 80. How many of the latest pool roots
postaccepts, 1 to 64. - bumpu8, 1 byte
- Offset 82. The PDA bump.
The values a fresh build is given are on Configuration.
Pool#
The pool of passes: an incremental Poseidon Merkle tree of height 26 and a ring of its recent roots, in one zero-copy account.
- Discriminator:
[241, 154, 109, 4, 17, 177, 109, 188] - Created by
initialize. The admin pays its rent. It starts withnext_index0,root_index0,root_count1, eachfilled_subtrees[i]set to the empty subtree of heighti, androots[0]set to the empty tree's root. - Changed by
buy_pass, which appends one leaf and pushes the new root into the ring. - Never closed.
- discriminator[u8; 8], 8 bytes
- Offset 0.
- next_indexu64, 8 bytes
- Offset 8. The index the next leaf takes, which is also the number of passes ever bought. The pool holds at most 2^26 leaves.
- root_indexu64, 8 bytes
- Offset 16. The ring position of the latest root.
- root_countu64, 8 bytes
- Offset 24. How many ring positions hold a root, capped at 64.
- filled_subtrees[[u8; 32]; 26], 832 bytes
- Offset 32. For each level, the last left node written there. 32-byte big-endian field elements.
- roots[[u8; 32]; 64], 2048 bytes
- Offset 864. The ring of the 64 most recent roots.
- bumpu8, 1 byte
- Offset 2912. The PDA bump.
- padding[u8; 7], 7 bytes
- Offset 2913. Alignment.
An empty leaf is zero, and each level's empty node is Poseidon(z, z) of the level below. Hashing uses the BN254 X5 Poseidon syscall with big-endian inputs. A root is accepted by post when it is among the latest min(root_count, root_history_size) entries of the ring, counted back from root_index. The pool covers how a client rebuilds the tree from public leaves.
Vault#
The SOL that pays relays. A zero-data account owned by the System Program, so its whole balance is lamports.
- Created by
initializewith 0 bytes of data. The admin pays its rent-exempt minimum, which stays in it. - Credited by
buy_passwith the part of each price that is not the protocol's share. - Debited by
postonly:relay_feeto the relay, signed with the seeds["vault", bump]. A post fails when paying would take the Vault below its rent-exempt minimum for 0 bytes. - Never closed.
FeeVault#
The protocol's share of pass sales. A zero-data account owned by the System Program, and a program address no key signs for.
- Created by
initializewith 0 bytes of data. The admin pays its rent-exempt minimum. - Credited by
buy_passwithfloor(price × protocol_share_bps / 10,000). - Debited by no instruction in this build.
- Never closed.
Its balance is served as feeVaultBalanceLamports by GET /pool and GET /stats. TALARIA covers what the share is for.
Inbox#
One per wallet: the X25519 key anyone encrypts to, and its version.
- Discriminator:
[41, 120, 76, 139, 162, 162, 166, 244] - Created by
open_inbox. The wallet pays its rent, 1,593,840 lamports on the measured validator for 101 bytes. A wallet has one Inbox; a secondopen_inboxfails because the address is in use, and the API answersINBOX_ALREADY_OPEN. - Changed by
rotate_inbox_key, which setsinbox_key, adds one tokey_versionand setsupdated_at. - Never closed.
- discriminator[u8; 8], 8 bytes
- Offset 0.
- walletpubkey, 32 bytes
- Offset 8. The wallet that owns it, and the second seed.
- inbox_key[u8; 32], 32 bytes
- Offset 40. The current X25519 public key. Never all zero bytes.
- opened_slotu64, 8 bytes
- Offset 72. The slot of
open_inbox. - opened_ati64, 8 bytes
- Offset 80. Unix seconds of
open_inbox, from the chain clock. - updated_ati64, 8 bytes
- Offset 88. Unix seconds of the latest open or rotation.
- key_versionu32, 4 bytes
- Offset 96. 1 when opened, plus one per rotation. Selects the derivation of the matching secret key on Cryptography.
- bumpu8, 1 byte
- Offset 100. The PDA bump.
The account holds only the current key. Earlier keys and the slots they were valid for come from the InboxOpened and InboxKeyRotated events, which the API serves in chain order as the inbox directory (GET /inboxes/head and GET /inboxes/segments/:n).
Nullifier#
One per message: proof that a nullifier was spent on a day, and the relay that paid for the account.
- Discriminator:
[18, 56, 142, 165, 181, 158, 187, 133] - Created by
post, after the proof verifies. The relay pays its rent, 1,454,640 lamports on the measured validator for 81 bytes. If the address already holds lamports and no data, the relay tops it up to the rent-exempt minimum. - Never changed after creation.
- Closed by
close_nullifiersonceday + 1 < today. Every lamport goes to the relay recorded inrelay, the account is assigned back to the System Program and its data shrinks to 0 bytes.
- discriminator[u8; 8], 8 bytes
- Offset 0.
- dayu64, 8 bytes
- Offset 8. The day of the post, the same value as the second seed.
- nullifier[u8; 32], 32 bytes
- Offset 16. The nullifier, a 32-byte big-endian field element, the same value as the third seed.
- relaypubkey, 32 bytes
- Offset 48. The relay that signed the post and paid the rent. Closing refunds it.
- bumpu8, 1 byte
- Offset 80. The PDA bump.
post treats a nullifier as unspent when its address is owned by the System Program and holds no data. Because post accepts only today's day and closing needs day + 1 < today, a closed day can never be posted to again.
The Anchor IDL does not discover this account on its own, since the program allocates it by hand after verification. The build adds it to the IDL in a step after anchor idl build, so a client decoding with backend/program/talaria.json finds it.
Events#
Three instructions emit an event with Anchor's event CPI: the program invokes itself through the event authority PDA (seeds "__event_authority") with instruction data
e4 45 a5 2e 51 cb 9a 1d | event discriminator (8) | Borsh event fields
The event therefore sits in the transaction's inner instructions, not in its logs, and survives log truncation. A reader counts it only when the inner instruction is the Talaria program invoking itself directly under a Talaria instruction, with the event authority as its first account. The event discriminator is sha256("event:<Name>")[0..8].
InboxOpened#
Emitted by open_inbox. Discriminator [220, 142, 58, 93, 157, 160, 179, 23].
- walletpubkey, 32 bytes
- The wallet that opened it.
- inbox_key[u8; 32], 32 bytes
- The X25519 inbox key.
- opened_slotu64, 8 bytes
- The slot.
- opened_ati64, 8 bytes
- Unix seconds.
- key_versionu32, 4 bytes
- Always 1.
InboxKeyRotated#
Emitted by rotate_inbox_key. Discriminator [167, 3, 24, 128, 176, 112, 135, 136].
- walletpubkey, 32 bytes
- The wallet.
- inbox_key[u8; 32], 32 bytes
- The new inbox key.
- key_versionu32, 4 bytes
- The new version.
- updated_ati64, 8 bytes
- Unix seconds.
The SDK folds these two events, read from the inbox directory, into each wallet's keyHistory: each key is valid from the slot of its event until the slot of the next one.
PassPurchased#
Emitted by buy_pass. Discriminator [11, 171, 162, 118, 129, 168, 151, 90]. It is the source of every pool leaf the API serves on GET /pool/leaves.
- indexu64, 8 bytes
- The leaf's index in the pool.
- leaf[u8; 32], 32 bytes
Poseidon(id_commitment, daily_limit, expiry_day), big-endian.- root[u8; 32], 32 bytes
- The pool root after this leaf.
- id_commitment[u8; 32], 32 bytes
Poseidon(secret), from the buyer.- daily_limitu32, 4 bytes
- The tier's daily message limit.
- expiry_dayu64, 8 bytes
purchased_day + days − 1. The pass is valid through this day, inclusive, so it posts ondaysdays counting the day of purchase.- purchased_dayu64, 8 bytes
- The day of the purchase.
- daysu16, 2 bytes
- The length bought.
- price_lamportsu64, 8 bytes
daily_limit × days × message_fee.- purchaserpubkey, 32 bytes
- The wallet that paid.
- slotu64, 8 bytes
- The slot.
- block_timei64, 8 bytes
- Unix seconds from the chain clock.
post emits no event. Its Log entry is the instruction itself, decoded on Log entry format.