Nubit Validator RPC

Note: We are in the Alpha Testnet stage (Chain ID: nubit-alphatestnet-1), so the API may undergo incompatible changes in the future. If you encounter any issues, please join our Discord to get in touch with the Nubit Team.


OpenRPC 1.2.6

To learn how to run a Nubit validator, please refer to Run a Validator.

The Nubit Validator API provides a collection of RPC methods to interact with the services offered by the Nubit Validator. It adheres to the CometBFT RPC standard for these methods. For more details on the CometBFT RPC standard, please visit CometBFT RPC Documentation.


Additional RPC methods

In addition to the CometBFT RPC standard methods, the Nubit Validator API also introduces additional methods, which are detailed below.

  • API version: v0.1.0-rc.1

  • Base URI path: /

  • Method: POST

  • Headers

NameValue

Content-Type

application/json

signed_block

Fetches the set of transactions at a specified height and all the relevant data to verify the transactions (i.e. using light client verification).

func SignedBlock(height int64) (*ctypes.ResultSignedBlock)
{
  "jsonrpc": "2.0",
  "method": "signed_block",
  "params": ["10"],
  "id": 0
}

Gets block header at a given height. If no height is provided, it will fetch the latest header.

func Header(height int64) *ctypes.ResultHeader
{
  "jsonrpc": "2.0",
  "method": "header",
  "params": ["10"],
  "id": 0
}

header_by_hash

Gets header by hash.

func HeaderByHash(hash bytes.HexBytes) *ctypes.ResultHeader
{
  "jsonrpc": "2.0",
  "method": "header_by_hash",
  "params": [
    "3ACF6A9F214E94EC5D95ED6CB734FD8B641B53710185FD80411CB9234A58AA02"
  ],
  "id": 0
}

data_commitment

Collects the data roots over a provided ordered range of blocks, and then creates a new Merkle root of those data roots. The range is end-exclusive.

func DataCommitment(
    start uint64,
    end uint64,
) *ctypes.ResultDataCommitment
{
  "jsonrpc": "2.0",
  "method": "data_commitment",
  "params": ["3", "10"],
  "id": 0
}

prove_shares

Creates an NMT proof for a set of shares to a set of rows. It is end-exclusive.

func ProveShares(
	height int64,
	startShare uint64,
	endShare uint64,
) types.ShareProof
{
  "jsonrpc": "2.0",
  "method": "prove_shares",
  "params": [
    "100",  // Valid block height, ensure it's within the current blockchain height range
    "0",    // Start share
    "1"     // End share, ensure it's less than or equal to the number of shares in the block
  ],
  "id": 0
}

data_root_inclusion_proof

Creates an inclusion proof for the data root of block height height in the set of blocks defined by start and end. The range is end-exclusive.

func DataRootInclusionProof(
	height int64,
	start,
	end uint64,
) *ctypes.ResultDataRootInclusionProof
{
  "jsonrpc": "2.0",
  "method": "data_root_inclusion_proof",
  "params": [
    "5",  // The block height for which the data root inclusion proof is being requested
    "2",  // The start block height for the inclusion proof range
    "10"  // The end block height for the inclusion proof range (exclusive)
  ],
  "id": 0
}

Last updated