Reference

API

Every endpoint of the API: its parameters, request, response and errors.

The API reads Once's accounts for clients, builds the transactions a wallet signs, and relays claims and withdrawals so the person's wallet never appears. It never sees a person's credential, secret or leaf choice: proofs are made on the device and arrive finished.

Examples use $ONCE_API for the API's address; on the localnet it is http://127.0.0.1:27310. Each heading below is also the method name on the TypeScript client:

ts
import { createClient } from '@once/sdk'

const api = createClient(process.env.ONCE_API!)
const { items } = await api.listScopes({ status: 'open' })

Conventions

  • Bodies are JSON. A request with a field its schema doesn't name is refused; a response may carry fields this page doesn't list yet.
  • Amounts are decimal strings in base units (lamports, or USDC's 6-decimal units), so no value loses precision.
  • Times are ISO 8601 in UTC.
  • 32-byte values (nullifiers, roots, leaves) are lowercase hex. BabyJubJub points are packed into 32 bytes of hex: the y coordinate little-endian, with the sign of x in the top bit. Signatures are the packed R8 point followed by S, 64 bytes of hex.
  • Lists come in pages: pass limit and the previous page's page.nextCursor as cursor until nextCursor is null.
  • A failed call answers with the error envelope.

Service

health

GET /health · api.health

Whether the service is up. fixture on the fixture server, waiting while the chain API waits for the program, ready once it serves.

Response

NameTypeDescription
statusrequired"fixture" | "waiting" | "ready"fixture, waiting or ready.

config

GET /v1/config · api.config

Everything a client needs before its first call: the cluster, the program and its PDAs, assets and relay fees, issuers, OPRF nodes and their key, circuit artifacts and the Rings endpoints.

Response

NameTypeDescription
clusterrequired"localnet" | "mainnet"The cluster the API serves.
programIdrequiredaddressThe Once program’s address.
feeBpsrequiredintegerThe protocol fee on drops, in basis points.
authorityPdasrequiredobjectThe program’s PDAs.
authorityPdas.configrequiredaddressThe config account.
authorityPdas.treerequiredaddressThe person tree account.
authorityPdas.ringsrequiredaddressThe holders authority, which owns payout notes.
authorityPdas.pooladdressThe pool authority, which owns drop pools.
authorityPdas.holdersaddressThe holders authority, which owns payout notes.
feeRecipientaddressThe wallet that receives the protocol fee.
relayeraddressThe relayer’s wallet, which receives the relay fees.
assetsrequiredobject[]The assets drops can pay in.
assets[].symbolrequired"SOL" | "USDC"The asset’s symbol.
assets[].mintrequiredaddressThe asset’s mint.
assets[].decimalsrequiredintegerThe asset’s decimals.
assets[].claimRelayFeerequiredinteger stringThe relay fee per claim in this asset, in base units.
pollRelayFeeLamportsrequiredinteger stringThe relay fee per vote, in lamports, drawn from a poll’s relay budget.
issuersrequiredobject[]The issuers in the registry.
issuers[].idrequiredstringThe issuer’s ID.
issuers[].namerequiredstringThe issuer’s name.
issuers[].publicKeyrequiredhex32The issuer’s key, packed BabyJubJub hex.
issuers[].statusrequired"active" | "revoked"active, or revoked once retired.
oprfNodesrequiredobject[]The OPRF nodes.
oprfNodes[].indexrequiredintegerThe node’s index.
oprfNodes[].urlrequiredURLWhere the node answers evaluations.
oprfNodes[].publicKeySharerequiredhex32The node’s public key share, packed BabyJubJub hex.
oprfNodes[].statusrequired"online" | "offline"Whether the node answers.
oprfThresholdrequiredintegerHow many node answers an enrollment needs.
oprfPublicKeyrequiredhex32The combined OPRF public key, packed BabyJubJub hex.
artifactsrequiredobject[]The circuit files, per circuit.
artifacts[].namerequired"authorize" | "enroll" | "claim"The circuit.
artifacts[].statusrequired"unavailable" | "partial" | "available"Whether its files are served.
artifacts[].wasmUrlrequiredURLThe witness generator.
artifacts[].zkeyUrlrequiredURLThe proving key.
artifacts[].verificationKeyUrlrequiredURLThe verification key.
artifacts[].sizesrequiredobjectFile sizes in bytes.
artifacts[].sizes.wasmrequiredintegerSize of the witness generator, bytes.
artifacts[].sizes.zkeyrequiredintegerSize of the proving key, bytes.
artifacts[].sizes.verificationKeyrequiredintegerSize of the verification key, bytes.
treeDepthrequiredintegerThe person tree’s depth.
rootHistoryrequiredintegerHow many recent roots a claim may prove against.
ringsrequiredobjectWhere the Rings client reads, proves and sends.
rings.rpcUrlrequiredURLSolana RPC for Rings transactions.
rings.indexerUrlrequiredURLThe Rings indexer.
rings.proverUrlrequiredURLThe Rings prover.

artifact

GET /v1/artifacts/{name}/{file} · api.artifact

One public circuit file, streamed as bytes: the WASM witness generator, the proving key or the verification key.

Parameters

NameTypeDescription
namerequired"authorize" | "enroll" | "claim" (path)The circuit: authorize, enroll or claim.
filerequired"wasm" | "zkey" | "verification-key" (path)Which file: wasm, zkey or verification-key.

Returns the file as application/octet-stream.

eventsUrl

GET /v1/events · api.eventsUrl

A server-sent event stream of changes: enrollments, revocations, scopes, claims and new tree roots.

Parameters

NameTypeDescription
sessionstring (query)EventSource session id.

Returns a text/event-stream of events.

Credentials and the OPRF

issueCredential

POST /v1/issuer/credentials · api.issueCredential

The demo issuer: checks the form with its stand-in check and signs a credential to the holder key. Localnet only.

Request

NameTypeDescription
subjectIdrequiredstringThe subject’s identifier with the issuer: a document number.
namerequiredstringThe subject’s full name.
dateOfBirthrequiredISO dateThe subject’s date of birth.
placeOfBirthrequiredstringThe subject’s place of birth.
sexrequiredstringThe subject’s sex as the issuer records it.
nationalityrequiredstringThe subject’s nationality.
holderPublicKeyrequiredhex32The holder key the credential is issued to, packed BabyJubJub hex.

Response

NameTypeDescription
@contextrequiredstring[]The W3C credentials context.
typerequiredstring[]The credential types: VerifiableCredential and one concrete type.
issuerrequiredobjectThe issuer’s ID and public key.
issuer.idrequiredstringThe issuer’s ID.
issuer.publicKeyrequiredhex32The issuer’s key, packed BabyJubJub hex.
validFromrequiredISO timeWhen the credential became valid. Part of HashID.
validUntilrequiredISO timeWhen the credential expires.
credentialSubjectrequiredobjectThe fields the issuer signed.
credentialSubject.subjectIdrequiredstringThe subject’s identifier with the issuer: a document number.
credentialSubject.namerequiredstringThe subject’s full name.
credentialSubject.dateOfBirthrequiredISO dateThe subject’s date of birth.
credentialSubject.placeOfBirthrequiredstringThe subject’s place of birth.
credentialSubject.sexrequiredstringThe subject’s sex as the issuer records it.
credentialSubject.nationalityrequiredstringThe subject’s nationality.
credentialSubject.holderPublicKeyrequiredhex32The holder key the credential is issued to, packed BabyJubJub hex.
proofrequiredobjectThe issuer’s signature over the credential.
proof.typerequiredstringBabyJubJubEdDSAPoseidon.
proof.rootrequiredhex32The root of the 16 credential values, hex.
proof.signaturerequiredhex64The issuer’s signature over the root, packed hex.

evaluateOprf

POST /v1/oprf/{nodeId}/evaluate · api.evaluateOprf

Sends one blinded query to one OPRF node through the API and returns the node’s answer.

Parameters

NameTypeDescription
nodeIdrequired"1" | "2" | "3" (path)The node’s index, 1 to 3.

Request

NameTypeDescription
nodeIdrequiredintegerThe node’s index, 1 to 3.
blindedQueryrequiredhex32The blinded point B, packed BabyJubJub hex.
authorizationProofrequiredProofThe authorize proof.
publicSignalsrequired(field string)[]The proof’s public signals as decimal strings.
holderPublicKeyrequiredhex32The holder key the credential is issued to, packed BabyJubJub hex.
holderSignaturerequiredhex64The holder key’s signature over the request, packed hex.
timestamprequiredISO timeWhen the request was signed; nodes accept one within a minute of their clock.

Response

NameTypeDescription
nodeIndexrequiredintegerThe answering node’s index.
partialEvaluationrequiredhex32The node’s answer Zᵢ = skᵢ·B, packed BabyJubJub hex.
dleqrequiredobjectThe node’s Chaum–Pedersen proof.
dleq.challengerequiredfield stringThe proof’s challenge, decimal.
dleq.responserequiredfield stringThe proof’s response, decimal.
publicKeySharerequiredhex32The node’s public key share, packed BabyJubJub hex.

oprfNodeInfo

GET /v1/oprf/{nodeId}/info · api.oprfNodeInfo

One OPRF node’s index, public key share and threshold, read through the API.

Parameters

NameTypeDescription
nodeIdrequired"1" | "2" | "3" (path)The node’s index, 1 to 3.

Response

NameTypeDescription
nodeIndexrequiredintegerThe answering node’s index.
publicKeySharerequiredhex32The node’s public key share, packed BabyJubJub hex.
thresholdrequiredintegerHow many node answers an enrollment needs.
statusrequired"online" | "waiting"Whether the node answers.

oprfInfo

GET /v1/info · createOprfClient(url).info

Served by each OPRF node itself: its index, its public key share and the threshold.

Response

NameTypeDescription
nodeIndexrequiredintegerThe answering node’s index.
publicKeySharerequiredhex32The node’s public key share, packed BabyJubJub hex.
thresholdrequiredintegerHow many node answers an enrollment needs.
statusrequired"online" | "waiting"Whether the node answers.

oprfEvaluate

POST /v1/evaluate · createOprfClient(url).evaluate

Served by each OPRF node itself: evaluates one blinded query with the node’s share. The same request and answer as evaluateOprf.

Request

NameTypeDescription
nodeIdrequiredintegerThe node’s index, 1 to 3.
blindedQueryrequiredhex32The blinded point B, packed BabyJubJub hex.
authorizationProofrequiredProofThe authorize proof.
publicSignalsrequired(field string)[]The proof’s public signals as decimal strings.
holderPublicKeyrequiredhex32The holder key the credential is issued to, packed BabyJubJub hex.
holderSignaturerequiredhex64The holder key’s signature over the request, packed hex.
timestamprequiredISO timeWhen the request was signed; nodes accept one within a minute of their clock.

Response

NameTypeDescription
nodeIndexrequiredintegerThe answering node’s index.
partialEvaluationrequiredhex32The node’s answer Zᵢ = skᵢ·B, packed BabyJubJub hex.
dleqrequiredobjectThe node’s Chaum–Pedersen proof.
dleq.challengerequiredfield stringThe proof’s challenge, decimal.
dleq.responserequiredfield stringThe proof’s response, decimal.
publicKeySharerequiredhex32The node’s public key share, packed BabyJubJub hex.

People and the tree

personByWallet

GET /v1/people/wallet/{wallet} · api.personByWallet

The enrollment a wallet made, if any.

Parameters

NameTypeDescription
walletrequiredaddress (path)The wallet, base58.

Response

NameTypeDescription
statusrequired"not_enrolled" | "enrolled" | "revoked"not_enrolled, enrolled or revoked.
walletrequiredaddress | nullThe wallet that enrolled.
personNullifierrequiredhex32 | nullThe person nullifier N, 32 bytes hex.
leafIndexrequiredinteger | nullThe leaf’s index in the person tree.
sincerequiredISO time | nullWhen it enrolled.
expiresAtrequiredISO time | nullWhen its credential expires.
revokedAtrequiredISO time | nullWhen it was last revoked.
treeSizerequiredintegerHow many leaves the person tree has.

personByNullifier

GET /v1/people/nullifier/{nullifier} · api.personByNullifier

The enrollment under a person nullifier, if any.

Parameters

NameTypeDescription
nullifierrequiredhex32 (path)The person nullifier N, 32 bytes hex.

Response

NameTypeDescription
statusrequired"not_enrolled" | "enrolled" | "revoked"not_enrolled, enrolled or revoked.
walletrequiredaddress | nullThe wallet that enrolled.
personNullifierrequiredhex32 | nullThe person nullifier N, 32 bytes hex.
leafIndexrequiredinteger | nullThe leaf’s index in the person tree.
sincerequiredISO time | nullWhen it enrolled.
expiresAtrequiredISO time | nullWhen its credential expires.
revokedAtrequiredISO time | nullWhen it was last revoked.
treeSizerequiredintegerHow many leaves the person tree has.

buildEnroll

POST /v1/enroll/build · api.buildEnroll

Builds the enroll transaction for the wallet to sign, and simulates it.

Request

NameTypeDescription
walletrequiredaddressThe wallet, base58.
proofrequiredProofThe Groth16 proof as snarkjs writes it.
publicSignalsrequired(field string)[]The proof’s public signals as decimal strings.
statementrequiredobjectThe enrollment’s public terms, committed in the proof’s digest.
statement.personNullifierrequiredhex32The person nullifier N, 32 bytes hex.
statement.leafrequiredhex32The leaf, 32 bytes hex.
statement.issuerIdrequiredstringThe issuer’s ID from the credential.
statement.expiresAtrequiredISO timeThe credential’s valid-until time.
registrationobjectWhen the wallet isn’t in the Rings user registry yet, its Rings keys; the transaction then registers it beside enroll.
registration.nullifierPublicKeyhex32The wallet’s Rings nullifier public key, 32 bytes hex.
registration.viewingPublicKeystringThe wallet’s Rings viewing public key, 33 bytes hex.

Returns a Build.

buildRevoke

POST /v1/revoke/build · api.buildRevoke

Builds the revoke transaction, with the current path to the person’s leaf, and simulates it.

Request

NameTypeDescription
walletrequiredaddressThe wallet, base58.
personNullifierrequiredhex32The person nullifier N, 32 bytes hex.

Returns a Build.

tree

GET /v1/tree · api.tree

The person tree’s depth, size and current root, and its recent roots in pages.

Parameters

NameTypeDescription
cursorstring (query)Where to start, from the previous page’s nextCursor.
limitinteger (query)Entries per page.

Response

NameTypeDescription
depthrequiredintegerThe tree’s depth.
sizerequiredintegerHow many leaves the tree has.
currentRootrequiredhex32The tree’s current root.
rootsrequiredobjectRecent roots, newest first, in pages.
roots.itemsrequiredobject[]This page’s entries.
roots.items[].rootrequiredhex32A person-tree root, 32 bytes hex.
roots.items[].slotrequiredintegerThe slot it landed in.
roots.pagerequiredPageWhere the next page starts.
roots.asOfrequiredISO timeWhen the page was read.

leaves

GET /v1/tree/leaves · api.leaves

The person tree’s leaves in index order, in pages, each page with the root it was read at. Revoked leaves are zero.

Parameters

NameTypeDescription
frominteger (query)The first leaf index to return.
limitinteger (query)Entries per page.

Response

NameTypeDescription
itemsrequiredobject[]This page’s entries.
items[].indexrequiredintegerThe leaf’s index.
items[].valuerequiredhex32The leaf, or zero where revoked.
items[].insertedSlotrequiredintegerThe slot the leaf was written in.
pagerequiredPageWhere the next page starts.
asOfrequiredISO timeWhen the page was read.
sizerequiredintegerHow many leaves the tree has.
rootrequiredhex32A person-tree root, 32 bytes hex.

Scopes and claims

listScopes

GET /v1/scopes · api.listScopes

Scopes in pages, filtered by status and kind.

Parameters

NameTypeDescription
cursorstring (query)Where to start, from the previous page’s nextCursor.
limitinteger (query)Entries per page.
status"open" | "upcoming" | "closed" (query)Only scopes in this window: upcoming, open or closed.
kind"drop" | "poll" (query)Only scopes of this kind.

Response

NameTypeDescription
itemsrequiredobject[]This page’s entries.
items[].idrequiredu64 stringThe scope ID.
items[].kindrequired"drop" | "poll"Drop or poll.
items[].titlerequiredstringThe scope’s title.
items[].creatorrequiredaddressThe wallet that opened the scope.
items[].assetrequired"SOL" | "USDC" | nullThe asset a drop pays in; null for a poll.
items[].amountPerPersonrequiredu64 string | nullWhat each claim takes from a drop, relay fee included, in base units.
items[].caprequiredintegerThe most claims the scope accepts.
items[].claimedrequiredintegerHow many have claimed.
items[].opensAtrequiredISO timeWhen claims open.
items[].closesAtrequiredISO timeWhen claims close.
items[].statusrequired"open" | "upcoming" | "closed"upcoming, open or closed.
pagerequiredPageWhere the next page starts.
asOfrequiredISO timeWhen the page was read.

getScope

GET /v1/scopes/{id} · api.getScope

One scope: its terms, how many claimed, what is left in its pool or relay budget, and a poll’s tally.

Parameters

NameTypeDescription
idrequiredu64 string (path)The scope ID.

Response

NameTypeDescription
idrequiredu64 stringThe scope ID.
kindrequired"drop" | "poll"Drop or poll.
titlerequiredstringThe scope’s title.
creatorrequiredaddressThe wallet that opened the scope.
assetrequired"SOL" | "USDC" | nullThe asset a drop pays in; null for a poll.
amountPerPersonrequiredu64 string | nullWhat each claim takes from a drop, relay fee included, in base units.
caprequiredintegerThe most claims the scope accepts.
claimedrequiredintegerHow many have claimed.
opensAtrequiredISO timeWhen claims open.
closesAtrequiredISO timeWhen claims close.
statusrequired"open" | "upcoming" | "closed"upcoming, open or closed.
optionsrequiredobject[]A poll’s options.
options[].indexrequiredintegerThe option’s index, from zero.
options[].labelrequiredstringThe option’s label.
options[].tallyrequiredintegerVotes for the option.
poolRemainingrequiredu64 string | nullWhat is left in a drop’s pool, base units.
relayFeerequiredu64 stringThe relay fee per claim, base units.
relayBudgetLeftrequiredu64 string | nullWhat is left of a poll’s relay budget, lamports.
createdSignaturerequiredsignatureThe transaction that opened the scope.
settledrequiredbooleanWhether the scope has been closed and settled.

listClaims

GET /v1/scopes/{id}/claims · api.listClaims

One scope’s public ledger in pages: each scope nullifier with its time and transaction.

Parameters

NameTypeDescription
idrequiredu64 string (path)The scope ID.
cursorstring (query)Where to start, from the previous page’s nextCursor.
limitinteger (query)Entries per page.

Response

NameTypeDescription
itemsrequiredobject[]This page’s entries.
items[].nullifierrequiredhex32The scope nullifier n, 32 bytes hex.
items[].timerequiredISO timeWhen the claim landed.
items[].signaturerequiredsignatureThe transaction signature.
items[].optionIndexrequiredinteger | nullThe option voted for; null for a drop.
pagerequiredPageWhere the next page starts.
asOfrequiredISO timeWhen the page was read.

reviewScope

POST /v1/scopes/review · api.reviewScope

Quotes a scope before anything is signed: what the creator funds, the protocol fee, the relay fee and what each person receives.

Request

NameTypeDescription
walletrequiredaddressThe creator, who signs and funds.
titlerequiredstringThe scope’s title.
caprequiredintegerThe most claims the scope accepts.
opensAtrequiredISO timeWhen claims open.
closesAtrequiredISO timeWhen claims close.
kindrequired"drop" | "poll"Drop or poll; decides which fields follow.
asset"SOL" | "USDC"For a drop, SOL or USDC.
amountPerPersonstringFor a drop, what each claim takes, relay fee included, in base units.
optionsstring[]For a poll, 2 to 8 labels of up to 32 bytes.

Response

NameTypeDescription
kindrequired"drop" | "poll"Drop or poll.
assetrequired"SOL" | "USDC"The asset; SOL for a poll.
totalToFundrequiredu64 stringEverything the creator pays: the pool and the protocol fee, or the relay budget.
poolFundingrequiredu64 stringWhat goes into the pool: amount per person times cap.
protocolFeerequiredu64 stringThe protocol fee.
relayFeerequiredu64 stringThe relay fee per claim or vote, base units.
netPerPersonrequiredu64 string | nullWhat each claimant receives after the relay fee; null for a poll.
relayBudgetrequiredu64 stringA poll’s relay budget: relay fee times cap.

buildScope

POST /v1/scopes/build · api.buildScope

Builds the transactions that open a scope, for the creator to sign, and simulates them.

Request

NameTypeDescription
walletrequiredaddressThe creator, who signs and funds.
titlerequiredstringThe scope’s title.
caprequiredintegerThe most claims the scope accepts.
opensAtrequiredISO timeWhen claims open.
closesAtrequiredISO timeWhen claims close.
kindrequired"drop" | "poll"Drop or poll; decides which fields follow.
asset"SOL" | "USDC"For a drop, SOL or USDC.
amountPerPersonstringFor a drop, what each claim takes, relay fee included, in base units.
optionsstring[]For a poll, 2 to 8 labels of up to 32 bytes.

Response

NameTypeDescription
scopeIdrequiredu64 stringThe scope ID.
transactionsrequiredBuild[]The transactions to sign, in order.

buildCloseScope

POST /v1/scopes/{id}/close/build · api.buildCloseScope

Builds the close for any wallet after the window, with what goes back to the creator: a transaction to sign for a poll or an empty drop, or a relay job for a drop with funds left, since spending the pool back is a Rings transaction.

Parameters

NameTypeDescription
idrequiredu64 string (path)The scope ID.

Request

NameTypeDescription
walletrequiredaddressThe wallet that signs and pays for the close; any wallet.

Response

NameTypeDescription
scopeIdrequiredu64 stringThe scope ID.
creatorrequiredaddressWho receives what is left.
assetrequired"SOL" | "USDC"The asset returned.
returnAmountrequiredu64 stringWhat goes back to the creator.
transactionBuildFor a poll or an empty drop, the transaction to sign.
jobIdstringFor a drop with funds left, the relay job that spends the pool back to the creator; follow it with getJob.

relayClaim

POST /v1/claims/relay · api.relayClaim

Queues a proven claim. The relayer builds the transaction, pays for it and sends it; follow it with getJob.

Request

NameTypeDescription
scopeIdrequiredu64 stringThe scope ID.
rootrequiredhex32The root the proof was made against.
nullifierrequiredhex32The scope nullifier n.
proofrequiredProofThe Groth16 proof as snarkjs writes it.
publicSignalsrequired(field string)[]The proof’s public signals as decimal strings.
kindrequired"drop" | "poll"Drop or poll; decides which fields follow.
bindingfield stringFor a drop, the owner hash of the payout note, as a decimal field element.
recipientOutputobjectFor a drop, the payout note the claim creates.
recipientOutput.ownerShieldedAddressbase64The claimant’s fresh holder address, the 99-byte shielded address in base64.
recipientOutput.blindinghex32The output’s blinding.
recipientOutput.ownerHashhex32The payout note’s owner hash, the same value as binding, hex.
recipientOutput.amountstringThe payout amount, base units.
optionIndexintegerFor a poll, the option voted for.

Response

NameTypeDescription
jobIdrequiredstringThe relay job to follow.

Relays and transactions

getJob

GET /v1/jobs/{id} · api.getJob

The state of a relayed claim or withdrawal.

Parameters

NameTypeDescription
idrequiredstring (path)The job ID from the relay receipt.

Response

NameTypeDescription
jobIdrequiredstringThe relay job to follow.
kindrequired"claim" | "withdraw" | "close_scope"A claim, a withdrawal or a drop’s close.
statusrequired"queued" | "proving_payout" | "building" | "proving" | "submitted" | "confirmed" | "failed"Where the relay is: queued, proving_payout, building, proving, submitted, then confirmed or failed.
signaturesignatureThe relayed transaction, once submitted.
slotintegerThe slot it landed in.
payoutAmountu64 stringWhat the claimant received, base units, once confirmed.
codestringThe error code, when the job failed.
retryablebooleanWhether trying again can help.

relayWithdrawal

POST /v1/withdrawals/relay · api.relayWithdrawal

Queues a proven withdrawal from a private balance; follow it with getJob.

Request

NameTypeDescription
destinationrequiredaddressThe public address the withdrawal pays.
inputNullifiersrequiredhex32[]The nullifiers of the notes the withdrawal spends.
withdrawalBase64requiredbase64The proven Rings withdrawal, serialized.

Response

NameTypeDescription
jobIdrequiredstringThe relay job to follow.

followTransaction

GET /v1/transactions/{signature} · api.followTransaction

The status of a transaction a wallet sent, by signature.

Parameters

NameTypeDescription
signaturerequiredsignature (path)The transaction signature.

Response

NameTypeDescription
signaturerequiredsignatureThe transaction signature.
statusrequired"submitted" | "confirmed" | "failed" | "expired"submitted, confirmed, failed or expired.
slotintegerThe slot it landed in.
stagestringThe stage the transaction reached or failed at.
programErrorobjectThe program error that refused the transaction.
programError.programIdaddressThe program that refused the transaction.
programError.namestringThe error’s name.
programError.numberintegerThe error’s code.

Rings

These routes pass the Rings client's own calls through the API, so a browser reaches the indexer and the prover from one origin. Their request and response shapes are the ones @heliuslabs/spr sends and reads.

ringsRpc

POST /v1/rings/rpc · api.ringsRpc

Solana JSON-RPC for the Rings client, passed through to the cluster.

ringsIndexer

POST /v1/rings/indexer/{method} · api.ringsIndexer

The Rings indexer’s read methods, passed through, for the device to scan payout traffic.

Parameters

NameTypeDescription
methodrequired"getEncryptedUtxosByTags" | "getShieldedTransactionsByTags" | "getShieldedTransactionsByNullifiers" | "getShieldedTransactionsBySignature" | "getUserRecords" (path)

ringsProverHealth

GET /v1/rings/prover/health · api.ringsProverHealth

Whether the Rings prover is up, and its circuits.

ringsProof

POST /v1/rings/prover/prove/{key} · api.ringsProof

Proves a prepared Rings transaction, such as a withdrawal, through the Rings prover.

Parameters

NameTypeDescription
keyrequiredstring (path)

ringsIndexedProof

POST /v1/rings/prover/prove/{key}/indexed · api.ringsIndexedProof

Proves a prepared Rings transaction with the indexer resolving its roots.

Parameters

NameTypeDescription
keyrequiredstring (path)

Shapes

Proof

A Groth16 proof as snarkjs writes it, coordinates as decimal strings. Circuits has the byte form the program takes.

NameTypeDescription
protocolrequired"groth16"groth16.
curverequired"bn128"bn128.
pi_arequired[field string, field string, "1"]The A point.
pi_brequired[[field string, field string], [field string, field string], ["1", "0"]]The B point.
pi_crequired[field string, field string, "1"]The C point.

Build

An unsigned transaction the API built and simulated. The wallet signs it as it is and sends it, then follows it with followTransaction.

NameTypeDescription
transactionBase64requiredbase64The unsigned transaction, base64.
blockhashrequiredaddressThe blockhash it was built on.
lastValidBlockHeightrequiredintegerThe last block height it can land at.
fixtureSignaturesignatureOn the fixture server, the signature to follow in place of a real one.
versionrequired"v0" | "v1"The transaction format: v0, or v1 for Rings transactions.
instructionsrequiredstring[]The instructions it carries, by name.
simulationrequiredobjectThe simulation the API ran before returning it.
simulation.okrequiredbooleanWhether it simulated cleanly.
simulation.unitsConsumedrequiredintegerCompute units it used.
simulation.programErrorobjectThe program error, when it failed.
simulation.programError.programIdaddressThe program that refused it.
simulation.programError.namestringThe error’s name.
simulation.programError.numberintegerThe error’s code.

Page

NameTypeDescription
nextCursorrequiredstring | nullThe cursor for the next page; null on the last.
hasMorerequiredbooleanWhether another page follows.

Errors

Every failure answers with one envelope:

json
{
  "error": {
    "code": "ALREADY_CLAIMED",
    "message": "This person already claimed this scope.",
    "retryable": false,
    "stage": "confirmation"
  }
}

code is stable and is what a client branches on; message is a sentence to show. retryable says whether the same request can succeed later, and stage names where it failed: validation, auth, read, upload, build, wallet, co_sign, simulation, send or confirmation. Depending on the code, the envelope also carries fieldErrors, programError, need and have in base units, retryAfterSeconds, and a requestId.

CodeHTTPWhen
VALIDATION_ERROR400The request doesn’t match its schema; fieldErrors names each field.
UNAUTHORIZED401The request lacks a credential the route requires.
ORIGIN_NOT_ALLOWED403The browser origin isn’t in the API’s allowed origins.
NOT_FOUND404No such scope, job, transaction or route.
PROGRAM_UNAVAILABLE409The program or its registry can’t be read yet, or a node’s share doesn’t match the registry.
CONFIGURATION_REQUIRED409The service is missing a setting it needs for this route.
IDEMPOTENCY_CONFLICT409The same request key was used for a different request.
TRANSACTION_EXPIRED409The transaction’s blockhash expired before it landed; build it again.
PAYLOAD_TOO_LARGE413The body is over the size limit.
UNSUPPORTED_MEDIA_TYPE415The body isn’t JSON.
SIMULATION_FAILED422The built transaction failed simulation; programError names the program error.
CHAIN_REFUSED422The transaction landed and failed; programError names the program error.
RATE_LIMITED429Too many requests; retryAfterSeconds says when to try again.
INTERNAL_ERROR500The service failed; requestId identifies the request.
UPSTREAM_UNAVAILABLE502The RPC, the indexer, the prover or a node didn’t answer.
ISSUER_REFUSED422The demo issuer refused the form; fieldErrors names the fields.
SIGNATURE_INVALID401The holder signature doesn’t verify, or the request names another node.
STALE_TIMESTAMP401The request was signed more than a minute from the node’s clock.
ISSUER_UNKNOWN422The issuer isn’t active in the registry.
PROOF_INVALID422A proof doesn’t verify, or its statement differs from the request.
ALREADY_ENROLLED409The person nullifier has an active enrollment.
REVOKE_COOLDOWN409This person revoked less than 24 hours ago; enrolling again opens after that.
NOT_ENROLLED409The person account isn’t active, so there is nothing to revoke.
TREE_FULL409The person tree has no room for another leaf.
STALE_OPRF_KEY409The enrollment was made against an old OPRF registry version; ask the nodes again.
CREDENTIAL_EXPIRED422The credential’s valid-until time has passed.
ALREADY_CLAIMED409The scope nullifier has claimed in this scope.
SCOPE_FULL409The scope reached its cap.
SCOPE_NOT_OPEN409The scope hasn’t opened.
SCOPE_CLOSED409The scope has closed.
SCOPE_STILL_OPEN409The scope’s window hasn’t ended, so it can’t be closed yet.
ROOT_UNKNOWN409The root is no longer in the history; prove again against a fresh leaf download.
CREDENTIAL_EXPIRES_BEFORE_CLOSE422The credential expires before the scope closes.
WRONG_BINDING422The payout or the option doesn’t match what the proof is bound to.
BAD_POOL_NOTE409The Rings transaction doesn’t match the scope’s pool note; build the claim again.
INSUFFICIENT_RELAY_BUDGET409The poll’s relay budget can’t pay for another vote.
RELAY_BUSY503The relayer can’t take the job now; nothing was sent.
INSUFFICIENT_BALANCE422The wallet can’t fund the scope; need and have give base units.
INVALID_TERMS422The scope’s terms break a rule; fieldErrors names the fields.

The fixture server answers every route with sample data and no chain. Send X-Fixture with a scenario name, or with an error code to receive that error, and X-Fixture-Session with one id per flow.