userclirealmrpccoordinatorrpc

User Cli Interface

This documentation organizes the three core data query interfaces implemented by RpcProvider (QTreeDataStoreReaderSync<F>, QMetaDataStoreReaderSync<F>, and QEDComboDataStoreReaderSync<F>). It includes interface functions, method details, parameter descriptions, and return value types, focusing on core data query capabilities for blockchain scenarios such as users, contracts, and checkpoints.

Basic Information

  • Core Dependent Types:
    • F = GoldilocksField: A prime field type based on Plonky2, used for blockchain data verification and hash calculation.
    • QHashOut<F>: Hash output result type, storing raw data after hash calculation.
    • MerkleProofCore<QHashOut<F>>: Core Merkle proof type, containing information such as the root, value, and sibling nodes required for proof.

Core Structures

RpcProvider

The foundational component for RPC communication, responsible for interacting with Realm nodes (user-specific data) and Coordinator nodes (global public data, e.g., contracts, checkpoints). It supports cross-environment use (non-WASM like servers, WASM like browser extensions).

Structure Definition

#![allow(unused)]
fn main() {
#[derive(Debug, Clone)]
pub struct RpcProvider {
    pub client: Arc<Client>,               // HTTP client (for RPC requests)
    pub realm_configs: HashMap<u64, Vec<String>>,  // Realm node config: {Realm ID → List of RPC URLs}
    pub coordinator_configs: HashMap<u64, Vec<String>>,  // Coordinator node config: {Coordinator ID → List of RPC URLs}
    pub users_per_realm: u64,              // Number of users assigned to each Realm (for user-to-Realm routing)
    pub current_user_id: u64,              // ID of the currently active user (for default data requests)
}
}

Key Methods

RpcProvider provides methods for node routing, user/contract/data queries, and transaction submission. Core methods are categorized below:

CategoryMethod NameParametersReturn ValueFunction Description
Node Routingget_realm_iduser_id: u64u64Calculate the Realm ID for a user (via user_id / users_per_realm).
get_realm_urluser_id: u64anyhow::Result<&String>Get a random RPC URL of the Realm node corresponding to the user (for load balancing).
get_coordinator_urlNoneanyhow::Result<&String>Get a random RPC URL of the Coordinator node (for global data requests).
User Operationsregister_userreq: QRegisterUserRPCRequest<F>anyhow::Result<()>Submit a user registration request to the Coordinator node.
get_user_idpublic_key: QHashOut<F>anyhow::Result<u64>Query the user ID corresponding to a public key from the Coordinator node.
Contract Operationsdeploy_contractreq: QDeployContractRPCRequest<F>anyhow::Result<()>Submit a contract deployment request to the Coordinator node.
Data Queriesget_realm_latest_l2_block_stateNoneanyhow::Result<QEDL2BlockState>Query the latest L2 block state from the current user’s Realm node.
get_claim_amountcheckpoint_id: u64, user_id: u64, claim_user_id: u64anyhow::Result<u64>Calculate the available claim amount for a user by querying contract state tree leaves.
check_tx_is_confirmedcheckpoint_id: u64, user_id: u64, tx_hash: QHashOut<GoldilocksField>anyhow::Result<bool>Verify if a transaction is confirmed by comparing the user leaf hash with the transaction hash.
Batch Proof Queryget_job_proofsjob_infos: Vec<JobInfo>anyhow::Result<Vec<(QProvingJobDataID, VariableHeightRewardMerkleProof)>>Batch query reward Merkle proofs for multiple jobs (routes to Realm/Coordinator based on job location).

Auxiliary Structures

RpcConfig & NetworkConfig

Configuration structures for node networks and proxy services, loaded from external config files:

#![allow(unused)]
fn main() {
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct RpcConfig {
    pub users_per_realm: u64,                // Number of users per Realm
    pub global_user_tree_height: u8,         // Height of the global user Merkle tree
    pub realm_user_tree_height: u8,          // Height of the Realm-specific user Merkle tree
    pub realm_configs: Vec<RealmRpcConfig>,  // List of Realm node configs
    pub coordinator_configs: Vec<CoordinatorRpcConfig>,  // List of Coordinator node configs
    pub prove_proxy_url: Vec<String>,        // List of proof proxy service URLs
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NetworkConfig {  // Extended config for blockchain network
    pub users_per_realm: u64,
    pub global_user_tree_height: u8,
    pub realm_user_tree_height: u8,
    pub realm_configs: Vec<RealmConfig>,     // Same as RealmRpcConfig
    pub coordinator_configs: Vec<CoordinatorConfig>,  // Same as CoordinatorRpcConfig
    pub prover_url: Option<String>,          // Optional prover service URL
    pub prove_proxy_url: Vec<String>,
    pub native_currency: String,             // Native currency symbol (e.g., "PSY")
}
}

Merkle Tree Data Query

This interface focuses on querying roots, leaf hashes, and Merkle proofs of various Merkle trees in the blockchain, covering core scenarios such as users, contracts, checkpoints, deposits, and withdrawals.

(1) User Contract State Tree Queries (User-Contract Internal State)

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_user_contract_state_tree_root- checkpoint_id: u64: Unique identifier for the checkpoint
- user_id: u64: Unique identifier for the user
- contract_id: u32: Unique identifier for the contract
QHashOut<F>Queries the root hash of a user's contract state tree under a specified checkpointRealm Node
get_user_contract_state_tree_leaf_hash- Same as above
- height: u8: Height of the state tree
- leaf_id: u64: Unique identifier for the leaf node
QHashOut<F>Queries the hash of a specified leaf node in the state treeRealm Node
get_user_contract_state_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a specified leaf node in the state tree (including verification logic)Realm Node

(2) User Contract Tree Queries (User-Contract Association)

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_user_contract_tree_root- checkpoint_id: u64: Unique identifier for the checkpoint
- user_id: u64: Unique identifier for the user
QHashOut<F>Queries the root hash of a user's contract tree under a specified checkpointRealm Node
get_user_contract_tree_leaf_hash- Same as above
- contract_id: u32: Unique identifier for the contract
QHashOut<F>Queries the hash of the leaf node corresponding to a contract in the user's contract treeRealm Node
get_user_contract_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a contract in the user's contract treeRealm Node

(3) User Registration Tree Queries (Global User Registration State)

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_user_registration_tree_root- checkpoint_id: u64: Unique identifier for the checkpointQHashOut<F>Queries the root hash of the global user registration tree under a specified checkpointCoordinator Node
get_user_registration_tree_leaf_hash- Same as above
- leaf_index: u64: Leaf index
QHashOut<F>Queries the hash of a leaf node at a specified index in the user registration treeCoordinator Node
get_user_registration_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a leaf node at a specified index in the user registration treeCoordinator Node

(4) User Tree Queries (Global User State)

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_user_tree_root- checkpoint_id: u64: Unique identifier for the checkpointQHashOut<F>Queries the root hash of the global user tree under a specified checkpointCoordinator Node
get_user_tree_leaf_hash- Same as above
- user_id: u64: Unique identifier for the user
QHashOut<F>Queries the hash of the leaf node corresponding to a user in the user treeRealm Node
get_user_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a user in the user tree (automatically merges subtree proofs)Coordinator & Realm Node
get_user_sub_tree_merkle_proof- checkpoint_id: u64: Unique identifier for the checkpoint
- root_level: u8: Root level
- leaf_level: u8: Leaf level
- leaf_index: u64: Leaf index
MerkleProofCore<QHashOut<F>>Queries the Merkle proof of a specified level in the user subtreeCoordinator & Realm Node
Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_contract_function_tree_root- checkpoint_id: u64: Unique identifier for the checkpoint
- contract_id: u32: Unique identifier for the contract
QHashOut<F>Queries the root hash of a contract's function tree under a specified checkpointCoordinator Node
get_contract_function_tree_leaf_hash- Same as above
- function_id: u32: Unique identifier for the function
QHashOut<F>Queries the hash of a function's leaf node in the contract function treeCoordinator Node
get_contract_function_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a function in the contract function treeCoordinator Node
get_contract_tree_root- checkpoint_id: u64: Unique identifier for the checkpointQHashOut<F>Queries the root hash of the global contract tree under a specified checkpointCoordinator Node
get_contract_tree_leaf_hash- Same as above
- contract_id: u32: Unique identifier for the contract
QHashOut<F>Queries the hash of a contract's leaf node in the contract treeCoordinator Node
get_contract_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a contract in the contract treeCoordinator Node

(1) Deposit Tree Queries

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_deposit_tree_root- checkpoint_id: u64: Unique identifier for the checkpointQHashOut<F>Queries the root hash of the global deposit tree under a specified checkpointCoordinator Node
get_deposit_tree_leaf_hash- Same as above
- deposit_id: u32: Unique identifier for the deposit
QHashOut<F>Queries the hash of a deposit's leaf node in the deposit treeCoordinator Node
get_deposit_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a deposit in the deposit treeCoordinator Node

(2) Withdrawal Tree Queries

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_withdrawal_tree_root- checkpoint_id: u64: Unique identifier for the checkpointQHashOut<F>Queries the root hash of the global withdrawal tree under a specified checkpointCoordinator Node
get_withdrawal_tree_leaf_hash- Same as above
- withdrawal_id: u32: Unique identifier for the withdrawal
QHashOut<F>Queries the hash of a withdrawal's leaf node in the withdrawal treeCoordinator Node
get_withdrawal_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a withdrawal in the withdrawal treeCoordinator Node
Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_latest_checkpoint_tree_rootNo parametersQHashOut<F>Queries the root hash of the latest checkpoint treeCoordinator Node
get_checkpoint_tree_root- checkpoint_id: u64: Unique identifier for the checkpointQHashOut<F>Queries the root hash of a specified checkpoint treeCoordinator Node
get_checkpoint_tree_leaf_hash- Same as above
- leaf_checkpoint_id: u64: Leaf checkpoint ID
QHashOut<F>Queries the hash of a leaf node in the checkpoint treeCoordinator Node
get_checkpoint_tree_merkle_proofSame parameters as aboveMerkleProofCore<QHashOut<F>>Queries the Merkle proof of a leaf node in the checkpoint treeCoordinator Node

Metadata Query

This interface focuses on querying core blockchain metadata, including complete leaf data for users, contracts, and checkpoints, as well as L2 block states.

1. User Metadata Queries

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_user_leaf_data- checkpoint_id: u64: Unique identifier for the checkpoint
- user_id: u64: Unique identifier for the user
QEDUserLeaf<F>Queries complete leaf data for a user under a specified checkpoint (including user state, hash, etc.)Realm Node

2. Contract Metadata Queries

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_contract_leaf_data- contract_id: u64: Unique identifier for the contractQEDContractLeaf<F>Queries complete leaf data for a contract (including basic contract information, state, etc.)Coordinator Node
get_contract_code_definition- contract_id: u64: Unique identifier for the contractContractCodeDefinitionQueries the code definition of a contract (including bytecode, function list, etc.)Coordinator Node

3. Checkpoint and L2 Block State Queries

Method NameParameter DescriptionReturn ValueFunction DescriptionCalled Node
get_checkpoint_leaf_data- checkpoint_id: u64: Unique identifier for the checkpointQEDCheckpointLeaf<F>Queries complete leaf data for a specified checkpoint (including global state root, block information, etc.)Coordinator Node
get_latest_l2_block_stateNo parametersQEDL2BlockStateQueries the complete state of the latest L2 block (including block height, transaction count, etc.)Coordinator Node
get_l2_block_state- checkpoint_id: u64: Unique identifier for the checkpointQEDL2BlockStateQueries the L2 block state corresponding to a specified checkpointCoordinator Node

Realm Edge RPC Documentation

This document provides comprehensive documentation for all Realm Edge RPC methods defined in the RealmEdgeRpc trait.

RPC Namespace: qed


Table of Contents

  1. User Management
  2. User End Cap Submission
  3. Checkpoint Data Operations
  4. L2 Block State Operations
  5. User Registration Tree Operations
  6. Checkpoint Tree Operations
  7. User Leaf Data Operations
  8. User Contract State Tree Operations
  9. User Contract Tree Operations
  10. User Tree Operations
  11. Batch Proof Generation
  12. GraphViz Export
  13. Data Structures

User Management

1. check_user_id_in_realm

Check if a user ID belongs to this realm.

Method Name: qed_check_user_id_in_realm

Request Parameters:

{
  "user_id": 12345
}
ParameterTypeDescription
user_idu64The user ID to check

Response:

{
  "result": true
}
FieldTypeDescription
resultbooltrue if the user belongs to this realm, false otherwise

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_check_user_id_in_realm",
    "params": [12345],
    "id": 1
  }'

