Guides
Credit lines on Solana
The worked example of a consumer program: pof-credit opens a credit line against a receipt from pof-gate, pays draws from a pool vault, and stops paying when the line’s proof goes stale.
#The flow
Prove, bound to the borrower
The holder proves at least the pool’s threshold, to the pool’s audience, bound to their Solana wallet.
Attest and record a receipt
The attestor signs the verdict; a relayer submits it to pof-gate, which creates the receipt.
Open the line
The borrower signs
open_line; the relayer pays the rent. pof-credit checks the receipt and consumes it through pof-gate, so it can never open a second line.Draw, and refresh
Draws pay out from the vault up to the limit while the proof is fresh; a new proof refreshes the line.
#Accounts
#Pool terms
| Term | Set by | Demo value |
|---|---|---|
audience | init_pool | blake2b("pof-credit:usdc-pool-1") |
required_zatoshi | init_pool | 50,000,000,000 (500 ZEC) |
line_limit | init_pool | 25,000 dUSDC |
fresh_secs | set_freshness | 86,400 (24 hours, the default) |
min_anchor_height | set_freshness | the oldest anchor accepted |
#What open_line and refresh_line check
- the receipt’s audience is the pool’s (
WrongAudience); - its claim value is at least the threshold (
BelowThreshold); - the signer is the receipt’s beneficiary, the bound wallet;
- it has not been consumed (
ReceiptConsumed) and its proof has not expired (ProofExpired); - its anchor is no older than the pool’s floor (
AnchorTooOld), and, for a refresh, no older than the line’s last.
A line stays drawable until min(now + fresh_secs, proof expiry). After that, draw fails with NeedsFreshProof until a refresh. A holder who has spent the coins cannot make the new proof.
#Try it
/demo runs this whole flow on devnet with a demo relayer: the proof, the attestation, the receipt, the line, a 1,000 dUSDC draw, and the breakers (replay, a stranger’s wallet, a tampered attestation, a tampered proof, a revoked proof).