Shader
Program accounts

DocsReference26 of 35 · 5 min read

Program accounts

Every account the shader program owns, with its seeds, its size and each field.

Every account is a PDA of the program at 7zWT5PFYqHPiztwzvkDAANq7JdsLsV1MaLjFJeTLux22. Sizes include Anchor's 8-byte discriminator; rent depends on the cluster, so read it with getMinimumBalanceForRentExemption for the size given. Amounts in credits are in credit base units (1,000 per credit).

#AgentKey

A spending permission a wallet gives one agent. settle checks every line that names it against its caps.

Seeds "agent_key", wallet, key_id. Size 150 bytes with the 8-byte discriminator.

FieldTypeMeaning
walletpubkeyWallet whose credits the key spends.
key_id[u8; 32]Identifier of the API token bound to this key, chosen when the key is created.
labelstringName the owner gave the key.
per_request_capu64Most credits, in base units, one settlement line may ask for.
per_day_capu64Most credits, in base units, the key may be charged in one UTC day.
day_indexi64UTC day (days since the Unix epoch) that spent_in_day counts.
spent_in_dayu64Credits charged to the key in day_index, in base units.
revokedboolTrue once revoke_agent_key has run. A revoked key stays on chain with its history.
created_ati64Unix time the key was created.
bumpu8PDA bump.

#Config

The one global account. It holds the authorities, the mints, the fee share rate and the running totals the cranks work from, and it owns the USDC treasury and the SHDR escrow.

Seeds "config". Size 284 bytes with the 8-byte discriminator.

FieldTypeMeaning
adminpubkeyAuthority for update_config, set_shdr_mint and the withdrawals.
settlerpubkeyThe only key settle accepts as signer.
price_signerpubkeyKey that co-signs deposit_shdr to attest the SHDR quote.
launch_walletpubkeyWallet whose USDC associated token account receives the fee share.
usdc_mintpubkeyUSDC mint.
nvdax_mintpubkeyNVDAx mint paid out by Earn.
shdr_mintpubkeySHDR mint, the default (all-zero) key until set_shdr_mint runs.
fee_share_bpsu16Protocol share of used USDC-backed credits, in basis points.
usdc_credits_outstandingu64USDC-backed credits held by all credit accounts, in base units.
shdr_credits_outstandingu64SHDR-backed credits held by all credit accounts, in base units.
used_usdc_unsweptu64USDC-backed credits spent, plus x402 revenue recorded, since the last sweep_fee_share.
shdr_atoms_pending_burnu64SHDR atoms tied to spent credits, waiting for burn_used.
total_shdr_burnedu64SHDR atoms burned so far.
total_fee_share_sweptu64USDC atoms paid to the launch wallet so far.
bumpu8PDA bump.
require_meterboolWhen true, settle refuses rental lines that carry no meter seal. Generation lines are unaffected.

#CreditAccount

One per wallet, created by its first deposit. It holds the wallet's credits in two parts and the SHDR behind the SHDR-backed part.

Seeds "credit", wallet. Size 89 bytes with the 8-byte discriminator.

FieldTypeMeaning
walletpubkeyOwner of the credits.
usdc_creditsu64USDC-backed credits, in base units.
shdr_creditsu64SHDR-backed credits, in base units.
shdr_escrowedu64SHDR atoms in escrow behind shdr_credits.
settle_nonceu64Count of settlements so far; settle must name it as expected_nonce.
lifetime_depositedu64Credits ever deposited, in base units.
lifetime_spentu64Credits ever charged, in base units.
bumpu8PDA bump.

#EarnPool

The one Earn pool, created by set_shdr_mint. It owns the SHDR stake vault and the NVDAx reward vault.

Seeds "earn". Size 57 bytes with the 8-byte discriminator.

FieldTypeMeaning
total_stakedu64SHDR atoms staked by all wallets.
acc_reward_per_shareu128NVDAx atoms earned per staked SHDR atom since the pool began, times REWARD_SCALE.
undistributedu64NVDAx atoms received but not yet shared out: funding that arrived while nothing was staked, and rounding dust.
total_fundedu64NVDAx atoms ever received by fund_earn.
total_claimedu64NVDAx atoms ever claimed.
bumpu8PDA bump.

#EarnStake

One per wallet that stakes.

Seeds "stake", wallet. Size 81 bytes with the 8-byte discriminator.

FieldTypeMeaning
walletpubkeyOwner of the stake.
amountu64SHDR atoms staked.
reward_debtu128amount × acc_reward_per_share at the last accrual, so only later funding counts toward pending.
pendingu64NVDAx atoms accrued and not yet claimed.
total_claimedu64NVDAx atoms this wallet has claimed.
bumpu8PDA bump.

#RentalMeter

One per metered rental: the meter key pinned for the job. The settler creates it at the job's first metered settlement and closes it on the line flagged last, returning its rent.

Seeds "meter", job_id. Size 93 bytes with the 8-byte discriminator.

FieldTypeMeaning
job_id[u8; 16]The rental id, 16 bytes.
meter_keypubkeyThe meter agent's public key; every seal for the job must be signed by it.
gpu_uuid_hash[u8; 32]SHA-256 of the GPU UUID the meter registered.
highest_minuteu32The last minute settled; each new line must name a later minute.
bumpu8PDA bump.