User End Cap Submission

2. submit_user_end_cap

Submit a user end cap proof for processing.

Method Name: qed_submit_user_end_cap

Request Parameters:

{
  "user_ec_input": {
    "core": {
      "checkpoint_id": "123",
      "stats": { ... },
      "state_transition": { ... },
      "new_user_leaf": { ... }
    },
    "contract_state_updates": [ ... ]
  },
  "proof": { ... }
}
ParameterTypeDescription
user_ec_inputSubmitUserEndCapNonProofInput<F>End cap input data (see Data Structures)
proofProofWithPublicInputs<F, C, D>Zero-knowledge proof

Response:

{
  "result": "0x1234567890abcdef..."
}
FieldTypeDescription
resultStringTransaction hash or job ID

Checkpoint Data Operations

3. get_checkpoint_leaf_data

Get checkpoint leaf data by checkpoint ID (u64 parameter).

Method Name: qed_get_checkpoint_leaf_data

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QEDCheckpointLeaf

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_checkpoint_leaf_data",
    "params": [100],
    "id": 1
  }'

4. get_checkpoint_leaf_data_f

Get checkpoint leaf data by checkpoint ID (Field parameter).

Method Name: qed_get_checkpoint_leaf_data_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QEDCheckpointLeaf


L2 Block State Operations

5. get_latest_l2_block_state

Get the latest L2 block state.

Method Name: qed_get_latest_l2_block_state

Request Parameters: None

Response: See QEDL2BlockState

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_latest_l2_block_state",
    "params": [],
    "id": 1
  }'

Response Example:

{
  "result": {
    "checkpoint_id": 100,
    "next_add_withdrawal_id": 50,
    "next_process_withdrawal_id": 45,
    "next_deposit_id": 200,
    "total_deposits_claimed_epoch": 180,
    "next_user_id": 1000,
    "end_balance": 5000000,
    "next_contract_id": 25
  }
}

6. get_l2_block_state

Get L2 block state at a specific checkpoint (u64 parameter).

Method Name: qed_get_l2_block_state

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QEDL2BlockState


7. get_l2_block_state_f

Get L2 block state at a specific checkpoint (Field parameter).

Method Name: qed_get_l2_block_state_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QEDL2BlockState


User Registration Tree Operations

8. get_user_registration_tree_root

Get the user registration tree root at a specific checkpoint.

Method Name: qed_get_user_registration_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut

Example Response:

{
  "result": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
}

Checkpoint Tree Operations

9. get_latest_checkpoint_tree_root

Get the latest checkpoint tree root.

Method Name: qed_get_latest_checkpoint_tree_root

Request Parameters: None

Response: See QHashOut


10. get_checkpoint_tree_root

Get checkpoint tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_checkpoint_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


11. get_checkpoint_tree_root_f

Get checkpoint tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_checkpoint_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


12. get_checkpoint_tree_leaf_hash

Get a specific checkpoint tree leaf hash (u64 parameters).

Method Name: qed_get_checkpoint_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "leaf_checkpoint_id": 95
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
leaf_checkpoint_idu64The leaf checkpoint ID

Response: See QHashOut


13. get_checkpoint_tree_leaf_hash_f

Get a specific checkpoint tree leaf hash (Field parameters).

Method Name: qed_get_checkpoint_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "leaf_checkpoint_id": "95"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
leaf_checkpoint_idF (Field)The leaf checkpoint ID as a field element

Response: See QHashOut


14. get_checkpoint_tree_merkle_proof

Get Merkle proof for a checkpoint tree leaf (u64 parameters).

Method Name: qed_get_checkpoint_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "leaf_checkpoint_id": 95
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
leaf_checkpoint_idu64The leaf checkpoint ID

Response: See MerkleProofCore


15. get_checkpoint_tree_merkle_proof_f

Get Merkle proof for a checkpoint tree leaf (Field parameters).

Method Name: qed_get_checkpoint_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "leaf_checkpoint_id": "95"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
leaf_checkpoint_idF (Field)The leaf checkpoint ID as a field element

Response: See MerkleProofCore


16. get_checkpoint_global_state_roots

Get global state roots at a specific checkpoint.

Method Name: qed_get_checkpoint_global_state_roots

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QEDCheckpointGlobalStateRoots

Example Response:

{
  "result": {
    "contract_tree_root": "0x...",
    "deposit_tree_root": "0x...",
    "user_tree_root": "0x...",
    "withdrawal_tree_root": "0x...",
    "user_registration_tree_root": "0x..."
  }
}

User Leaf Data Operations

17. get_user_leaf_data

Get user leaf data at a specific checkpoint (u64 parameters).

Method Name: qed_get_user_leaf_data

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID

Response: See QEDUserLeaf

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_user_leaf_data",
    "params": [100, 12345],
    "id": 1
  }'

18. get_user_leaf_data_f

Get user leaf data at a specific checkpoint (Field parameters).

Method Name: qed_get_user_leaf_data_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element

Response: See QEDUserLeaf


User Contract State Tree Operations

19. get_user_contract_state_tree_root

Get user contract state tree root (u64 parameters).

Method Name: qed_get_user_contract_state_tree_root

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345,
  "contract_id": 5
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID
contract_idu32The contract ID

Response: See QHashOut


20. get_user_contract_state_tree_root_f

Get user contract state tree root (Field parameters).

Method Name: qed_get_user_contract_state_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345",
  "contract_id": "5"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element
contract_idF (Field)The contract ID as a field element

Response: See QHashOut


21. get_user_contract_state_tree_leaf_hash

Get user contract state tree leaf hash (u64 parameters).

Method Name: qed_get_user_contract_state_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345,
  "contract_id": 5,
  "height": 10,
  "leaf_id": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID
contract_idu32The contract ID
heightu8The tree height
leaf_idu64The leaf ID

Response: See QHashOut


22. get_user_contract_state_tree_leaf_hash_f

Get user contract state tree leaf hash (Field parameters).

Method Name: qed_get_user_contract_state_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345",
  "contract_id": "5",
  "height": 10,
  "leaf_id": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element
contract_idF (Field)The contract ID as a field element
heightu8The tree height
leaf_idF (Field)The leaf ID as a field element

Response: See QHashOut


23. get_user_contract_state_tree_merkle_proof

Get Merkle proof for user contract state tree (u64 parameters).

Method Name: qed_get_user_contract_state_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345,
  "contract_id": 5,
  "height": 10,
  "leaf_id": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID
contract_idu32The contract ID
heightu8The tree height
leaf_idu64The leaf ID

Response: See MerkleProofCore


24. get_user_contract_state_tree_merkle_proof_f

Get Merkle proof for user contract state tree (Field parameters).

Method Name: qed_get_user_contract_state_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345",
  "contract_id": "5",
  "height": 10,
  "leaf_id": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element
contract_idF (Field)The contract ID as a field element
heightu8The tree height
leaf_idF (Field)The leaf ID as a field element

Response: See MerkleProofCore


User Contract Tree Operations

25. get_user_contract_tree_root

Get user contract tree root (u64 parameters).

