REST API
To interact with the relayer
Send a transaction to the contract
POST
http://relayer/transaction
This method checks an incoming transaction, builds the zkSNARK Merkle tree proof, and sends the transaction to the Pool contract. The transaction doesn’t process immediately because contract interaction is completed in a serial manner. Incoming transactions are put into the job queue. The method returns jobId
on success
Request Body
Name | Type | Description |
---|---|---|
proof* | Dictionary | Transaction proof (built by a client) |
memo* | String | Memo block, Base64-encoded |
tx_type* | Integer | 0: deposit, 1: transfer, 2: withdrawal |
depositSignature | String | Account nullifier signature with the client's native chain private key (for withdrawal tx only) |
Get the job status
GET
http://relayer/job/:id
Returns incoming transaction processing state. jobId
is returned by /transaction method
Query Parameters
Name | Type | Description |
---|---|---|
id* | Integer | Job identifier |
Query transactions
GET
http://relayer/transactions/:limit/:offset
Returns memo blocks and out commits for transactions at the specified offset. This method is used by clients to synchronize account state.
Query Parameters
Name | Type | Description |
---|---|---|
limit* | Integer | Number of transactions to query |
offset* | Integer | The Index of the first transaction (in the Merkle tree, should be a multiple of 128) |
Get Merkle tree proofs at the specified position
GET
http://relayer/merkle/proof?[index]
Get Merkle tree root node at the specified index
GET
http://relayer/merkle/root/:index
Query Parameters
Name | Type | Description |
---|---|---|
index | Integer |
Calculate transaction proof
POST
http://relayer/proof_tx
Builds zkSNARK proof for the transaction based on public and secret transaction input calculated by a client.
WARNING: This is a debug method used to decrease client overhead. DO NOT use in production, as the client should pass public and secret transactional data. This significantly decreases overall security!
Request Body
Name | Type | Description |
---|---|---|
pub* | Dictionary | Public inputs for the circuit |
sec* | Dictionary | Secret inputs for the circuit |
Get the next index in the Merkle tree
GET
http://relayer/delta_index
0
Get current Merkle tree root and delta index
GET
http://relayer/info
Last updated