Accounts
Every account the program owns: its address, discriminator and fields.
Each account is an Anchor account: an 8-byte discriminator, then its fields in Borsh, except the person tree, which is zero-copy. A program reading one of them checks the owner is Once and the first 8 bytes match the discriminator.
Config
The program’s settings. One account, created by initialize.
Address: PDA ["config"]. Discriminator 9b0caae01efacc82.
| Name | Type | Description |
|---|---|---|
admin | Pubkey | The wallet that can change fees, issuers and the OPRF registry. |
fee_recipient | Pubkey | The wallet that receives the protocol fee on drops. |
fee_bps | u16 | The protocol fee in basis points: 100. |
sol_relay_fee | u64 | The relay fee per claim for SOL scopes and polls, in lamports. |
usdc_relay_fee | u64 | The relay fee per claim for USDC scopes, in base units. |
usdc_mint | Pubkey | The USDC mint drops accept. |
spp_program | Pubkey | The Solana Privacy Program. |
registry_program | Pubkey | The Rings user registry program. |
state_tree | Pubkey | The Rings state tree notes are appended to. |
next_scope_id | u64 | The ID the next scope gets. |
pool_authority | Pubkey | The pool authority PDA, ["pool"]. |
holders_authority | Pubkey | The holders authority PDA, ["holders"]. |
pool_bump | u8 | The pool authority’s bump. |
holders_bump | u8 | The holders authority’s bump. |
Issuer
One registered issuer key.
Address: PDA ["issuer", key_x, key_y]. Discriminator d81353e66c35500e.
| Name | Type | Description |
|---|---|---|
key | CurvePoint | The issuer’s BabyJubJub public key. |
active | bool | Whether credentials from this key can enroll. |
OprfKeys
The OPRF registry. One account.
Address: PDA ["oprf"]. Discriminator f406911854f3b4b7.
| Name | Type | Description |
|---|---|---|
shares | [CurvePoint; 3] | The public points of the three key shares, in node order. |
combined | CurvePoint | The combined OPRF public key K. |
digest | [u8; 32] | Poseidon of the eight coordinates of the shares and K, in that order. The enrollment proof commits to it. |
version | u64 | Raised by each set_oprf. An enrollment names the version it used. |
Person
One enrollment, keyed by the person nullifier.
Address: PDA ["person", n]. Discriminator 10f22c18790b00b7.
| Name | Type | Description |
|---|---|---|
wallet | Pubkey | The wallet that enrolled. Only it can revoke. |
leaf | [u8; 32] | The leaf in the person tree. |
index | u32 | The leaf’s index in the person tree. |
enrolled_at | i64 | When it enrolled, Unix seconds. |
active | bool | False after a revoke. |
revoked_at | i64 | When it was last revoked, Unix seconds; zero if never. Enrolling again opens 24 hours later. |
PersonTree
The person tree. One zero-copy account of 3,368 bytes after its discriminator.
Address: PDA ["tree"]. Discriminator 795bebf8fe087420.
| Name | Type | Description |
|---|---|---|
frontier | [[u8; 32]; 20] | The last left node at each of the 20 levels, enough to append the next leaf. |
zeros | [[u8; 32]; 21] | The hash of an empty subtree at each height, 0 to 20. |
roots | [[u8; 32]; 64] | A ring of the last 64 roots. |
next_index | u32 | The index the next leaf takes. |
cursor | u8 | The position of the current root in roots. |
history_len | u8 | How many entries of roots are filled, up to 64. |
padding | [u8; 2] | Unused. |
Scope
One drop or poll.
Address: PDA ["scope", id as u64 little-endian]. Discriminator a539efd81ea0db5c.
| Name | Type | Description |
|---|---|---|
id | u64 | The scope ID, from the config’s counter. |
creator | Pubkey | The wallet that opened and funded it, and receives what is left at closing. |
kind | ScopeKind | Drop or poll. |
title | String | The title, up to 64 bytes. |
asset | Asset | SOL or USDC. Always SOL for a poll. |
amount_per_person | u64 | What each claim takes from a drop, in base units, relay fee included. Zero for a poll. |
cap | u64 | The most claims the scope accepts. |
opens_at | i64 | When claims open, Unix seconds. |
closes_at | i64 | When claims close, Unix seconds. A claim’s credential must expire after it. |
options | Vec<String> | A poll’s options, 2 to 8 of up to 32 bytes. |
tally | [u64; 8] | Votes per option. |
count | u64 | Claims so far. |
closed | bool | Set by close_scope. |
relay_fee | u64 | The relay fee per claim, copied from the config at creation. |
relay_budget | u64 | What is left of a poll’s relay budget, in lamports. |
pool_hash | [u8; 32] | The current pool note’s commitment. |
pool_nullifier | [u8; 32] | The current pool note’s nullifier. |
pool_blinding | [u8; 32] | The current pool note’s blinding. |
remaining | u64 | What is left in the pool, in base units. |
ClaimReceipt
One claim. Its address, ["claim", scope, n], is what refuses a second claim with the same scope nullifier.
Address: PDA ["claim", scope, n]. Discriminator dfe90be57ca5cf1c.
| Name | Type | Description |
|---|---|---|
scope | Pubkey | The scope claimed in. |
n | [u8; 32] | The scope nullifier. |
payer | Pubkey | The relayer that paid the rent, which close_claims returns to it. |
claimed_at | i64 | When the claim landed, Unix seconds. |
option | Option<u8> | The option voted for in a poll; empty for a drop. |
Owned through Rings
Two PDAs hold no data and sign for notes in the Solana Privacy Program: the pool authority at ["pool"], which owns each drop's pool note, and the holders authority at ["holders"], which owns each payout note together with the claimant's key. Rings payouts explains both.