Method Name: qed_get_user_contract_tree_root

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID

Response: See QHashOut


26. get_user_contract_tree_root_f

Get user contract tree root (Field parameters).

Method Name: qed_get_user_contract_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element

Response: See QHashOut


27. get_user_contract_tree_leaf_hash

Get user contract tree leaf hash (u64 parameters).

Method Name: qed_get_user_contract_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345,
  "contract_id": 5
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID
contract_idu32The contract ID

Response: See QHashOut


28. get_user_contract_tree_leaf_hash_f

Get user contract tree leaf hash (Field parameters).

Method Name: qed_get_user_contract_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345",
  "contract_id": "5"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element
contract_idF (Field)The contract ID as a field element

Response: See QHashOut


29. get_user_contract_tree_merkle_proof

Get Merkle proof for user contract tree (u64 parameters).

Method Name: qed_get_user_contract_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345,
  "contract_id": 5
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID
contract_idu32The contract ID

Response: See MerkleProofCore


30. get_user_contract_tree_merkle_proof_f

Get Merkle proof for user contract tree (Field parameters).

Method Name: qed_get_user_contract_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345",
  "contract_id": "5"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element
contract_idF (Field)The contract ID as a field element

Response: See MerkleProofCore


User Tree Operations

31. get_user_tree_root

Get user tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_user_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


32. get_user_tree_root_f

Get user tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_user_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


33. get_user_tree_leaf_hash

Get user tree leaf hash (u64 parameters).

Method Name: qed_get_user_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID

Response: See QHashOut


34. get_user_tree_leaf_hash_f

Get user tree leaf hash (Field parameters).

Method Name: qed_get_user_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element

Response: See QHashOut


35. get_user_bottom_tree_merkle_proof

Get Merkle proof for user bottom tree (u64 parameters).

Method Name: qed_get_user_bottom_tree_merkle_proof

Request Parameters:

{
  "root_level": 5,
  "checkpoint_id": 100,
  "user_id": 12345
}
ParameterTypeDescription
root_levelu8The root level of the tree
checkpoint_idu64The checkpoint ID
user_idu64The user ID

Response: See MerkleProofCore


36. get_user_bottom_tree_merkle_proof_f

Get Merkle proof for user bottom tree (Field parameters).

Method Name: qed_get_user_bottom_tree_merkle_proof_f

Request Parameters:

{
  "root_level": 5,
  "checkpoint_id": "100",
  "user_id": "12345"
}
ParameterTypeDescription
root_levelu8The root level of the tree
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element

Response: See MerkleProofCore


37. get_user_sub_tree_merkle_proof

Get Merkle proof for user sub-tree (u64 parameters).

Method Name: qed_get_user_sub_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "root_level": 5,
  "leaf_level": 2,
  "leaf_index": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
root_levelu8The root level of the tree
leaf_levelu8The leaf level of the tree
leaf_indexu64The leaf index

Response: See MerkleProofCore


38. get_user_sub_tree_merkle_proof_f

Get Merkle proof for user sub-tree (Field parameters).

Method Name: qed_get_user_sub_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "root_level": 5,
  "leaf_level": 2,
  "leaf_index": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
root_levelu8The root level of the tree
leaf_levelu8The leaf level of the tree
leaf_indexF (Field)The leaf index as a field element

Response: See MerkleProofCore


39. get_user_tree_merkle_proof

Get Merkle proof for user tree (u64 parameters).

Method Name: qed_get_user_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID

Response: See MerkleProofCore

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_user_tree_merkle_proof",
    "params": [100, 12345],
    "id": 1
  }'

40. get_user_tree_merkle_proof_f

Get Merkle proof for user tree (Field parameters).

Method Name: qed_get_user_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element

Response: See MerkleProofCore

Note: This method internally converts field parameters to u64 and calls get_user_tree_merkle_proof.


Batch Proof Generation

41. generate_batch_variable_height_reward_proofs

Generate batch variable height reward Merkle proofs for multiple job IDs.

Method Name: qed_generate_batch_variable_height_reward_proofs

Request Parameters:

{
  "checkpoint_id": 100,
  "job_ids": [
    {
      "topic": "GenerateStandardProof",
      "goal_id": 100,
      "slot_id": 5,
      "circuit_type": "GUTATwoEndCap",
      "group_id": 1,
      "sub_group_id": 0,
      "task_index": 0,
      "data_type": "InputWitness",
      "data_index": 0
    }
  ]
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
job_idsVec<QProvingJobDataID>Array of proving job data IDs (see QProvingJobDataID)

Response:

{
  "result": [
    [
      {
        "top_siblings": [...],
        "sibling_branch": "0x...",
        "reward_leaf": "0x...",
        "proof_height": "5",
        "index": "42"
      },
      {
        "topic": "GenerateStandardProof",
        "goal_id": 100,
        ...
      }
    ]
  ]
}
FieldTypeDescription
resultVec<(VariableHeightRewardMerkleProof, QProvingJobDataID)>Array of tuples containing proofs and job IDs

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_generate_batch_variable_height_reward_proofs",
    "params": [100, [...]],
    "id": 1
  }'

GraphViz Export

42. get_graphviz

Get GraphViz representation of the Merkle tree at a specific checkpoint.

Method Name: qed_get_graphviz

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response:

{
  "result": "digraph G {\n  node1 -> node2;\n  ...\n}"
}
FieldTypeDescription
resultStringGraphViz DOT format string

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_graphviz",
    "params": [100],
    "id": 1
  }' | jq -r '.result' | dot -Tpng > tree.png

Data Structures

QHashOut

A hash output wrapper for Plonky2 field elements.

Structure:

#![allow(unused)]
fn main() {
pub struct QHashOut<F: Field>(pub HashOut<F>);
}

JSON Representation:

"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"

Description:

  • Wraps a Plonky2 HashOut<F> containing 4 field elements
  • Serialized as a hexadecimal string (32 bytes)
  • Represents a 256-bit hash value

QEDL2BlockState

L2 block state information at a specific checkpoint.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDL2BlockState {
    pub checkpoint_id: u64,
    pub next_add_withdrawal_id: u64,
    pub next_process_withdrawal_id: u64,
    pub next_deposit_id: u64,
    pub total_deposits_claimed_epoch: u64,
    pub next_user_id: u64,
    pub end_balance: u64,
    pub next_contract_id: u32,
}
}

Fields:

FieldTypeDescription
checkpoint_idu64The checkpoint identifier
next_add_withdrawal_idu64Next withdrawal ID to be added
next_process_withdrawal_idu64Next withdrawal ID to be processed
next_deposit_idu64Next deposit ID
total_deposits_claimed_epochu64Total deposits claimed in current epoch
next_user_idu64Next user ID to be assigned
end_balanceu64Ending balance at this checkpoint
next_contract_idu32Next contract ID to be assigned

Example:

{
  "checkpoint_id": 100,
  "next_add_withdrawal_id": 50,
  "next_process_withdrawal_id": 45,
  "next_deposit_id": 200,
  "total_deposits_claimed_epoch": 180,
  "next_user_id": 1000,
  "end_balance": 5000000,
  "next_contract_id": 25
}

QEDCheckpointLeaf

Checkpoint leaf data containing global chain root and statistics.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDCheckpointLeaf<F: RichField> {
    pub global_chain_root: QHashOut<F>,
    pub stats: QEDCheckpointLeafStats<F>,
}
}

Fields:

FieldTypeDescription
global_chain_rootQHashOut<F>Global chain state root hash
statsQEDCheckpointLeafStats<F>Checkpoint statistics

QEDCheckpointLeafStats Structure:

#![allow(unused)]
fn main() {
pub struct QEDCheckpointLeafStats<F: RichField> {
    pub fees_collected: F,
    pub user_ops_processed: F,
    pub total_transactions: F,
    pub slots_modified: F,
    pub pm_jobs_completed: PMJobsCompletedStats<F>,
    pub block_time: F,
    pub random_seed: QHashOut<F>,
    pub pm_rewards_commitment: PMRewardCommitment<F>,
    pub da_challenges_claimed: [F; DA_CHALLENGE_WINDOW],
}
}

Example:

{
  "global_chain_root": "0x...",
  "stats": {
    "fees_collected": "1000",
    "user_ops_processed": "50",
    "total_transactions": "75",
    "slots_modified": "30",
    "pm_jobs_completed": {...},
    "block_time": "1234567890",
    "random_seed": "0x...",
    "pm_rewards_commitment": {...},
    "da_challenges_claimed": [...]
  }
}

QEDCheckpointGlobalStateRoots

Global state roots at a specific checkpoint.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDCheckpointGlobalStateRoots<F: RichField> {
    pub contract_tree_root: QHashOut<F>,
    pub deposit_tree_root: QHashOut<F>,
    pub user_tree_root: QHashOut<F>,
    pub withdrawal_tree_root: QHashOut<F>,
    pub user_registration_tree_root: QHashOut<F>,
}
}

Fields:

FieldTypeDescription
contract_tree_rootQHashOut<F>Root of the contract tree
deposit_tree_rootQHashOut<F>Root of the deposit tree
user_tree_rootQHashOut<F>Root of the user tree
withdrawal_tree_rootQHashOut<F>Root of the withdrawal tree
user_registration_tree_rootQHashOut<F>Root of the user registration tree

Example:

{
  "contract_tree_root": "0x1234...",
  "deposit_tree_root": "0x5678...",
  "user_tree_root": "0x9abc...",
  "withdrawal_tree_root": "0xdef0...",
  "user_registration_tree_root": "0x1234..."
}

QEDUserLeaf

User leaf data containing user state information.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDUserLeaf<F: RichField> {
    pub public_key: QHashOut<F>,
    pub user_state_tree_root: QHashOut<F>,
    pub balance: F,
    pub nonce: F,
    pub last_checkpoint_id: F,
    pub event_index: F,
    pub user_id: F,
}
}

