Endpoints and JSON types¶
Use the endpoint index to look up a request, its response and possible errors. The type definitions below describe the JSON exchanged by the public testnet API. API overview · OpenAPI 3.1 file
Request a quote¶
Start with a forward quote to see the price of exchanging TAZ for tUSD. Its amount is a decimal string in token base units. Its depositZat is an integer in zatoshis. Request, field types and example response
Read a swap response¶
Use the reverse status endpoint to follow an accepted return swap. The maker always includes depositTxid. Its value is null until the maker records the Zcash deposit. Status fields, success and error responses
Error responses¶
Service errors include a machine-readable code and a human-readable error. Use code to decide what the client should do. For example, a lookup for an unknown reverse swap returns the following body.
{
"code": "unknownSwap",
"error": "swap is unknown"
}
| HTTP | Meaning and next step |
|---|---|
| 400, 413, 415, 422 | Check the reason, body size, content type and field encodings. A malformed body or path uses invalidRequest. A valid request that fails a swap check can return rejected. |
| 402 | feeRequired on forward acceptance. If the open fee was already sent, wait for it to be mined and retry the same acceptance after Retry-After. |
| 404, 405 | Check the HTTP method, path and ID. An expired quote can return unknownQuote. |
| 409 | A private transfer or deposit conflicts with a previous transaction. Inspect the returned transactions hashes before retrying. Conflict response |
| 500, 503 | Check whether the previous operation landed. For an unavailable or busy service, respect Retry-After when present and resume with the saved swap. |
Discovery¶
| Endpoint | Reference |
|---|---|
GET /maker/healthz |
Maker health |
GET /maker/v1/info |
Maker info |
GET /relayer/v1/terms |
Relayer terms |
Forward swaps¶
| Endpoint | Reference |
|---|---|
POST /maker/v1/quote |
Request a forward quote |
POST /maker/v1/quote/{quoteId}/accept |
Accept a forward quote |
POST /relayer/v1/claim |
Submit a claim |
POST /relayer/v1/claim/hold |
Delegate a claim |
POST /relayer/v1/payout |
Submit a payout |
POST /relayer/v1/rescue |
Recover a forward payout |
Reverse swaps¶
| Endpoint | Reference |
|---|---|
POST /maker/v1/reverse/quote |
Request a reverse quote |
POST /maker/v1/reverse/quote/{quoteId}/accept |
Accept a reverse quote |
GET /maker/v1/reverse/swaps/{swapId} |
Get swap status |
POST /relayer/v1/reverse/fund |
Fund reverse escrow |
POST /relayer/v1/reverse/ready |
Mark escrow ready |
POST /relayer/v1/reverse/refund |
Request a reverse refund |
POST /relayer/v1/reverse/refund-payout |
Shield a refund |
POST /relayer/v1/reverse/rescue |
Recover a reverse refund |
Deposits and transfers¶
| Endpoint | Reference |
|---|---|
POST /relayer/v1/railgun/transact |
Relay a private transfer |
POST /relayer/v1/deposits/shield |
Shield a deposit |
POST /relayer/v1/deposits/rescue |
Recover a deposit |
JSON types¶
EthereumAddress¶
20-byte Ethereum address in hexadecimal.
Encoded as string.
Hex32¶
32-byte value in hexadecimal.
Encoded as string.
Hex64¶
64-byte value in hexadecimal.
Encoded as string.
EthereumSignature¶
65-byte Ethereum signature in hexadecimal.
Encoded as string.
HexData¶
Hexadecimal bytes with a 0x prefix.
Encoded as string.
Uint32¶
JSON integer from 0 to 4294967295.
Uint64¶
JSON integer from 0 to 18446744073709551615.
UnixSeconds¶
Unix timestamp in seconds.
Encoded as integer · Uint64.
DecimalUint128¶
Unsigned integer in decimal text, at most 340282366920938463463374607431768211455. Services emit digits without leading zeroes.
Encoded as string.
ZcashNetwork¶
Allowed values are testnet, mainnet.
ErrorCode¶
Allowed values are invalidRequest, rejected, unknownQuote, unknownSwap, unavailable, watchtowerUnavailable, internal, notFound, methodNotAllowed, tokenRequired, feeRequired, alreadySpent, conflict.
ErrorResponse¶
Structured service error.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
code |
string · ErrorCode |
Required | Machine-readable service error code. |
error |
string |
Required | Human-readable detail. |
MakerInfo¶
Deployment and capabilities served by this maker.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
apiVersion |
integer · Uint32 |
Required | API version number. |
maker |
string · EthereumAddress |
Required | Maker's Ethereum address. |
chainId |
integer · Uint64 |
Required | EIP-155 chain ID of the settlement network. |
contract |
string · EthereumAddress |
Required | Ethereum address of the settlement contract. |
contractKind |
string |
Optional | Contract family reported by the deployment. The window-based client expects windows. |
minWindow |
integer · Uint64 |
Optional | Minimum interval required by the contract between opening and t0, and between t0 and t1, in seconds. |
lateWindow |
integer · Uint64 |
Optional | Length of the forward maker's refund window after t1, in seconds. |
token |
string · EthereumAddress |
Required | Ethereum address of the escrow token. |
zcashNetwork |
string · ZcashNetwork |
Required | Network of the Zcash leg. |
reverseEnabled |
boolean |
Required | Whether this maker accepts reverse quotes. |
ForwardQuoteRequest¶
Request a maker quote for Zcash to the escrow token.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
units |
integer · Uint32 |
Required | Number of the maker's token denominations to receive. The maker publishes a deployment-specific cap. |
payout |
string · EthereumAddress |
Required | Nonzero Ethereum account that authorizes the payout. For the account route, use the receiving signer. |
payoutNote |
string · Hex32 or null |
Optional | Hash committing to the shield note for a RAILGUN payout. Omit for an account payout. |
ForwardQuote¶
Maker quote fields shared by both directions. Amounts refer to the escrow token and the joint Zcash deposit.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
quoteId |
string · Hex32 |
Required | Identifier used in the acceptance URL. |
maker |
string · EthereumAddress |
Required | Maker's Ethereum address. |
makerShare |
string · Hex64 |
Required | Maker's public Pallas share, encoded as two 32-byte affine coordinates. |
makerProof |
string · Hex64 |
Required | Proof that the maker knows its share. |
chainId |
integer · Uint64 |
Required | EIP-155 chain ID of the settlement network. |
contract |
string · EthereumAddress |
Required | Ethereum address of the settlement contract. |
token |
string · EthereumAddress |
Required | Ethereum address of the escrow token. |
amount |
string · DecimalUint128 |
Required | Gross escrow value in token base units. |
depositZat |
integer · Uint64 |
Required | Zcash amount payable to the joint account, in zatoshis (100,000,000 per coin). |
expiresAt |
integer · UnixSeconds |
Required | Quote expiry in Unix seconds. |
networkCost |
string · DecimalUint128 |
Optional | Maker's estimated network cost already included in the quote, in token base units. |
openFee |
object · OpenFee |
Optional | A forward maker may require this separate Zcash payment before acceptance. |
OpenFee¶
One-time, nonrefundable Zcash opening fee for this quote.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
zat |
integer · Uint64 |
Required | Fee in zatoshis. |
address |
string |
Required | Quote-specific unified address on the maker's Zcash network with an Orchard-only receiver. |
ForwardAcceptance¶
Client-generated material used to open either direction. The maker uses the viewing material to recognize the joint Zcash deposit.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
userShare |
string · Hex64 |
Required | User's public Pallas share, encoded as two 32-byte affine coordinates. |
userProof |
string · Hex64 |
Required | Proof of knowledge of the user's swap share. |
viewingKeys |
string · Hex64 |
Required | 64-byte Zcash viewing material for this joint account only. |
ForwardAccepted¶
Acceptance receipt. Persist the swap ID, deadlines and ticket before funding.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
t0 |
integer · UnixSeconds |
Required | End of the initial ready window, in Unix seconds. |
t1 |
integer · UnixSeconds |
Required | Start of the refund window for a ready swap, in Unix seconds. |
lateWindow |
integer · Uint64 |
Optional | Length of the forward maker's refund window after t1, in seconds. |
ticket |
string |
Required | Opaque credential for this swap. Supply it in the ZecSwap-Ticket header on protected relay routes. |
ForwardTerms¶
Exact escrow terms read back from the contract. The token and Zcash roles switch when the direction reverses.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
maker |
string · EthereumAddress |
Required | Address on the token side. In reverse, this is the user's authorization address. |
token |
string · EthereumAddress |
Required | Ethereum address of the escrow token. |
amount |
string · DecimalUint128 |
Required | Escrowed amount in token base units. |
makerKey |
string · Hex64 |
Required | Public Pallas share for the token side. |
userKey |
string · Hex64 |
Required | Public Pallas share for the Zcash side. |
user |
string · EthereumAddress |
Required | Address on the Zcash side. In reverse, this is the maker's address. |
t0 |
integer · UnixSeconds |
Required | Ready deadline in Unix seconds. |
t1 |
integer · UnixSeconds |
Required | Refund boundary in Unix seconds. |
payoutNote |
string · Hex32 |
Required | Committed forward shield-note hash. Zero for a forward account payout or reverse escrow. |
ReverseQuoteRequest¶
Request a quote to send escrow tokens from RAILGUN and receive Zcash.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
units |
integer · Uint32 |
Required | Number of the maker's token denominations to escrow. |
user |
string · EthereumAddress |
Required | Fresh Ethereum authorization address for this swap. |
refundNote |
string · Hex32 |
Required | Hash committing to the RAILGUN note that will receive any token refund. |
ReverseQuote¶
Business terms for the reverse swap and the deadlines imposed by the escrow.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
terms |
object · ForwardQuote |
Required | Maker quote fields. Here amount is the token input and depositZat is the maker's gross Zcash deposit. |
user |
string · EthereumAddress |
Required | User's swap authorization address. |
refundNote |
string · Hex32 |
Required | Shield-note commitment from the request. |
fundingDeadline |
integer · UnixSeconds |
Required | Last time allowed by the signed opening authorization, in Unix seconds. |
readyDeadline |
integer · UnixSeconds |
Required | The ready authorization must land before this time (t0). |
refundAfter |
integer · UnixSeconds |
Required | From this time (t1), the user may refund a ready reverse escrow. |
ReverseAuthorization¶
Signed authorization to mark a reverse escrow ready after the client verifies the joint Zcash deposit.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
terms |
object · ForwardTerms |
Required | Escrow terms the relayer checks against the on-chain hash. |
deadline |
integer · UnixSeconds |
Required | Expiry of the signed authorization, in Unix seconds. |
signature |
string · EthereumSignature |
Required | 65-byte Ethereum authorization signature in r, s, v order. |
ReverseFunding¶
Proved RAILGUN call that funds the quoted reverse escrow.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
chainId |
integer · Uint64 |
Required | EIP-155 chain ID of the settlement network. |
to |
string · EthereumAddress |
Required | Pinned V2 Relay Adapt contract. |
data |
string · HexData |
Required | Complete calldata of the locally proved Relay Adapt transaction. |
value |
string · DecimalUint128 |
Required | Native ETH value in wei. The sponsored funding route requires zero. |
ReverseRefund¶
Refund authorization for an eligible reverse escrow and the signed shielding payout.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
terms |
object · ForwardTerms |
Required | Escrow terms the relayer checks against the on-chain hash. |
secret |
string · Hex32 |
Required | User's 32-byte swap share. Supply only after the client verifies that refund is safe. |
payout |
object · RelayerPayout |
Required | Signed payout for the note committed at funding. |
ReversePhase¶
Allowed values are awaitingFunding, confirmingFunding, sendingZec, awaitingReady, claiming, zecAvailable, refundAvailable, refunding, refunded, expired.
ReverseStatus¶
Maker's reported progress. Verify the escrow and spendable Zcash independently before authorizing settlement.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
phase |
string · ReversePhase |
Required | Latest progress recorded by the maker. |
depositTxid |
string or null |
Required | Hex Zcash transaction ID with no 0x prefix, or null until the maker records a deposit. |
readyDeadline |
integer · UnixSeconds |
Required | Ready deadline (t0) in Unix seconds. |
refundAfter |
integer · UnixSeconds |
Required | Ready escrow refund boundary (t1) in Unix seconds. |
RelayerTerms¶
Current swap payout fee and optional services offered by the relayer.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
relayer |
string · EthereumAddress |
Required | Ethereum address of the swap relayer. |
chainId |
integer · Uint64 |
Required | EIP-155 chain ID of the settlement network. |
contract |
string · EthereumAddress |
Required | Ethereum address of the settlement contract. |
contractKind |
string |
Optional | Contract family reported by the deployment. The window-based client expects windows. |
minWindow |
integer · Uint64 |
Optional | Minimum interval required by the contract between opening and t0, and between t0 and t1, in seconds. |
lateWindow |
integer · Uint64 |
Optional | Length of the forward maker's refund window after t1, in seconds. |
fee |
string · DecimalUint128 |
Required | Swap payout fee in escrow-token base units. |
feeExpiresAt |
integer · UnixSeconds |
Optional | Last time the relayer honors the advertised fee or rate, in Unix seconds. |
reverseFunding |
object · ReverseFundingTerms |
Optional | Present when this relayer sponsors initial reverse funding. |
railgunSends |
object · RailgunSendTerms |
Optional | Present when this relayer broadcasts RAILGUN transfers and withdrawals. |
deposits |
object · DepositTerms |
Optional | Present when this relayer shields tokens received at public deposit addresses. |
DepositTerms¶
Fee schedule and authorization limits for public-token deposits.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
contract |
string · EthereumAddress |
Required | Deposits contract the authorization must pay. |
relayer |
string · EthereumAddress |
Required | Ethereum account bound to the deposit fee authorization. |
token |
string · EthereumAddress |
Required | Ethereum address of the escrow token. |
fee |
string · DecimalUint128 |
Required | Base portion in token units. The total is fee plus ceil(value × feeBps / 10000). A rescue pays the base fee alone. |
feeBps |
integer · Uint32 |
Required | Variable portion of the deposit fee, in basis points. |
feeExpiresAt |
integer · UnixSeconds |
Optional | Last time the relayer honors the advertised fee or rate, in Unix seconds. |
minValue |
string · DecimalUint128 |
Required | Minimum deposit in token base units. |
maxValidity |
integer · Uint64 |
Required | Maximum number of seconds from now to validBefore. |
maxGasPriceWei |
string · DecimalUint128 |
Required | Maximum accepted gas price in wei per unit of gas. |
RailgunSendTerms¶
Relayer fee and transaction limits for private sends and withdrawals.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
railgunAddress |
string |
Required | Relayer's 0zk address for the broadcaster fee note. |
railgunProxy |
string · EthereumAddress |
Required | Pinned RAILGUN proxy the transaction calls. |
token |
string · EthereumAddress |
Required | Token used to pay the fee. |
fee |
string · DecimalUint128 |
Required | Minimum broadcaster fee in token base units. |
feePerUnitGas |
string · DecimalUint128 |
Optional | Rate in token base units per 10^18 wei of gas cost, including the relayer's margin. |
feeExpiresAt |
integer · UnixSeconds |
Optional | Last time the relayer honors the advertised fee or rate, in Unix seconds. |
maxGasLimit |
integer · Uint64 |
Required | Maximum gas units the relayer will submit for one transaction. |
maxGasPriceWei |
string · DecimalUint128 |
Required | Maximum accepted gas price in wei per unit of gas. |
maxCalldataBytes |
integer |
Required | Maximum accepted calldata size in bytes. |
ReverseFundingTerms¶
Sponsorship terms for RAILGUN funding of a reverse swap.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
relayAdapt |
string · EthereumAddress |
Required | V2 Relay Adapt contract used for funding. |
token |
string · EthereumAddress |
Required | Ethereum address of the escrow token. |
maker |
string · EthereumAddress |
Required | Maker whose escrow can be funded. |
maxGasLimit |
integer · Uint64 |
Required | Maximum gas units the relayer will submit for one transaction. |
maxGasPriceWei |
string · DecimalUint128 |
Required | Maximum accepted gas price in wei per unit of gas. |
maxCalldataBytes |
integer |
Required | Maximum accepted calldata size in bytes. |
fee |
string · DecimalUint128 |
Required | Fee the funding transaction pays the relayer in escrow-token base units. |
RelayerClaim¶
Forward claim and signed payout assembled by the wallet.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
terms |
object · ForwardTerms |
Required | Escrow terms the relayer checks against the on-chain hash. |
secret |
string · Hex32 |
Required | User's 32-byte swap share. Supply only when the reference client's checks allow its release. |
payout |
object · RelayerPayout |
Required | Signed payout bound to this swap. |
RelayerHeld¶
Result of accepting an authorized claim to broadcast later.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
held |
boolean |
Required | True when the relayer has retained the claim. |
RelayerPayout¶
Authorization to shield a settled payout, less the signed fee.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
terms |
object · ForwardTerms |
Required | Escrow terms the relayer checks against the on-chain hash. |
note |
object · RelayerNote |
Required | Shield note that must match the escrow's commitment. |
fee |
string · DecimalUint128 |
Required | Authorized fee in escrow-token base units. |
signature |
string · EthereumSignature |
Required | 65-byte Ethereum authorization signature in r, s, v order. |
RelayerRescue¶
Signed instruction to shield tokens RAILGUN returned to this swap's vault.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
swapId |
string · Hex32 |
Required | 32-byte escrow identifier. |
terms |
object · ForwardTerms |
Required | Escrow terms the relayer checks against the on-chain hash. |
note |
object · RelayerNote |
Required | RAILGUN shield destination and ciphertext. |
fee |
string · DecimalUint128 |
Required | Authorized relayer fee in escrow-token base units. |
nonce |
integer · Uint64 |
Required | Current rescue nonce for this swap. |
deadline |
integer · UnixSeconds |
Required | Expiry of the signed authorization, in Unix seconds. |
signature |
string · EthereumSignature |
Required | 65-byte Ethereum authorization signature in r, s, v order. |
RelayerNote¶
RAILGUN shield note and its ciphertext.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
npk |
string · Hex32 |
Required | 32-byte note public key. |
encryptedBundle |
array of string · Hex32 (exactly 3) |
Required | Three ordered 32-byte ciphertext words. |
shieldKey |
string · Hex32 |
Required | 32-byte shield encryption public key. |
RailgunTransact¶
Locally proved RAILGUN transfer or withdrawal submitted for broadcast.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
chainId |
integer · Uint64 |
Required | EIP-155 chain ID of the settlement network. |
to |
string · EthereumAddress |
Required | Pinned RAILGUN proxy. |
data |
string · HexData |
Required | Calldata for a plain RAILGUN transact call. |
value |
string · DecimalUint128 |
Required | Native ETH value in wei. The relayed transfer route requires zero. |
RelayerConflict¶
Conflict details, including any related transaction hashes the relayer knows.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
code |
string · ErrorCode |
Required | Machine-readable cause, such as alreadySpent or conflict. |
error |
string |
Required | Human-readable detail. |
transactions |
array of string · Hex32 |
Required | Known Ethereum transaction hashes. Can be empty. |
ShieldDeposit¶
Signed EIP-3009 token transfer from a public deposit address into its shield vault.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
chainId |
integer · Uint64 |
Required | EIP-155 chain ID of the settlement network. |
contract |
string · EthereumAddress |
Required | Pinned Deposits contract. |
from |
string · EthereumAddress |
Required | Public deposit address that signed the authorization. |
value |
string · DecimalUint128 |
Required | Token amount to shield before fees, in base units. |
validAfter |
integer · UnixSeconds |
Required | Lower time bound of the token authorization, in Unix seconds. |
validBefore |
integer · UnixSeconds |
Required | Authorization expiry in Unix seconds. |
note |
object · RelayerNote |
Required | RAILGUN shield destination and ciphertext. |
fee |
string · DecimalUint128 |
Required | Authorized relayer fee in token base units. |
signature |
string · EthereumSignature |
Required | EIP-3009 ReceiveWithAuthorization signature from the deposit address. |
RescueDeposit¶
Signed instruction to shield a returned deposit again from its vault.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
chainId |
integer · Uint64 |
Required | EIP-155 chain ID of the settlement network. |
contract |
string · EthereumAddress |
Required | Pinned Deposits contract. |
from |
string · EthereumAddress |
Required | Public deposit address that controls the rescue. |
note |
object · RelayerNote |
Required | RAILGUN shield destination and ciphertext. |
fee |
string · DecimalUint128 |
Required | Authorized relayer fee in token base units. |
nonce |
integer · Uint64 |
Required | Rescue nonce for the deposit address. |
deadline |
integer · UnixSeconds |
Required | Expiry of the signed authorization, in Unix seconds. |
signature |
string · EthereumSignature |
Required | 65-byte Ethereum authorization signature in r, s, v order. |
RelayerSent¶
Transaction submission result. Confirm settlement on chain.
| Field | JSON type | Presence | Meaning |
|---|---|---|---|
transactions |
array of string · Hex32 |
Required | Ethereum transaction hashes known to the relayer. Some idempotent operations can return an empty list. |