alder_da Program
Complete Solana Anchor reference for alder_da v0.3.0: program ID, PDA seeds, 4 account structs, 15 instructions, 12 CPI events, and 33 error codes.
alder_da is the Solana Anchor program that anchors encrypted blob commitments, escrows and splits SOL availability fees, holds DA node SOL bonds, enforces Merkle-verified missing-cell challenges, and supports rent reclamation on closed records.
| Property | Value |
|---|---|
| Program ID | EEQEMRSzNVrmMakBr1HJofNhEqYXSE3c7gJK3aoGeke1 |
| Source | backend/program/programs/alder_da/src/lib.rs |
| Compiled SBF binary | backend/artifacts/alder_da.so (429,720 bytes, SBPF v0) |
| IDL | backend/src/idl/alder_da.json and backend/src/idl/alder_da.ts |
| Event emission | #[event_cpi] / emit_cpi! via ["__event_authority"] PDA |
Max cell size (MAX_CELL_BYTES) | 512 bytes (payload_size_bytes <= k^2 * 512) |
PDA Seeds and Account Sizes
Every account size below includes the 8-byte Anchor discriminator (8 + INIT_SPACE). Rent-exempt balances are queried dynamically from the Rent sysvar (getMinimumBalanceForRentExemption).
| Account | Seeds | Size (bytes) |
|---|---|---|
ProtocolConfig | ["protocol_config"] | 141 |
DaNode | ["da_node", operator.key()] | 126 |
BlobRecord | ["blob", publisher.key(), blob_id_hash] | 223 |
Challenge | ["challenge", blob.key(), node.key(), &[row, col]] | 132 |
| Event Authority | ["__event_authority"] | CPI signer PDA |
Account Structs
ProtocolConfig (141 bytes)
| Field | Type | Description |
|---|---|---|
authority | Pubkey | Protocol admin and attestation authority (rotatable via update_protocol) |
fee_recipient | Pubkey | Receives protocol SOL fee share, forfeited node fees, and 50% of slashed bonds (ALDR launch wallet) |
protocol_fee_bps | u16 | Protocol share of availability fees in basis points (<= 5000) |
min_node_bond | u64 | Minimum SOL bond (lamports) required for an Active DA node |
min_fee_per_byte | u64 | Minimum on-chain availability fee rate per payload byte (lamports) |
challenge_window_slots | u64 | Slots given to a challenged node to call respond_challenge (>= 10) |
attestation_timeout_slots | u64 | Slots after anchor_slot before cancel_blob is allowed (>= 10) |
slash_bps | u16 | Bond slash rate per missed challenge (1..5000 bps) |
active_blob_count | u64 | Active attested blob count (incremented on attest, decremented on expire_blob) |
total_attested_bytes | u64 | Cumulative attested ciphertext bytes |
total_protocol_fees | u64 | Cumulative SOL lamports routed to fee_recipient |
total_node_fees | u64 | Cumulative SOL lamports vested for DA nodes |
bump | u8 | PDA bump seed |
DaNode (126 bytes)
| Field | Type | Description |
|---|---|---|
operator | Pubkey | Node operator wallet |
bonded_lamports | u64 | Active SOL security bond held in the PDA |
endpoint_hash | [u8; 32] | SHA-256 hash of the operator's HTTPS endpoint URL |
active_shard_count | u32 | Active shard depth count (incremented on attest, decremented on expire_blob) |
successful_attestations | u64 | Number of blobs attested by this node |
slashed_count | u32 | Number of times this node has been slashed |
earned_fee_balance | u64 | Claimable SOL fees released after expire_blob |
open_challenge_count | u32 | Concurrent open challenges against this node (blocks withdraw_bond while > 0) |
unbond_unlock_slot | u64 | Earliest Solana slot at which withdraw_bond is permitted (extended to each attested blob's expiry_slot) |
status | NodeStatus | Active, Slashed, or Unbonding |
registered_slot | u64 | Solana slot at registration |
bump | u8 | PDA bump seed |
BlobRecord (223 bytes)
Light clients read commitment_root directly from Solana RPC at byte offset 72..104 (8 discriminator + 32 publisher + 32 blob_id_hash).
| Field | Type | Description |
|---|---|---|
publisher | Pubkey | Publisher wallet |
blob_id_hash | [u8; 32] | SHA-256 hash of the UTF-8 blobId string |
commitment_root | [u8; 32] | 32-byte TCDA matrix Merkle commitment root (bytes 72..104) |
payload_size_bytes | u32 | Ciphertext byte length (> 0 and <= k^2 * 512) |
k | u8 | Data matrix width (2..16) |
n | u8 | Coded matrix width (2 * k, 4..32) |
retention_depth | u8 | TCDA retention depth (1..4) |
policy_id_hash | [u8; 32] | SHA-256 hash of the disclosure policyId |
escrowed_fee | u64 | Full SOL fee while Pending; vested node fee while Available; 0 once Expired or Cancelled |
protocol_fee_bps | u16 | Snapshotted ProtocolConfig.protocol_fee_bps at anchor time |
anchor_slot | u64 | Slot when anchor_blob executed |
attestation_deadline_slot | u64 | Snapshotted anchor_slot + config.attestation_timeout_slots |
attestation_slot | u64 | Slot when attest_availability executed (0 while Pending) |
expiry_slot | u64 | anchor_slot + expiry_slots |
attesting_node | Pubkey | DaNode PDA that co-signed attestation (verified by open_challenge and expire_blob) |
open_challenge_count | u16 | Open challenges on this blob (blocks close_blob while > 0) |
failed_challenges | u16 | Slashed challenges on this blob (forfeits vested node fee on expire_blob if > 0) |
status | BlobStatus | Pending, Available, Expired, or Cancelled |
bump | u8 | PDA bump seed |
Challenge (132 bytes)
| Field | Type | Description |
|---|---|---|
challenger | Pubkey | Verifier wallet that opened the challenge |
blob | Pubkey | BlobRecord PDA |
node | Pubkey | Challenged DaNode PDA |
row | u8 | Missing cell row (< blob.n) |
col | u8 | Missing cell column (< blob.n) |
opened_slot | u64 | Slot when open_challenge executed |
deadline_slot | u64 | opened_slot + config.challenge_window_slots |
slash_amount | u64 | (node.bonded_lamports * config.slash_bps) / 10_000 |
status | ChallengeStatus | Open, Resolved, or Slashed |
bump | u8 | PDA bump seed |
Instructions (All 15)
All instructions except close_blob and close_challenge carry two trailing accounts for Anchor #[event_cpi]: event_authority (["__event_authority"], readonly) and program (alder_da, readonly).
| Instruction | Arguments | Signer(s) | Accounts (before event CPI) | State Change | ||
|---|---|---|---|---|---|---|
init_protocol | fee_recipient: Pubkey, protocol_fee_bps: u16, min_node_bond: u64, min_fee_per_byte: u64, challenge_window_slots: u64, attestation_timeout_slots: u64, slash_bps: u16 | authority (INITIAL_DEPLOYER) | authority (mut), config (init), system_program | Initializes ProtocolConfig PDA (front-run guarded) | ||
update_protocol | new_authority: Pubkey, fee_recipient: Pubkey, protocol_fee_bps: u16, min_node_bond: u64, min_fee_per_byte: u64, challenge_window_slots: u64, attestation_timeout_slots: u64, slash_bps: u16 | authority | authority, config (mut) | Rotates authority and updates protocol config for future blobs/challenges | ||
register_node | endpoint_hash: [u8; 32], bond_lamports: u64 | operator | operator (mut), config, node (init), system_program | Transfers bond_lamports to DaNode PDA, sets Active | ||
top_up_bond | amount_lamports: u64 | operator | operator (mut), config, node (mut), system_program | Adds bond; restores Active if >= min_node_bond | ||
withdraw_bond | amount_lamports: u64 | operator | operator (mut), config, node (mut) | Requires open_challenge_count == 0 and slot >= unbond_unlock_slot; debits PDA above rent + earned fees | ||
anchor_blob | blob_id_hash: [u8; 32], commitment_root: [u8; 32], payload_size_bytes: u32, k: u8, n: u8, retention_depth: u8, policy_id_hash: [u8; 32], expiry_slots: u64, fee_lamports: u64 | publisher | publisher (mut), config, blob (init), system_program | Enforces payload_size_bytes <= k^2 * 512, fee_lamports >= min_fee, expiry_slots >= 10; snapshots protocol_fee_bps and attestation_deadline_slot | ||
attest_availability | attestation_root: [u8; 32] | authority, operator | authority, operator, config (mut), blob (mut), node (mut), fee_recipient (mut) | Requires custodian operator co-signature; checks attestation_root == blob.commitment_root, slot < expiry_slot, and slot <= attestation_deadline_slot; routes protocol_fee to fee_recipient, vests node_fee in BlobRecord, sets attesting_node and unbond_unlock_slot | ||
expire_blob | none | permissionless | config (mut), blob (mut), node (mut), fee_recipient (mut) | Requires slot >= expiry_slot and blob.attesting_node == node.key(); releases vested node_fee to node.earned_fee_balance if blob.failed_challenges == 0, otherwise forfeits to fee_recipient; sets Expired and decrements active counts | ||
close_blob | none | publisher | publisher (mut), blob (mut, close) | Requires Expired or Cancelled, escrowed_fee == 0, and open_challenge_count == 0; returns rent to publisher | ||
cancel_blob | none | publisher | publisher (mut), config, blob (mut) | After attestation_deadline_slot, refunds escrowed_fee to publisher, sets Cancelled | ||
open_challenge | row: u8, col: u8 | challenger | challenger (mut), config, blob (mut), node (mut), challenge (init), system_program | Checks Available, slot < expiry_slot, attesting_node == node.key(), challenger != node.operator, node Active or Slashed with bonded_lamports > 0; increments node.open_challenge_count and blob.open_challenge_count | ||
respond_challenge | cell_data: Vec<u8>, merkle_proof: Vec<[u8; 32]> | operator | operator, node (mut), blob (mut), challenge (mut) | Enforces 1..=512 byte cell_data and exact Merkle depth for blob.n * blob.n; verifies `SHA-256("alder:cell:v1:<row>:<col>:" \ | \ | cell_data) and Merkle inclusion against blob.commitment_root` on chain; resolves challenge and decrements both open challenge counts |
slash_node | none | caller | caller, config, challenge (mut), blob (mut), node (mut), challenger (mut), fee_recipient (mut) | After deadline_slot, slashes min(slash_amount, bonded_lamports) 50% to challenger and 50% to fee_recipient, increments blob.failed_challenges, decrements open challenge counts | ||
close_challenge | none | challenger | challenger (mut), challenge (mut, close) | Closes Resolved or Slashed Challenge, returning rent to challenger | ||
claim_node_fees | none | operator | operator (mut), node (mut) | Transfers earned_fee_balance from DaNode PDA to operator |
CPI Events
All 12 events are emitted via emit_cpi! so indexers decode them from inner instruction data (tag e445a52e51cb9a1d) without log truncation:
ProtocolInitialized:authority,fee_recipient,protocol_fee_bps,min_node_bond,min_fee_per_byteProtocolUpdated:authority,fee_recipient,protocol_fee_bps,min_node_bond,min_fee_per_byte,slash_bpsNodeRegistered:operator,node,bonded_lamports,endpoint_hash,slotBondUpdated:operator,node,bonded_lamportsBlobAnchored:blob,publisher,blob_id_hash,commitment_root,payload_size_bytes,k,n,retention_depth,fee_lamports,anchor_slot,expiry_slotBlobAttested:blob,node,attestation_root,attestation_slot,protocol_fee,node_feeBlobExpired:blob,node,released_node_fee,slotBlobCancelled:blob,publisher,refunded_lamports,slotChallengeOpened:challenge,blob,node,challenger,row,col,deadline_slot,slash_amountChallengeResolved:challenge,node,cell_hash,slotNodeSlashed:challenge,node,challenger,bounty_lamports,protocol_lamports,slotNodeFeesClaimed:operator,node,amount_lamports
Error Codes (AlderError)
| Code | Name | Message |
|---|---|---|
6000 | UnauthorizedDeployer | Only the authorized deployer may initialize the protocol |
6001 | InvalidFeeBps | Protocol fee bps must be <= 5000 |
6002 | InvalidSlashBps | Slash bps must be between 1 and 5000 |
6003 | InvalidWindow | Slot window is too small |
6004 | BondTooLow | Node bond is below the protocol minimum |
6005 | ZeroAmount | Amount must be greater than zero |
6006 | InsufficientBond | Insufficient bonded lamports |
6007 | InvalidPayloadSize | Payload size must be greater than zero |
6008 | PayloadTooLargeForK | Payload exceeds max size for chosen k (cell size must be <= 512 bytes) |
6009 | FeeTooLow | Availability fee is below protocol minimum |
6010 | InvalidCodingShape | Invalid 2D Reed-Solomon coding shape |
6011 | InvalidRetentionDepth | TCDA retention depth must be between 1 and 4 |
6012 | BlobNotPending | Blob is not in Pending state |
6013 | BlobNotAvailable | Blob is not in Available state |
6014 | NodeNotActive | DA node is not Active or has zero remaining bond |
6015 | AttestationWindowActive | Attestation timeout window has not elapsed |
6016 | InvalidCellCoordinate | Cell coordinate out of bounds |
6017 | ChallengeNotOpen | Challenge is not Open |
6018 | ChallengeWindowElapsed | Challenge deadline slot has already passed |
6019 | ChallengeWindowActive | Challenge deadline slot has not elapsed yet |
6020 | InvalidCellOpening | Invalid cell opening or Merkle inclusion proof |
6021 | NothingToClaim | No earned fees available to claim |
6022 | MathOverflow | Arithmetic overflow |
6023 | OpenChallengesExist | Cannot proceed while open challenges exist |
6024 | UnbondCooldownActive | Unbonding cooldown slot has not been reached |
6025 | BlobExpired | Blob retention window has expired |
6026 | BlobNotExpired | Blob has not reached its expiry slot yet |
6027 | NodeNotCustodian | DA node is not the attesting custodian for this blob |
6028 | CommitmentMismatch | Attestation root does not match blob commitment root |
6029 | AttestationWindowElapsed | Attestation timeout window has already elapsed |
6030 | SelfChallengeNotAllowed | Node operator cannot challenge their own node |
6031 | BlobNotClosable | Blob cannot be closed until Expired or Cancelled with zero escrow |
6032 | ChallengeNotClosable | Challenge cannot be closed until Resolved or Slashed |
Next Steps
- See how protocol fees route to the
ALDRlaunch wallet in `ALDR` Tokenomics. - Review the HTTP wrappers for every instruction in REST and SSE API.