Fields:

FieldTypeDescription
public_keyQHashOut<F>User's public key hash
user_state_tree_rootQHashOut<F>Root of user's state tree
balanceFUser's balance
nonceFUser's transaction nonce
last_checkpoint_idFLast checkpoint ID where user was updated
event_indexFEvent index for this user
user_idFUser identifier

Example:

{
  "public_key": "0x1234...",
  "user_state_tree_root": "0x5678...",
  "balance": "1000000",
  "nonce": "42",
  "last_checkpoint_id": "100",
  "event_index": "15",
  "user_id": "12345"
}

MerkleProofCore

Generic Merkle proof structure.

Structure:

#![allow(unused)]
fn main() {
pub struct MerkleProofCore<Hash: PartialEq + Copy> {
    pub root: Hash,
    pub value: Hash,
    pub index: u64,
    pub siblings: Vec<Hash>,
}
}

Fields:

FieldTypeDescription
rootHashMerkle tree root hash
valueHashLeaf value being proven
indexu64Leaf index in the tree
siblingsVec<Hash>Sibling hashes along the path

Example:

{
  "root": "0x1234...",
  "value": "0x5678...",
  "index": 42,
  "siblings": [
    "0x9abc...",
    "0xdef0...",
    "0x1234..."
  ]
}

Verification: The proof can be verified by hashing the value with siblings along the path according to the index bits.


SubmitUserEndCapNonProofInput

Input data for submitting user end cap (without proof).

Structure:

#![allow(unused)]
fn main() {
pub struct SubmitUserEndCapNonProofInput<F: RichField> {
    pub core: SubmitUserEndCapNonProofCoreInput<F>,
    pub contract_state_updates: Vec<QEDContractStateUpdateHistory<F>>,
}

pub struct SubmitUserEndCapNonProofCoreInput<F: RichField> {
    pub checkpoint_id: F,
    pub stats: GUTAStats<F>,
    pub state_transition: UPSEndCapResultCompact<F>,
    pub new_user_leaf: QEDUserLeaf<F>,
}
}

Fields:

FieldTypeDescription
coreSubmitUserEndCapNonProofCoreInput<F>Core input data
contract_state_updatesVec<QEDContractStateUpdateHistory<F>>Contract state update history

Core Fields:

FieldTypeDescription
checkpoint_idFCheckpoint ID
statsGUTAStats<F>GUTA statistics
state_transitionUPSEndCapResultCompact<F>State transition result
new_user_leafQEDUserLeaf<F>New user leaf data

QProvingJobDataID

Proving job data identifier.

Structure:

#![allow(unused)]
fn main() {
pub struct QProvingJobDataID {
    pub topic: QJobTopic,
    pub goal_id: u64,
    pub slot_id: u64,
    pub circuit_type: ProvingJobCircuitType,
    pub group_id: u32,
    pub sub_group_id: u32,
    pub task_index: u32,
    pub data_type: ProvingJobDataType,
    pub data_index: u8,
}
}

Fields:

FieldTypeDescription
topicQJobTopicJob topic (e.g., GenerateStandardProof)
goal_idu64Goal identifier (usually checkpoint ID)
slot_idu64Slot identifier
circuit_typeProvingJobCircuitTypeType of circuit (e.g., GUTATwoEndCap)
group_idu32Group identifier
sub_group_idu32Sub-group identifier
task_indexu32Task index within the group
data_typeProvingJobDataTypeData type (e.g., InputWitness)
data_indexu8Data index

Serialization: Serialized as a 32-byte array.

Example:

{
  "topic": "GenerateStandardProof",
  "goal_id": 100,
  "slot_id": 5,
  "circuit_type": "GUTATwoEndCap",
  "group_id": 1,
  "sub_group_id": 0,
  "task_index": 0,
  "data_type": "InputWitness",
  "data_index": 0
}

VariableHeightRewardMerkleProof

Variable height Merkle proof for reward distribution.

Structure:

#![allow(unused)]
fn main() {
pub struct VariableHeightRewardMerkleProof {
    pub top_siblings: Vec<VariableHeightProofSibling>,
    pub sibling_branch: QHashOut<F>,
    pub reward_leaf: QHashOut<F>,
    pub proof_height: F,
    pub index: F,
}

pub struct VariableHeightProofSibling {
    pub sibling_branch: QHashOut<F>,
    pub sibling_reward_leaf: QHashOut<F>,
}
}

Fields:

FieldTypeDescription
top_siblingsVec<VariableHeightProofSibling>Siblings at each level
sibling_branchQHashOut<F>Sibling branch hash
reward_leafQHashOut<F>Reward leaf hash
proof_heightFHeight of the proof
indexFIndex in the tree

Example:

{
  "top_siblings": [
    {
      "sibling_branch": "0x1234...",
      "sibling_reward_leaf": "0x5678..."
    }
  ],
  "sibling_branch": "0x9abc...",
  "reward_leaf": "0xdef0...",
  "proof_height": "5",
  "index": "42"
}

Field Type Notes

Throughout this API, F represents a field element type (typically GoldilocksField).

Field Element Conversion:

  • Methods with _f suffix accept field elements as strings (e.g., "12345")
  • Methods without _f suffix accept native types (e.g., 12345)
  • Field elements are internally represented as u64 values in the Goldilocks field

Best Practices:

  • Use u64 variants for better performance when possible
  • Use Field variants when working with circuit inputs/outputs
  • Always validate checkpoint_id exists before querying
  • Handle RPC errors gracefully (missing data, invalid parameters)

Error Handling

All RPC methods return RpcResult<T> which can contain errors in the following format:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32000,
    "message": "Error description"
  },
  "id": 1
}

Common Error Codes:

  • -32000: Server error (checkpoint not found, data unavailable)
  • -32602: Invalid parameters
  • -32603: Internal error

Usage Examples

Complete Workflow Example

# 1. Check if user belongs to realm
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_check_user_id_in_realm",
    "params": [12345],
    "id": 1
  }'

# 2. Get latest L2 block state
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_latest_l2_block_state",
    "params": [],
    "id": 2
  }'

# 3. Get user leaf data at checkpoint
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_user_leaf_data",
    "params": [100, 12345],
    "id": 3
  }'

# 4. Get Merkle proof for user
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_user_tree_merkle_proof",
    "params": [100, 12345],
    "id": 4
  }'

Method Summary

#Method NameParametersReturnsDescription
1check_user_id_in_realmuser_id: u64boolCheck user belongs to realm
2submit_user_end_capinput, proofStringSubmit end cap proof
3-4get_checkpoint_leaf_data[_f]checkpoint_idQEDCheckpointLeafGet checkpoint leaf
5-7get_[latest_]l2_block_state[_f][checkpoint_id]QEDL2BlockStateGet L2 block state
8get_user_registration_tree_rootcheckpoint_idQHashOutGet registration tree root
9-11get_[latest_]checkpoint_tree_root[_f][checkpoint_id]QHashOutGet checkpoint tree root
12-15get_checkpoint_tree_[leaf_hash\|merkle_proof][_f]checkpoint_id, leaf_idQHashOut\|ProofCheckpoint tree ops
16get_checkpoint_global_state_rootscheckpoint_idGlobalStateRootsGet global state roots
17-18get_user_leaf_data[_f]checkpoint_id, user_idQEDUserLeafGet user leaf data
19-24get_user_contract_state_tree_*[_f]VariousQHashOut\|ProofContract state tree ops
25-30get_user_contract_tree_*[_f]VariousQHashOut\|ProofUser contract tree ops
31-40get_user_tree_*[_f]VariousQHashOut\|ProofUser tree operations
41generate_batch_variable_height_reward_proofscheckpoint_id, job_idsVec<(Proof, JobID)>Batch reward proofs
42get_graphvizcheckpoint_idStringGet tree visualization

Document Version: 1.0
Last Updated: 2025-10-24
Total RPC Methods: 42

Coordinator Edge RPC Documentation

This document provides comprehensive documentation for all Coordinator Edge RPC methods defined in the CoordinatorEdgeRpc trait.

RPC Namespace: qed


Table of Contents

  1. User Management
  2. Contract Management
  3. Block Operations
  4. GUTA Submission
  5. Checkpoint Operations
  6. Checkpoint Sync
  7. L2 Block State Operations
  8. User Registration Tree Operations
  9. User Tree Operations
  10. Contract Function Tree Operations
  11. Contract Tree Operations
  12. Deposit Tree Operations
  13. Withdrawal Tree Operations
  14. Checkpoint Tree Operations
  15. Reward Proofs Generation
  16. Realm Status Operations
  17. Data Structures

User Management

1. register_user

Register a new user with ZK public key.

Method Name: qed_register_user

Request Parameters:

{
  "public_key": {
    "fingerprint": "0x1234...",
    "public_key_param": "0x5678..."
  }
}
ParameterTypeDescription
public_keyZKPublicKeyInfo<F>ZK public key information

Response:

{
  "result": "ok"
}
FieldTypeDescription
resultString"ok" on success

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_register_user",
    "params": [{
      "fingerprint": "0x...",
      "public_key_param": "0x..."
    }],
    "id": 1
  }'

2. get_user_id

Get user ID by public key hash.

Method Name: qed_get_user_id

Request Parameters:

{
  "public_key": "0x1234567890abcdef..."
}
ParameterTypeDescription
public_keyQHashOut<F>User's public key hash

Response:

{
  "result": 12345
}
FieldTypeDescription
resultu64User ID

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_user_id",
    "params": ["0x1234..."],
    "id": 1
  }'

Contract Management

3. deploy_contract

Deploy a new smart contract.

Method Name: qed_deploy_contract

Request Parameters:

{
  "deploy_contract": {
    "deployer": "0x1234...",
    "code_definition": {
      "state_tree_height": 10,
      "functions": [...]
    },
    "function_whitelist": ["0x..."]
  }
}
ParameterTypeDescription
deploy_contractQBCDeployContract<F>Contract deployment data (see QBCDeployContract)

