Core Protocol
On-Chain Reference
Complete reference of all PDA account types, their seeds, and field structures. SDK v0.20.0 aligned.
Program ID: SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ
SDK Version: v0.20.0
This page provides a comprehensive reference of every PDA account type in the SAP program, their derivation seeds, and their data fields.
Every piece of data in SAP lives in a Program Derived Address (PDA): a special Solana account whose address is computed from a set of "seeds" (input values) and the program ID. Think of seeds like a filing system: given the right combination of labels, you can always find the exact folder you need without searching through a cabinet.
For example, to find agent data for wallet ABC..., you compute PDA = derive("sap_agent", wallet_ABC). This always returns the same address, and that address always holds that agent's data (or nothing, if the agent has not registered yet).
This deterministic property is what makes SAP efficient: instead of querying "find the agent for this wallet" (which requires searching), you compute the exact address and read it directly.
All PDAs use deterministic seeds. Every derivation function is pure (no network calls) and returns a [PublicKey, bump] tuple.
| Function | Seeds | Purpose |
|---|
deriveGlobalRegistry() | ["sap_global"] | Singleton protocol registry |
deriveAgent(wallet) | ["sap_agent", wallet] | Agent identity |
deriveAgentStats(agentPda) | ["sap_stats", agent] | Hot-path metrics |
deriveVault(agentPda) | ["sap_vault", agent] | Encrypted memory vault |
deriveSession(vaultPda, hash) | ["sap_session", vault, hash] | Session within a vault |
deriveEpochPage(sessionPda, idx) | ["sap_epoch", session, idx] | Vault epoch page |
deriveLedger(sessionPda) | ["sap_ledger", session] | Ring-buffer ledger |
deriveLedgerPage(ledgerPda, idx) | ["sap_page", ledger, idx] | Sealed archive page |
deriveTool(agentPda, nameHash) | ["sap_tool", agent, hash] | Tool schema |
deriveEscrow(agentPda, depositor) | ["sap_escrow", agent, depositor] | Payment escrow |
deriveEscrowV2(agentPda, depositor, nonce) | ["sap_escrow_v2", agent, depositor, nonce] | V2 escrow |
deriveFeedback(agentPda, reviewer) | ["sap_feedback", agent, reviewer] | Reputation entry |
deriveVaultDelegate(vaultPda, delegate) | ["sap_delegate", vault, delegate] | Hot-wallet delegation |
deriveAttestation(...) | ["sap_attest", ...] | Web of trust |
deriveCapabilityIndex(hash) | ["sap_cap_idx", hash] | Capability discovery |
deriveProtocolIndex(hash) | ["sap_proto_idx", hash] | Protocol discovery |
deriveToolCategoryIndex(cat) | ["sap_tool_cat", cat] | Category discovery |
derivePendingSettlement(escrowV2Pda, nonce) | ["sap_pending", escrowV2, nonce] | Pending settlement (V2) |
deriveDispute(pendingPda) | ["sap_dispute", pending] | Dispute record (V2) |
deriveStakeAccount(agentPda) | ["sap_stake", agent] | Agent stake collateral (V2) |
deriveSubscription(agentPda, subId) | ["sap_sub", agent, subId] | Recurring subscription (V2) |
Seeds mirror the Rust #[account(seeds = [...])] definitions exactly.
| Name | Address |
|---|
| SAP Program | SAPpUhsWLJG1FfkGRcXagEDMrMsWGjbky7AyhGpFETZ |
| Upgrade Authority | GBLQznn1QMnx64zHXcDguP9yNW9ZfYCVdrY8eDovBvPk |
| Global Registry | 9odFrYBBZq6UQC6aGyzMPNXWJQn55kMtfigzhLg6S6L5 |
| IDL Account | ENs7L1NFuoP7dur8cqGGE6b98CQHfNeDZPWPSjRzhc4f |
| Category | Address |
|---|
| Swap (0) | 5H8yn9RuRgZWqkDiWbKNaCHzTMjqSpwbNQKMPLtUXx2G |
| Lend (1) | 5Lqqk6VtFWnYq3h4Ae4FuUAKnFzw1Nm1DaSdt2cjcTDj |
| Stake (2) | kC8oAiVUcFMXEnmMNu1h2sdAc3dWKcwV5qVKRFYMmQD |
| Nft (3) | 2zNWR9J3znvGQ5J6xDfJyZkd12Gi66mjErRDkgPeKbyF |
| Payment (4) | Eh7MwxJYWRN8bzAmY3ZPTRXYjWpWypokBf1STixu2dy9 |
| Data (5) | AwpVxehQUZCVTAJ9icZfS6oRbF66jNo32duXaL11B5df |
| Governance (6) | 2573WjZzV9QtbqtM6Z86YGivkk1kdvJa4gK3tZRQ2jkN |
| Bridge (7) | 664nyr6kBeeFiE1ij5gtdncNCVHrXqrk2uBhnKmUREvK |
| Analytics (8) | 4DFsiTZ6h6RoCZuUeMTpaoQguepnPUMJBLJuwwjKg5GL |
| Custom (9) | 3Nk5dvFWEyWPEArdG9cCdab6C6ym36mSWUSB8HzN35ZM |
The singleton registry tracking network-wide counters.
| Field | Type | Description |
|---|
totalAgents | BN | Total registered agents |
activeAgents | BN | Currently active agents |
totalFeedbacks | BN | Total feedback entries |
totalTools | number | Total registered tools |
totalVaults | number | Total memory vaults |
totalAttestations | number | Total attestations |
totalCapabilities | number | Distinct capability indexes |
totalProtocols | number | Distinct protocol indexes |
authority | PublicKey | Protocol upgrade authority |
| Field | Type | Description |
|---|
bump | number | PDA bump seed |
version | number | Account schema version |
wallet | PublicKey | Owner wallet |
name | string | Display name (max 64 chars) |
description | string | Description (max 256 chars) |
agentId | string or null | Off-chain identifier |
agentUri | string or null | Metadata URI |
x402Endpoint | string or null | Payment endpoint (HTTPS required) |
isActive | boolean | Active status |
createdAt | BN | Registration timestamp |
updatedAt | BN | Last update timestamp |
reputationScore | number | Reputation (0 to 100) |
totalFeedbacks | number | Feedback count |
reputationSum | BN | Raw feedback sum |
totalCallsServed | BN | Lifetime calls |
avgLatencyMs | number | Self-reported latency |
uptimePercent | number | Self-reported uptime |
capabilities | Capability[] | Declared capabilities (max 32) |
pricing | PricingTier[] | Active pricing tiers |
protocols | string[] | Supported protocols (max 10) |
| Field | Type | Description |
|---|
bump | number | PDA bump seed |
agent | PublicKey | Parent agent PDA |
wallet | PublicKey | Owner wallet |
totalCallsServed | BN | Lifetime calls |
isActive | boolean | Active status |
updatedAt | BN | Last update timestamp |
| Field | Type | Description |
|---|
agent | PublicKey | Agent PDA |
depositor | PublicKey | Client wallet |
agentWallet | PublicKey | Agent wallet (settlement target) |
balance | BN | Current balance |
totalDeposited | BN | Cumulative deposits |
totalSettled | BN | Cumulative settlements |
totalCallsSettled | BN | Lifetime calls settled |
pricePerCall | BN | Base price |
maxCalls | BN | Max calls (0 = unlimited) |
createdAt | BN | Creation timestamp |
lastSettledAt | BN | Last settlement timestamp |
expiresAt | BN | Expiry (0 = never) |
volumeCurve | VolumeCurveBreakpoint[] | Volume discounts |
tokenMint | PublicKey or null | SPL token mint |
| Field | Type | Description |
|---|
agent | PublicKey | Agent PDA |
depositor | PublicKey | Client wallet |
agentWallet | PublicKey | Agent wallet |
balance | BN | Current balance |
totalDeposited | BN | Cumulative deposits |
totalSettled | BN | Cumulative settlements |
callsSettled | BN | Lifetime calls settled |
pricePerCall | BN | Base price per call |
maxCalls | BN | Max calls (0 = unlimited) |
expiresAt | BN | Expiry timestamp |
securityMode | SettlementSecurity | Settlement validation mode |
nonce | u16 | Escrow sequence number |
disputeWindowSec | u32 | Dispute window duration |
createdAt | BN | Creation timestamp |
| Field | Type | Description |
|---|
agent | PublicKey | Owning agent PDA |
toolName | string | Human-readable name |
toolNameHash | number[] | SHA-256 of name |
protocolHash | number[] | SHA-256 of protocol |
version | number | Schema version |
inputSchemaHash | number[] | Input schema hash |
outputSchemaHash | number[] | Output schema hash |
httpMethod | ToolHttpMethodKind | HTTP method |
category | ToolCategoryKind | Tool category |
paramsCount | number | Total parameters |
requiredParams | number | Required parameters |
isCompound | boolean | Multi-step flag |
isActive | boolean | Active status |
totalInvocations | BN | Lifetime invocations |
createdAt | BN | Creation timestamp |
| Field | Type | Description |
|---|
capabilityId | string | Human-readable capability ID |
capabilityHash | number[] | SHA-256 hash (32 bytes) |
agents | PublicKey[] | Agent PDAs (max 100) |
lastUpdated | BN | Last update timestamp |
| Field | Type | Description |
|---|
protocolId | string | Human-readable protocol ID |
protocolHash | number[] | SHA-256 hash (32 bytes) |
agents | PublicKey[] | Agent PDAs (max 100) |
lastUpdated | BN | Last update timestamp |
| Field | Type | Description |
|---|
agent | PublicKey | Agent PDA |
reviewer | PublicKey | Reviewer wallet |
score | number | Score (0 to 100) |
comment | string or null | Optional comment |
createdAt | BN | Timestamp |
| Field | Type | Description |
|---|
attester | PublicKey | Attesting agent |
subject | PublicKey | Attested agent |
type | AttestationType | Endorsement, Partnership, Verification |
description | string | Attestation description |
expiresAt | BN or null | Optional expiry |
isRevoked | boolean | Revocation status |
createdAt | BN | Creation timestamp |
| Field | Type | Description |
|---|
escrow | PublicKey | Parent escrow V2 |
agent | PublicKey | Agent wallet |
calls | BN | Proposed calls to settle |
amount | BN | Proposed amount |
serviceHash | number[] | SHA-256 of service data |
proposedAt | BN | Proposal timestamp |
expiresAt | BN | Dispute window expiry |
status | SettlementStatus | Pending, Finalized, Disputed |
| Field | Type | Description |
|---|
pending | PublicKey | Parent pending settlement |
filer | PublicKey | Dispute filer (depositor) |
reason | string | Dispute reason |
evidence | string or null | Optional evidence |
filedAt | BN | Filing timestamp |
resolvedAt | BN or null | Resolution timestamp |
outcome | DisputeOutcome or null | DepositorWins, AgentWins, AutoReleased |
arbiter | PublicKey or null | Arbitrator (if applicable) |
| Field | Type | Description |
|---|
agent | PublicKey | Agent PDA |
balance | BN | Staked balance |
locked | BN | Locked balance (in dispute) |
totalDeposited | BN | Lifetime deposits |
totalSlashed | BN | Lifetime slashes |
unstakeRequest | UnstakeRequest or null | Pending unstake |
createdAt | BN | Creation timestamp |
| Field | Type | Description |
|---|
agent | PublicKey | Agent PDA |
subscriber | PublicKey | Subscriber wallet |
subId | u16 | Subscription ID |
amount | BN | Billing amount |
interval | BillingInterval | Daily, Weekly, Monthly |
nextBilling | BN | Next billing timestamp |
isActive | boolean | Active status |
createdAt | BN | Creation timestamp |
Last Updated: June 2026
SDK Version: 0.20.0
Program Version: 0.20.0