LogoLogo
zkBob AppLinks & Resources
  • 🦹zkBob Overview
    • zkBob
    • Basic Concepts
      • Getting Started
      • Open-Source and Decentralized
      • Multichain Deployment
      • Usage Statistics
      • Use Cases
        • Employee Salary
        • Vendor Purchasing
      • Development Timeline
      • zk Privacy Solution Comparison
    • zkBob Pools
      • USDC Pool on Polygon (sunsets January 31, 2025)
      • USDC Pool on Optimism
      • ETH Pool on Optimism
      • USDT Pool on Tron (sunsets Oct 29, 2024)
    • Fees
      • Unspent note handling
    • Deposit & Withdrawal Limits
    • Compliance & Security
      • TRM Labs Integration
    • Conferences, Workshops, Videos
      • International Videos
    • Governance
    • BOB Stablecoin
    • zkBob FAQ
  • πŸ¦Έβ€β™‚οΈzkBob Application
    • UI Overview
    • Account Creation
      • Login to an existing account
      • Lost Password
      • Metamask / Web3 Wallet Warning
    • Deposits
    • Transfers
      • Multitransfers
    • Withdrawals
      • Native Token Conversion
    • Generate a Receiving Address
    • Optional KYC
    • zkBob Direct Deposits
    • Support ID
    • Payment Links
    • Integrated Services
    • Multilingual support
      • PortuguΓͺs
      • Русский
      • δΈ­ζ–‡
  • πŸ‘©β€βš•οΈTechnical Implementation
    • zkBob Application Overview
    • Deployed Contracts
    • Smart Contracts
      • zkBob Pool Contract
        • Transaction Calldata
      • Bob Token Contract
      • Verifier contracts
      • Operator Manager Contract
        • Mutable Operator Manager
      • Voucher (XP) Token Contract
    • Accounts and Notes
      • Accounts
      • Notes
    • Relayer Node
      • Relayer Operations
      • Optimistic State
      • REST API
    • zkBob Keys
      • Address derivation
      • Ephemeral keys
    • zkSNARKs & Circuits
      • Transfer verifier circuit overview
    • zkBob Merkle Tree
      • The Poseidon Hash
    • Elliptic Curve Cryptography
    • Transaction Overview
      • Common Structure
      • Memo Block
        • Memo Block Encryption
      • Transaction Types
      • Nullifiers
      • Signing a Transaction
      • The Transaction Lifecycle
    • Client Library SDK
      • Configuration
        • Initializing the client
          • Client Configuration
        • Attaching a User Account
          • Account Configuration
        • Switching Between Pools
      • Account-less Mode Operations
        • Converting Token Amounts
        • Transaction Fees
        • Transaction Constraints
        • Using the Delegated Prover
        • Getting the State
        • Gift Cards
        • Client Library Status
        • Helpers
        • Versioning
      • Full Mode Operations
        • Balances and History
        • Shielded Addresses
        • Account State
        • Fee Estimations
        • Transaction Configuration
        • Sending Transactions
        • Transaction Maintenance
        • Direct Deposits
        • Gift Cards Maintenance
        • Ephemeral Deposits
        • Forced Exit
        • Other Routines
      • Common Types
      • Full Functions List
      • Utilities
  • πŸ‘©β€πŸ«Deployment
    • Trusted Setup Ceremony
    • Contract Deployment
    • Relayer Subsystem
  • πŸ‘·β€β™‚οΈRoadmap
    • On the Roadmap
    • Exploratory Features
      • XP (Experience Points)
        • XP-based Auctions
      • Multi-chain Custom Rollup Deployment
      • Round-robin Operator Manager
      • Compounding
  • πŸ§‘β€πŸ’»Jobs
    • Zero-Knowledge Researcher & Protocol Developer
  • 🧩Resources
    • Visual Assets
    • Hackathons
      • zkBob Cloud
    • Release Notes
      • October 11, 2023
      • July 13, 2023
      • June 13, 2023
      • March 28, 2023
      • January 30, 2023
      • January 16, 2023
      • January 2, 2023
      • Releases 2022
    • Security Audit
    • Github
    • Link tree
Powered by GitBook
On this page
  • Send a transaction to the contract
  • Get the job status
  • Query transactions
  • Get Merkle tree proofs at the specified position
  • Get Merkle tree root node at the specified index
  • Calculate transaction proof
  • Get the next index in the Merkle tree
  • Get current Merkle tree root and delta index

Was this helpful?

  1. Technical Implementation
  2. Relayer Node

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"
}
{
    error: "Error while parsing the input JSON",
    description: "tx_type is incorrect"
}
{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}

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
}
"Job 2 not found"
{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}}

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)
]
{
    error: "Incorrect parameters",
    description: "limit is too high"
}
{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}

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
}
"Incorrect index"
{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}

Get Merkle tree root node at the specified index

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

Query Parameters

Name
Type
Description

index

Integer

"11469701942666298368112882412133877458305516134926649826543144744382391691533"
"Index not exist in the Merkle tree"
{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}

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
}
{
    error: "Error while parsing the input JSON",
    description: "cannot find pub field"
}
{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}

Get the next index in the Merkle tree

GET http://relayer/delta_index

0

{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}

Get current Merkle tree root and delta index

GET http://relayer/info

{
    "root": "11469701942666298368112882412133877458305516134926649826543144744382391691533",
    "deltaIndex": 0
}
{
    error: "An internal error has occured. Please try again later",
    description: "optional error description"
}

PreviousOptimistic StateNextzkBob Keys

Last updated 2 years ago

Was this helpful?

πŸ‘©β€βš•οΈ