Response:

{
  "result": "ok"
}

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_deploy_contract",
    "params": [{
      "deployer": "0x...",
      "code_definition": {...},
      "function_whitelist": [...]
    }],
    "id": 1
  }'

4. get_contract_leaf_data

Get contract leaf data by contract ID (u64 parameter).

Method Name: qed_get_contract_leaf_data

Request Parameters:

{
  "contract_id": 5
}
ParameterTypeDescription
contract_idu64The contract ID

Response: See QEDContractLeaf


5. get_contract_leaf_data_f

Get contract leaf data by contract ID (Field parameter).

Method Name: qed_get_contract_leaf_data_f

Request Parameters:

{
  "contract_id": "5"
}
ParameterTypeDescription
contract_idF (Field)The contract ID as a field element

Response: See QEDContractLeaf


6. get_contract_code_definition

Get contract code definition by contract ID (u64 parameter).

Method Name: qed_get_contract_code_definition

Request Parameters:

{
  "contract_id": 5
}
ParameterTypeDescription
contract_idu64The contract ID

Response: See ContractCodeDefinition


7. get_contract_code_definition_f

Get contract code definition by contract ID (Field parameter).

Method Name: qed_get_contract_code_definition_f

Request Parameters:

{
  "contract_id": "5"
}
ParameterTypeDescription
contract_idF (Field)The contract ID as a field element

Response: See ContractCodeDefinition


Block Operations

8. build_block

Trigger building a new block/checkpoint.

Method Name: qed_build_block

Request Parameters: None

Response:

{
  "result": "ok"
}

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_build_block",
    "params": [],
    "id": 1
  }'

GUTA Submission

9. submit_guta

Submit GUTA (Global User Tree Aggregator) result with proof.

Method Name: qed_submit_guta

Request Parameters:

{
  "input": {
    "realm_id": 1,
    "checkpoint_id": 100,
    "guta_stats": {...},
    "top_line_proof": {...},
    "checkpoint_tree_root": "0x...",
    "proof_id": {...}
  },
  "proof": {...},
  "realm_id": 1
}
ParameterTypeDescription
inputSubmitGUTARealmResultAPINoProofInput<F>GUTA submission input
proofProofWithPublicInputs<F, C, D>Zero-knowledge proof
realm_idu64Realm identifier

Response:

{
  "result": "ok"
}

10. submit_guta_v1

Submit GUTA result with serialized proof (v1 format).

Method Name: qed_submit_guta_v1

Request Parameters:

{
  "input": {...},
  "proof": "0x...",
  "realm_id": 1
}
ParameterTypeDescription
inputSubmitGUTARealmResultAPINoProofInput<F>GUTA submission input
proofVec<u8>Serialized proof bytes
realm_idu64Realm identifier

Response:

{
  "result": null
}

11. submit_realm_result

Submit realm processing result to coordinator.

Method Name: qed_submit_realm_result

Request Parameters:

{
  "realm_result": {
    "header": {
      "realm_id": 1,
      "checkpoint_id": 100,
      "start_realm_root": "0x...",
      "end_realm_root": "0x...",
      "guta_stats": {...},
      "root_job_id": {...}
    },
    "proof": "0x..."
  }
}
ParameterTypeDescription
realm_resultRealmDataForCoordinator<F>Realm result data

Response:

{
  "result": null
}

Checkpoint Operations

12. get_latest_checkpoint

Get latest checkpoint information.

Method Name: qed_get_latest_checkpoint

Request Parameters: None

Response:

{
  "result": {
    "checkpoint_id": 100
  }
}
FieldTypeDescription
checkpoint_idu64Latest checkpoint ID

13. latest_checkpoint

Get latest checkpoint ID (simple version).

Method Name: qed_latest_checkpoint

Request Parameters: None

Response:

{
  "result": 100
}

14. get_latest_checkpoint_id

Get latest checkpoint ID.

Method Name: qed_get_latest_checkpoint_id

Request Parameters: None

Response:

{
  "result": 100
}

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_latest_checkpoint_id",
    "params": [],
    "id": 1
  }'

15. get_checkpoint_leaf_data

Get checkpoint leaf data by checkpoint ID (u64 parameter).

Method Name: qed_get_checkpoint_leaf_data

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QEDCheckpointLeaf


16. get_checkpoint_leaf_data_f

Get checkpoint leaf data by checkpoint ID (Field parameter).

Method Name: qed_get_checkpoint_leaf_data_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QEDCheckpointLeaf


17. get_checkpoint_global_state_roots

Get global state roots at a specific checkpoint.

Method Name: qed_get_checkpoint_global_state_roots

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QEDCheckpointGlobalStateRoots


Checkpoint Sync

18. get_checkpoint_sync_info

Get checkpoint sync information for a realm.

Method Name: qed_get_checkpoint_sync_info

Request Parameters:

{
  "realm_id": 1,
  "checkpoint_id": 100
}
ParameterTypeDescription
realm_idu32Realm identifier
checkpoint_idu64Checkpoint ID

Response: See CheckpointSyncInfo


19. get_checkpoint_sync_info_compact

Get compact checkpoint sync information.

Method Name: qed_get_checkpoint_sync_info_compact

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64Checkpoint ID

