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)

{
    "jobId": "1"
}

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

{
    "state": "failed",
    "txHash": null
}

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)

[
    (Buffer|null)
]

Get Merkle tree proofs at the specified position

GET http://relayer/merkle/proof?[index]

{
    root, // Merkle tree root for this proofs
    deltaIndex, // this index should be used for building tx proof
    proofs // Merkle tree proofs
}

Get Merkle tree root node at the specified index

GET http://relayer/merkle/root/:index

Query Parameters

Name
Type
Description

index

Integer

"11469701942666298368112882412133877458305516134926649826543144744382391691533"

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

{
    proof // Transaction proof
}

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

{
    "root": "11469701942666298368112882412133877458305516134926649826543144744382391691533",
    "deltaIndex": 0
}

Last updated