How alii-hamza/setra402 works
Setra402 is a Solana escrow protocol for conditional machine-to-machine payments. The documented flow is funding an escrow, executing a task, verifying its output, then settling payment or refunding it. The checked-in runtime includes an Anchor program, TypeScript client, and facilitator verification agent; the README also describes a seller gateway and blind-voucher flow, but their implementation is not present in the tree. Edges for that undocumented wiring are therefore omitted.
Main entry points: lib.rs Instruction dispatch · state.rs Task and vault PDAs · settle_task_private.rs Private settlement · client.ts Setra client
Components 16
Client and verification
- Setra client
sdk/src/client.ts - Output verifier
facilitator/src/agent.ts
Solana escrow program
- Instruction dispatch
programs/setra402/src/lib.rs - Fund task escrow
programs/setra402/src/instructions/initialize_task.rs - Public settlement
programs/setra402/src/instructions/settle_task.rs - Private settlement
programs/setra402/src/instructions/settle_task_private.rs - Voluntary cancel
programs/setra402/src/instructions/cancel_task.rs - Timeout refund
programs/setra402/src/instructions/refund_task.rs - Task and vault PDAs
programs/setra402/src/state.rs - Nullifier records
programs/setra402/src/state.rs
Shared account schemas
- Shared account types
shared/task-anchor-types/src/lib.rs
Other components
- Buyer agent
- Seller gateway
- Verifier agent
- Solana RPC
- SPL Token program
Connections 23
- Buyer agent → Setra client: creates task
- Setra client → Solana RPC: submits transactions
- Setra client → Instruction dispatch: invokes instructions
- Instruction dispatch → Fund task escrow: dispatches
- Instruction dispatch → Public settlement: dispatches
- Instruction dispatch → Private settlement: dispatches
- Instruction dispatch → Voluntary cancel: dispatches
- Instruction dispatch → Timeout refund: dispatches
- Fund task escrow → Task and vault PDAs: creates task state
- Fund task escrow → SPL Token program: transfers funds
- Public settlement → Task and vault PDAs: updates status
- Public settlement → SPL Token program: pays seller and fee
- Private settlement → Task and vault PDAs: updates status
- Private settlement → Nullifier records: creates record
- Private settlement → SPL Token program: pays seller and fee
- Voluntary cancel → Task and vault PDAs: updates status
- Voluntary cancel → SPL Token program: refunds and charges fee
- Timeout refund → Task and vault PDAs: updates status
- Timeout refund → SPL Token program: returns principal
- Seller gateway → Buyer agent: returns output hash
- Verifier agent → Output verifier: requests verification
- Output verifier → Setra client: settles after match
- Shared account types → Task and vault PDAs: mirrors schemas