Response: See [QEDCheckpointSyncInfoCompact](#qedcheckpointsyncinfo compact)


L2 Block State Operations

20. get_latest_l2_block_state

Get the latest L2 block state.

Method Name: qed_get_latest_l2_block_state

Request Parameters: None

Response: See QEDL2BlockState

Example Response:

{
  "result": {
    "checkpoint_id": 100,
    "next_add_withdrawal_id": 50,
    "next_process_withdrawal_id": 45,
    "next_deposit_id": 200,
    "total_deposits_claimed_epoch": 180,
    "next_user_id": 1000,
    "end_balance": 5000000,
    "next_contract_id": 25
  }
}

21. get_l2_block_state

Get L2 block state at a specific checkpoint (u64 parameter).

Method Name: qed_get_l2_block_state

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QEDL2BlockState


22. get_l2_block_state_f

Get L2 block state at a specific checkpoint (Field parameter).

Method Name: qed_get_l2_block_state_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QEDL2BlockState


User Registration Tree Operations

23. get_user_registration_tree_root

Get user registration tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_user_registration_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


24. get_user_registration_tree_root_f

Get user registration tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_user_registration_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


25. get_user_registration_tree_leaf_hash

Get user registration tree leaf hash (u64 parameters).

Method Name: qed_get_user_registration_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "leaf_index": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
leaf_indexu64The leaf index

Response: See QHashOut


26. get_user_registration_tree_leaf_hash_f

Get user registration tree leaf hash (Field parameters).

Method Name: qed_get_user_registration_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "leaf_index": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
leaf_indexF (Field)The leaf index as a field element

Response: See QHashOut


27. get_user_registration_tree_merkle_proof

Get Merkle proof for user registration tree (u64 parameters).

Method Name: qed_get_user_registration_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "leaf_index": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
leaf_indexu64The leaf index

Response: See MerkleProofCore


28. get_user_registration_tree_merkle_proof_f

Get Merkle proof for user registration tree (Field parameters).

Method Name: qed_get_user_registration_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "leaf_index": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
leaf_indexF (Field)The leaf index as a field element

Response: See MerkleProofCore


User Tree Operations

29. get_user_tree_root

Get user tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_user_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


30. get_user_tree_root_f

Get user tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_user_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


31. get_user_sub_tree_merkle_proof

Get Merkle proof for user sub-tree.

Method Name: qed_get_user_sub_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "root_level": 5,
  "leaf_level": 2,
  "leaf_index": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
root_levelu8Root level of the tree
leaf_levelu8Leaf level of the tree
leaf_indexu64The leaf index

Response: See MerkleProofCore


32. get_user_top_tree_merkle_proof

Get Merkle proof for user top tree.

Method Name: qed_get_user_top_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "leaf_level": 2,
  "leaf_index": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
leaf_levelu8Leaf level of the tree
leaf_indexu64The leaf index

Response: See MerkleProofCore


33. get_user_top_tree_cap_root

Get user top tree cap root.

Method Name: qed_get_user_top_tree_cap_root

Request Parameters:

{
  "checkpoint_id": 100,
  "cap_level": 3,
  "cap_index": 10
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
cap_levelu8Cap level
cap_indexu64Cap index

Response: See QHashOut


34. get_user_latest_top_tree_cap_root

Get latest user top tree cap root.

Method Name: qed_get_user_latest_top_tree_cap_root

Request Parameters:

{
  "cap_level": 3,
  "cap_index": 10
}
ParameterTypeDescription
cap_levelu8Cap level
cap_indexu64Cap index

Response: See QHashOut


35. get_user_leaf_data

Get user leaf data at a specific checkpoint.

Method Name: qed_get_user_leaf_data

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID

Response: See QEDUserLeaf


36. get_user_tree_merkle_proof

Get Merkle proof for user tree (u64 parameters).

Method Name: qed_get_user_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "user_id": 12345
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
user_idu64The user ID

Response: See MerkleProofCore


37. get_user_tree_merkle_proof_f

Get Merkle proof for user tree (Field parameters).

Method Name: qed_get_user_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "user_id": "12345"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
user_idF (Field)The user ID as a field element

Response: See MerkleProofCore


Contract Function Tree Operations

38. get_contract_function_tree_root

Get contract function tree root (u64 parameters).

Method Name: qed_get_contract_function_tree_root

Request Parameters:

{
  "checkpoint_id": 100,
  "contract_id": 5
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
contract_idu32The contract ID

Response: See QHashOut


39. get_contract_function_tree_root_f

Get contract function tree root (Field parameters).

Method Name: qed_get_contract_function_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100",
  "contract_id": "5"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
contract_idF (Field)The contract ID as a field element

Response: See QHashOut


40. get_contract_function_tree_leaf_hash

Get contract function tree leaf hash (u64 parameters).

Method Name: qed_get_contract_function_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "contract_id": 5,
  "function_id": 3
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
contract_idu32The contract ID
function_idu32The function ID

Response: See QHashOut


41. get_contract_function_tree_leaf_hash_f

Get contract function tree leaf hash (Field parameters).

Method Name: qed_get_contract_function_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "contract_id": "5",
  "function_id": "3"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
contract_idF (Field)The contract ID as a field element
function_idF (Field)The function ID as a field element

Response: See QHashOut


42. get_contract_function_tree_merkle_proof

Get Merkle proof for contract function tree (u64 parameters).

Method Name: qed_get_contract_function_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "contract_id": 5,
  "function_id": 3
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
contract_idu32The contract ID
function_idu32The function ID

Response: See MerkleProofCore


43. get_contract_function_tree_merkle_proof_f

Get Merkle proof for contract function tree (Field parameters).

Method Name: qed_get_contract_function_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "contract_id": "5",
  "function_id": "3"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
contract_idF (Field)The contract ID as a field element
function_idF (Field)The function ID as a field element

Response: See MerkleProofCore


Contract Tree Operations

44. get_contract_tree_root

Get contract tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_contract_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


45. get_contract_tree_root_f

Get contract tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_contract_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


46. get_contract_tree_leaf_hash

Get contract tree leaf hash (u64 parameters).

Method Name: qed_get_contract_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "contract_id": 5
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
contract_idu32The contract ID

Response: See QHashOut


47. get_contract_tree_leaf_hash_f

Get contract tree leaf hash (Field parameters).

Method Name: qed_get_contract_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "contract_id": "5"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
contract_idF (Field)The contract ID as a field element

Response: See QHashOut


48. get_contract_tree_merkle_proof

Get Merkle proof for contract tree (u64 parameters).

Method Name: qed_get_contract_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "contract_id": 5
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
contract_idu32The contract ID

Response: See MerkleProofCore


49. get_contract_tree_merkle_proof_f

Get Merkle proof for contract tree (Field parameters).

Method Name: qed_get_contract_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "contract_id": "5"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
contract_idF (Field)The contract ID as a field element

Response: See MerkleProofCore


Deposit Tree Operations

50. get_deposit_tree_root

Get deposit tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_deposit_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


51. get_deposit_tree_root_f

Get deposit tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_deposit_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


52. get_deposit_tree_leaf_hash

Get deposit tree leaf hash (u64 parameters).

Method Name: qed_get_deposit_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "deposit_id": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
deposit_idu32The deposit ID

Response: See QHashOut


53. get_deposit_tree_leaf_hash_f

Get deposit tree leaf hash (Field parameters).

Method Name: qed_get_deposit_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "deposit_id": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
deposit_idF (Field)The deposit ID as a field element

Response: See QHashOut


54. get_deposit_tree_merkle_proof

Get Merkle proof for deposit tree (u64 parameters).

Method Name: qed_get_deposit_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "deposit_id": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
deposit_idu32The deposit ID

Response: See MerkleProofCore


55. get_deposit_tree_merkle_proof_f

Get Merkle proof for deposit tree (Field parameters).

Method Name: qed_get_deposit_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "deposit_id": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
deposit_idF (Field)The deposit ID as a field element

Response: See MerkleProofCore


Withdrawal Tree Operations

56. get_withdrawal_tree_root

Get withdrawal tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_withdrawal_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


57. get_withdrawal_tree_root_f

Get withdrawal tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_withdrawal_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


58. get_withdrawal_tree_leaf_hash

Get withdrawal tree leaf hash (u64 parameters).

Method Name: qed_get_withdrawal_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "withdrawal_id": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
withdrawal_idu32The withdrawal ID

Response: See QHashOut


59. get_withdrawal_tree_leaf_hash_f

Get withdrawal tree leaf hash (Field parameters).

Method Name: qed_get_withdrawal_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "withdrawal_id": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
withdrawal_idF (Field)The withdrawal ID as a field element

Response: See QHashOut


60. get_withdrawal_tree_merkle_proof

Get Merkle proof for withdrawal tree (u64 parameters).

Method Name: qed_get_withdrawal_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "withdrawal_id": 42
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
withdrawal_idu32The withdrawal ID

Response: See MerkleProofCore


61. get_withdrawal_tree_merkle_proof_f

Get Merkle proof for withdrawal tree (Field parameters).

Method Name: qed_get_withdrawal_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "withdrawal_id": "42"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
withdrawal_idF (Field)The withdrawal ID as a field element

Response: See MerkleProofCore


Checkpoint Tree Operations

62. get_latest_checkpoint_tree_root

Get the latest checkpoint tree root.

Method Name: qed_get_latest_checkpoint_tree_root

Request Parameters: None

Response: See QHashOut


63. get_checkpoint_tree_root

Get checkpoint tree root at a specific checkpoint (u64 parameter).

Method Name: qed_get_checkpoint_tree_root

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response: See QHashOut


64. get_checkpoint_tree_root_f

Get checkpoint tree root at a specific checkpoint (Field parameter).

Method Name: qed_get_checkpoint_tree_root_f

Request Parameters:

{
  "checkpoint_id": "100"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element

Response: See QHashOut


65. get_checkpoint_tree_leaf_hash

Get checkpoint tree leaf hash (u64 parameters).

Method Name: qed_get_checkpoint_tree_leaf_hash

Request Parameters:

{
  "checkpoint_id": 100,
  "leaf_checkpoint_id": 95
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
leaf_checkpoint_idu64The leaf checkpoint ID

Response: See QHashOut


66. get_checkpoint_tree_leaf_hash_f

Get checkpoint tree leaf hash (Field parameters).

Method Name: qed_get_checkpoint_tree_leaf_hash_f

Request Parameters:

{
  "checkpoint_id": "100",
  "leaf_checkpoint_id": "95"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
leaf_checkpoint_idF (Field)The leaf checkpoint ID as a field element

Response: See QHashOut


67. get_checkpoint_tree_merkle_proof

Get Merkle proof for checkpoint tree (u64 parameters).

Method Name: qed_get_checkpoint_tree_merkle_proof

Request Parameters:

{
  "checkpoint_id": 100,
  "leaf_checkpoint_id": 95
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
leaf_checkpoint_idu64The leaf checkpoint ID

Response: See MerkleProofCore


68. get_checkpoint_tree_merkle_proof_f

Get Merkle proof for checkpoint tree (Field parameters).

Method Name: qed_get_checkpoint_tree_merkle_proof_f

Request Parameters:

{
  "checkpoint_id": "100",
  "leaf_checkpoint_id": "95"
}
ParameterTypeDescription
checkpoint_idF (Field)The checkpoint ID as a field element
leaf_checkpoint_idF (Field)The leaf checkpoint ID as a field element

Response: See MerkleProofCore


Reward Proofs Generation

69. generate_batch_variable_height_reward_proofs

Generate batch variable height reward Merkle proofs for multiple job IDs.

Method Name: qed_generate_batch_variable_height_reward_proofs

Request Parameters:

{
  "checkpoint_id": 100,
  "job_ids": [
    {
      "topic": "GenerateStandardProof",
      "goal_id": 100,
      "slot_id": 5,
      "circuit_type": "GUTATwoEndCap",
      "group_id": 1,
      "sub_group_id": 0,
      "task_index": 0,
      "data_type": "InputWitness",
      "data_index": 0
    }
  ]
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID
job_idsVec<QProvingJobDataID>Array of proving job data IDs

Response:

{
  "result": [
    [
      {
        "top_siblings": [...],
        "sibling_branch": "0x...",
        "reward_leaf": "0x...",
        "proof_height": "5",
        "index": "42"
      },
      {
        "topic": "GenerateStandardProof",
        "goal_id": 100,
        ...
      }
    ]
  ]
}
FieldTypeDescription
resultVec<(VariableHeightRewardMerkleProof, QProvingJobDataID)>Array of tuples containing proofs and job IDs

70. get_graphviz

Get GraphViz representation of the job dependency graph at a specific checkpoint.

Method Name: qed_get_graphviz

Request Parameters:

{
  "checkpoint_id": 100
}
ParameterTypeDescription
checkpoint_idu64The checkpoint ID

Response:

{
  "result": "digraph G {\n  node1 -> node2;\n  ...\n}"
}
FieldTypeDescription
resultStringGraphViz DOT format string

Example:

curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_graphviz",
    "params": [100],
    "id": 1
  }' | jq -r '.result' | dot -Tpng > graph.png

Realm Status Operations

71. get_current_realm_status_on_coordinator

Get current realm status on the coordinator.

Method Name: qed_get_current_realm_status_on_coordinator

Request Parameters:

{
  "realm_id": 1
}
ParameterTypeDescription
realm_idu64Realm identifier

Response: See BasicRealmStatusOnCoordinator

Example Response:

{
  "result": {
    "realm_id": 1,
    "checkpoint_id": 100,
    "realm_root_hash": "0x..."
  }
}

72. get_current_checkpoint_id

Get current coordinator checkpoint ID.

Method Name: qed_get_current_checkpoint_id

Request Parameters: None

Response:

{
  "result": 100
}

73. get_latest_block_updates_from_coordinator

Get latest block updates from coordinator for a realm within a checkpoint range.

Method Name: qed_get_latest_block_updates_from_coordinator

Request Parameters:

{
  "realm_id": 1,
  "from_checkpoint": 95,
  "to_checkpoint": 100
}
ParameterTypeDescription
realm_idu32Realm identifier
from_checkpointu64Starting checkpoint ID (inclusive)
to_checkpointu64Ending checkpoint ID (inclusive)

Response:

{
  "result": [
    {
      "latest_checkpoint_id": 100,
      "description": null,
      "source_coordinator_edge_id": null,
      "sync_timestamp": 1234567890,
      "compact": {...},
      "realm_root": "0x..."
    }
  ]
}
FieldTypeDescription
resultVec<GlobalBlockUpdateFromCoordinator<F>>Array of block updates

74. wait_until_coordinator_completed

Wait until coordinator completes a specific checkpoint for a realm.

Method Name: qed_wait_until_coordinator_completed

Request Parameters:

{
  "realm_id": 1,
  "checkpoint_id": 100
}
ParameterTypeDescription
realm_idu64Realm identifier
checkpoint_idu64Checkpoint ID to wait for

Response: See GlobalBlockUpdateFromCoordinator


Data Structures

QHashOut

A hash output wrapper for Plonky2 field elements.

Structure:

#![allow(unused)]
fn main() {
pub struct QHashOut<F: Field>(pub HashOut<F>);
}

JSON Representation:

"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"

Description:

  • Wraps a Plonky2 HashOut<F> containing 4 field elements
  • Serialized as a hexadecimal string (32 bytes)
  • Represents a 256-bit hash value

QEDL2BlockState

L2 block state information at a specific checkpoint.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDL2BlockState {
    pub checkpoint_id: u64,
    pub next_add_withdrawal_id: u64,
    pub next_process_withdrawal_id: u64,
    pub next_deposit_id: u64,
    pub total_deposits_claimed_epoch: u64,
    pub next_user_id: u64,
    pub end_balance: u64,
    pub next_contract_id: u32,
}
}

Fields:

FieldTypeDescription
checkpoint_idu64The checkpoint identifier
next_add_withdrawal_idu64Next withdrawal ID to be added
next_process_withdrawal_idu64Next withdrawal ID to be processed
next_deposit_idu64Next deposit ID
total_deposits_claimed_epochu64Total deposits claimed in current epoch
next_user_idu64Next user ID to be assigned
end_balanceu64Ending balance at this checkpoint
next_contract_idu32Next contract ID to be assigned

Example:

{
  "checkpoint_id": 100,
  "next_add_withdrawal_id": 50,
  "next_process_withdrawal_id": 45,
  "next_deposit_id": 200,
  "total_deposits_claimed_epoch": 180,
  "next_user_id": 1000,
  "end_balance": 5000000,
  "next_contract_id": 25
}

QEDCheckpointLeaf

Checkpoint leaf data containing global chain root and statistics.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDCheckpointLeaf<F: RichField> {
    pub global_chain_root: QHashOut<F>,
    pub stats: QEDCheckpointLeafStats<F>,
}
}

Fields:

FieldTypeDescription
global_chain_rootQHashOut<F>Global chain state root hash
statsQEDCheckpointLeafStats<F>Checkpoint statistics

QEDCheckpointGlobalStateRoots

Global state roots at a specific checkpoint.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDCheckpointGlobalStateRoots<F: RichField> {
    pub contract_tree_root: QHashOut<F>,
    pub deposit_tree_root: QHashOut<F>,
    pub user_tree_root: QHashOut<F>,
    pub withdrawal_tree_root: QHashOut<F>,
    pub user_registration_tree_root: QHashOut<F>,
}
}

Fields:

FieldTypeDescription
contract_tree_rootQHashOut<F>Root of the contract tree
deposit_tree_rootQHashOut<F>Root of the deposit tree
user_tree_rootQHashOut<F>Root of the user tree
withdrawal_tree_rootQHashOut<F>Root of the withdrawal tree
user_registration_tree_rootQHashOut<F>Root of the user registration tree

Example:

{
  "contract_tree_root": "0x1234...",
  "deposit_tree_root": "0x5678...",
  "user_tree_root": "0x9abc...",
  "withdrawal_tree_root": "0xdef0...",
  "user_registration_tree_root": "0x1234..."
}

QEDUserLeaf

User leaf data containing user state information.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDUserLeaf<F: RichField> {
    pub public_key: QHashOut<F>,
    pub user_state_tree_root: QHashOut<F>,
    pub balance: F,
    pub nonce: F,
    pub last_checkpoint_id: F,
    pub event_index: F,
    pub user_id: F,
}
}

Fields:

FieldTypeDescription
public_keyQHashOut<F>User's public key hash
user_state_tree_rootQHashOut<F>Root of user's state tree
balanceFUser's balance
nonceFUser's transaction nonce
last_checkpoint_idFLast checkpoint ID where user was updated
event_indexFEvent index for this user
user_idFUser identifier

Example:

{
  "public_key": "0x1234...",
  "user_state_tree_root": "0x5678...",
  "balance": "1000000",
  "nonce": "42",
  "last_checkpoint_id": "100",
  "event_index": "15",
  "user_id": "12345"
}

MerkleProofCore

Generic Merkle proof structure.

Structure:

#![allow(unused)]
fn main() {
pub struct MerkleProofCore<Hash: PartialEq + Copy> {
    pub root: Hash,
    pub value: Hash,
    pub index: u64,
    pub siblings: Vec<Hash>,
}
}

Fields:

FieldTypeDescription
rootHashMerkle tree root hash
valueHashLeaf value being proven
indexu64Leaf index in the tree
siblingsVec<Hash>Sibling hashes along the path

Example:

{
  "root": "0x1234...",
  "value": "0x5678...",
  "index": 42,
  "siblings": [
    "0x9abc...",
    "0xdef0...",
    "0x1234..."
  ]
}

ZKPublicKeyInfo

Zero-knowledge public key information.

Structure:

#![allow(unused)]
fn main() {
pub struct ZKPublicKeyInfo<F: RichField> {
    pub fingerprint: QHashOut<F>,
    pub public_key_param: QHashOut<F>,
}
}

Fields:

FieldTypeDescription
fingerprintQHashOut<F>Public key fingerprint
public_key_paramQHashOut<F>Public key parameter

Example:

{
  "fingerprint": "0x1234...",
  "public_key_param": "0x5678..."
}

QBCDeployContract

Contract deployment command.

Structure:

#![allow(unused)]
fn main() {
pub struct QBCDeployContract<F: RichField> {
    pub deployer: QHashOut<F>,
    pub code_definition: ContractCodeDefinition,
    pub function_whitelist: Vec<QHashOut<F>>,
}
}

Fields:

FieldTypeDescription
deployerQHashOut<F>Deployer's public key hash
code_definitionContractCodeDefinitionContract code definition
function_whitelistVec<QHashOut<F>>Function whitelist hashes

Example:

{
  "deployer": "0x1234...",
  "code_definition": {
    "state_tree_height": 10,
    "functions": [...]
  },
  "function_whitelist": ["0x5678..."]
}

ContractCodeDefinition

Contract code definition structure.

Structure:

#![allow(unused)]
fn main() {
pub struct ContractCodeDefinition {
    pub state_tree_height: u16,
    pub functions: Vec<ContractFunctionCodeDefinition>,
}

pub struct ContractFunctionCodeDefinition {
    pub method_id: u32,
    pub num_inputs: u32,
    pub num_outputs: u32,
    pub vm_type: u32,
    pub code: Vec<u8>,
}
}

Fields:

FieldTypeDescription
state_tree_heightu16Height of the contract state tree
functionsVec<ContractFunctionCodeDefinition>Contract functions

Function Fields:

FieldTypeDescription
method_idu32Function method ID
num_inputsu32Number of input parameters
num_outputsu32Number of output parameters
vm_typeu32VM type identifier
codeVec<u8>Function bytecode

Example:

{
  "state_tree_height": 10,
  "functions": [
    {
      "method_id": 12345678,
      "num_inputs": 2,
      "num_outputs": 1,
      "vm_type": 1,
      "code": [0x01, 0x02, ...]
    }
  ]
}

QEDContractLeaf

Contract leaf data.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDContractLeaf<F: RichField> {
    pub deployer: QHashOut<F>,
    pub function_tree_root: QHashOut<F>,
    pub state_tree_height: F,
}
}

Fields:

FieldTypeDescription
deployerQHashOut<F>Deployer's public key hash
function_tree_rootQHashOut<F>Root of the function tree
state_tree_heightFHeight of the state tree

Example:

{
  "deployer": "0x1234...",
  "function_tree_root": "0x5678...",
  "state_tree_height": "10"
}

CheckpointSyncInfo

Checkpoint synchronization information.

Structure:

#![allow(unused)]
fn main() {
pub struct CheckpointSyncInfo<F: RichField> {
    pub latest_checkpoint_id: u64,
    pub description: Option<String>,
    pub source_coordinator_edge_id: Option<String>,
    pub sync_timestamp: u64,
    pub compact: QEDCheckpointSyncInfoCompact<F>,
    pub realm_root: QHashOut<F>,
}
}

Fields:

FieldTypeDescription
latest_checkpoint_idu64Latest checkpoint ID
descriptionOption<String>Optional description
source_coordinator_edge_idOption<String>Source coordinator ID
sync_timestampu64Synchronization timestamp
compactQEDCheckpointSyncInfoCompact<F>Compact sync info
realm_rootQHashOut<F>Realm root hash

QEDCheckpointSyncInfoCompact

Compact checkpoint synchronization information.

Structure:

#![allow(unused)]
fn main() {
pub struct QEDCheckpointSyncInfoCompact<F: RichField> {
    pub l2_block_state: QEDL2BlockState,
    pub stats: QEDCheckpointLeafStats<F>,
    pub state_roots: QEDCheckpointGlobalStateRoots<F>,
    pub checkpoint_tree_update_siblings: Vec<QHashOut<F>>,
    pub regsitered_users_start_pivot_siblings: Vec<QHashOut<F>>,
    pub registered_users: Vec<ZKPublicKeyInfo<F>>,
    pub old_checkpoint_leaf_hash: QHashOut<F>,
    pub slot: u64,
}
}

Fields:

FieldTypeDescription
l2_block_stateQEDL2BlockStateL2 block state
statsQEDCheckpointLeafStats<F>Checkpoint statistics
state_rootsQEDCheckpointGlobalStateRoots<F>Global state roots
checkpoint_tree_update_siblingsVec<QHashOut<F>>Checkpoint tree update siblings
regsitered_users_start_pivot_siblingsVec<QHashOut<F>>User registration pivot siblings
registered_usersVec<ZKPublicKeyInfo<F>>Newly registered users
old_checkpoint_leaf_hashQHashOut<F>Previous checkpoint leaf hash
slotu64Slot number

SubmitGUTARealmResultAPINoProofInput

GUTA submission input without proof.

Structure:

#![allow(unused)]
fn main() {
pub struct SubmitGUTARealmResultAPINoProofInput<F: RichField> {
    pub realm_id: u64,
    pub checkpoint_id: u64,
    pub guta_stats: GUTAStats<F>,
    pub top_line_proof: DeltaMerkleProofCore<QHashOut<F>>,
    pub checkpoint_tree_root: QHashOut<F>,
    pub proof_id: QProvingJobDataID,
}
}

Fields:

FieldTypeDescription
realm_idu64Realm identifier
checkpoint_idu64Checkpoint ID
guta_statsGUTAStats<F>GUTA statistics
top_line_proofDeltaMerkleProofCore<QHashOut<F>>Top-line Merkle proof
checkpoint_tree_rootQHashOut<F>Checkpoint tree root
proof_idQProvingJobDataIDProving job ID

QProvingJobDataID

Proving job data identifier.

Structure:

#![allow(unused)]
fn main() {
pub struct QProvingJobDataID {
    pub topic: QJobTopic,
    pub goal_id: u64,
    pub slot_id: u64,
    pub circuit_type: ProvingJobCircuitType,
    pub group_id: u32,
    pub sub_group_id: u32,
    pub task_index: u32,
    pub data_type: ProvingJobDataType,
    pub data_index: u8,
}
}

Fields:

FieldTypeDescription
topicQJobTopicJob topic
goal_idu64Goal identifier (usually checkpoint ID)
slot_idu64Slot identifier
circuit_typeProvingJobCircuitTypeType of circuit
group_idu32Group identifier
sub_group_idu32Sub-group identifier
task_indexu32Task index within the group
data_typeProvingJobDataTypeData type
data_indexu8Data index

Serialization: Serialized as a 32-byte array.


VariableHeightRewardMerkleProof

Variable height Merkle proof for reward distribution.

Structure:

#![allow(unused)]
fn main() {
pub struct VariableHeightRewardMerkleProof {
    pub top_siblings: Vec<VariableHeightProofSibling>,
    pub sibling_branch: QHashOut<F>,
    pub reward_leaf: QHashOut<F>,
    pub proof_height: F,
    pub index: F,
}

pub struct VariableHeightProofSibling {
    pub sibling_branch: QHashOut<F>,
    pub sibling_reward_leaf: QHashOut<F>,
}
}

Fields:

FieldTypeDescription
top_siblingsVec<VariableHeightProofSibling>Siblings at each level
sibling_branchQHashOut<F>Sibling branch hash
reward_leafQHashOut<F>Reward leaf hash
proof_heightFHeight of the proof
indexFIndex in the tree

BasicRealmStatusOnCoordinator

Basic realm status on the coordinator.

Structure:

#![allow(unused)]
fn main() {
pub struct BasicRealmStatusOnCoordinator<F: RichField> {
    pub realm_id: u64,
    pub checkpoint_id: u64,
    pub realm_root_hash: QHashOut<F>,
}
}

Fields:

FieldTypeDescription
realm_idu64Realm identifier
checkpoint_idu64Current checkpoint ID
realm_root_hashQHashOut<F>Realm root hash

Example:

{
  "realm_id": 1,
  "checkpoint_id": 100,
  "realm_root_hash": "0x1234..."
}

GlobalBlockUpdateFromCoordinator

Type alias for CheckpointSyncInfo<F>.

#![allow(unused)]
fn main() {
pub type GlobalBlockUpdateFromCoordinator<F> = CheckpointSyncInfo<F>;
}

See CheckpointSyncInfo for structure details.


RealmDataForCoordinator

Realm data submitted to coordinator.

Structure:

#![allow(unused)]
fn main() {
pub struct RealmDataForCoordinator<F: RichField> {
    pub header: RealmDataForCoordinatorHeader<F>,
    pub proof: Vec<u8>,
}

pub struct RealmDataForCoordinatorHeader<F: RichField> {
    pub realm_id: u64,
    pub checkpoint_id: u64,
    pub start_realm_root: QHashOut<F>,
    pub end_realm_root: QHashOut<F>,
    pub guta_stats: GUTAStats<F>,
    pub root_job_id: QProvingJobDataID,
}
}

Fields:

FieldTypeDescription
headerRealmDataForCoordinatorHeader<F>Header data
proofVec<u8>Serialized proof

Header Fields:

FieldTypeDescription
realm_idu64Realm identifier
checkpoint_idu64Checkpoint ID
start_realm_rootQHashOut<F>Starting realm root
end_realm_rootQHashOut<F>Ending realm root
guta_statsGUTAStats<F>GUTA statistics
root_job_idQProvingJobDataIDRoot job ID

Field Type Notes

Throughout this API, F represents a field element type (typically GoldilocksField).

Field Element Conversion:

  • Methods with _f suffix accept field elements as strings (e.g., "12345")
  • Methods without _f suffix accept native types (e.g., 12345)
  • Field elements are internally represented as u64 values in the Goldilocks field

Best Practices:

  • Use u64 variants for better performance when possible
  • Use Field variants when working with circuit inputs/outputs
  • Always validate checkpoint_id exists before querying
  • Handle RPC errors gracefully (missing data, invalid parameters)

Error Handling

All RPC methods return RpcResult<T> which can contain errors in the following format:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32000,
    "message": "Error description"
  },
  "id": 1
}

Common Error Codes:

  • -32000: Server error (checkpoint not found, data unavailable)
  • -32602: Invalid parameters
  • -32603: Internal error
  • -32001: Not found error

Usage Examples

Complete User Registration Workflow

# 1. Register a new user
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_register_user",
    "params": [{
      "fingerprint": "0x...",
      "public_key_param": "0x..."
    }],
    "id": 1
  }'

# 2. Get user ID by public key
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_user_id",
    "params": ["0x..."],
    "id": 2
  }'

# 3. Get user leaf data
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_user_leaf_data",
    "params": [100, 12345],
    "id": 3
  }'

Contract Deployment Workflow

# 1. Deploy contract
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_deploy_contract",
    "params": [{
      "deployer": "0x...",
      "code_definition": {
        "state_tree_height": 10,
        "functions": [...]
      },
      "function_whitelist": [...]
    }],
    "id": 1
  }'

# 2. Get contract leaf data
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_contract_leaf_data",
    "params": [5],
    "id": 2
  }'

# 3. Get contract code definition
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_contract_code_definition",
    "params": [5],
    "id": 3
  }'

Checkpoint Query Workflow

# 1. Get latest checkpoint ID
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_latest_checkpoint_id",
    "params": [],
    "id": 1
  }'

# 2. Get checkpoint leaf data
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_checkpoint_leaf_data",
    "params": [100],
    "id": 2
  }'

# 3. Get checkpoint global state roots
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "qed_get_checkpoint_global_state_roots",
    "params": [100],
    "id": 3
  }'

Method Summary

#Method NameParametersReturnsDescription
1register_userpublic_keyStringRegister new user
2get_user_idpublic_keyu64Get user ID
3deploy_contractdeploy_contractStringDeploy contract
4-5get_contract_leaf_data[_f]contract_idQEDContractLeafGet contract leaf
6-7get_contract_code_definition[_f]contract_idContractCodeDefinitionGet contract code
8build_blockNoneStringTrigger block building
9-11submit_guta[_v1]input, proof, realm_idString\|voidSubmit GUTA
12-14[get_]latest_checkpoint[_id]NoneLatestCheckpointResponse\|u64Get latest checkpoint
15-16get_checkpoint_leaf_data[_f]checkpoint_idQEDCheckpointLeafGet checkpoint leaf
17get_checkpoint_global_state_rootscheckpoint_idGlobalStateRootsGet global state roots
18-19get_checkpoint_sync_info[_compact]realm_id?, checkpoint_idCheckpointSyncInfoGet sync info
20-22get_[latest_]l2_block_state[_f][checkpoint_id]QEDL2BlockStateGet L2 block state
23-28get_user_registration_tree_*[_f]VariousQHashOut\|ProofRegistration tree ops
29-37get_user_tree_*[_f]VariousQHashOut\|Proof\|UserLeafUser tree operations
38-43get_contract_function_tree_*[_f]VariousQHashOut\|ProofFunction tree ops
44-49get_contract_tree_*[_f]VariousQHashOut\|ProofContract tree ops
50-55get_deposit_tree_*[_f]VariousQHashOut\|ProofDeposit tree ops
56-61get_withdrawal_tree_*[_f]VariousQHashOut\|ProofWithdrawal tree ops
62-68get_[latest_]checkpoint_tree_*[_f]VariousQHashOut\|ProofCheckpoint tree ops
69generate_batch_variable_height_reward_proofscheckpoint_id, job_idsVec<(Proof, JobID)>Batch reward proofs
70get_graphvizcheckpoint_idStringGet graph visualization
71get_current_realm_status_on_coordinatorrealm_idBasicRealmStatusGet realm status
72get_current_checkpoint_idNoneu64Get current checkpoint
73get_latest_block_updates_from_coordinatorrealm_id, from, toVec<BlockUpdate>Get block updates
74wait_until_coordinator_completedrealm_id, checkpoint_idBlockUpdateWait for completion

Document Version: 1.0
Last Updated: 2025-10-24
Total RPC Methods: 74