Nubit DA Node APIs

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.


Nubit Node API Example

Here is an example of how to make a Node API call using curl. This example demonstrates how to retrieve the sync state of the header. Replace <YOUR_API_KEY> with your actual API key and <YOUR_NODE_ENDPOINT> with the endpoint of the node you started (for example, 127.0.0.1:26658).

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer <YOUR_API_KEY>" -d '{"id": 1, "jsonrpc": "2.0", "method": "header.SyncState", "params": []}' <YOUR_NODE_ENDPOINT>

This command will send a POST request to the specified endpoint with the necessary headers and JSON payload. The Authorization header contains the Bearer token, which is your API key, and the payload specifies the RPC method header.SyncState with an empty parameter list.


OpenRPC 1.2.6

The Nubit Node API is the collection of RPC methods that can be used to interact with the services provided by Nubit Data Availability Nodes.

  • API version: v0.1.0-rc.1

  • Base URI path: /

  • Method: POST

Headers

NameValue

Content-Type

application/json

BLOB

Get

Get retrieves the blob by KZG commitment under the given namespace and height.

Auth level: read

func Get(
	height uint64,
	namespace share.Namespace,
	commitment blob.KzgCommitment,
) *blob.Blob
{
  "jsonrpc": "2.0",
  "method": "blob.Get",
  "params": [
    42,
    "AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA=",
    "Bw=="
  ],
  "id": 0
}

GetAll

GetAll returns all blobs at the given height under the given namespaces.

Auth level: read

func GetAll(
	height uint64,
	namespaces []share.Namespace,
) []*blob.Blob
{
  "jsonrpc": "2.0",
  "method": "blob.GetAll",
  "params": [
    42,
    [
      "AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA="
    ]
  ],
  "id": 0
}

GetProof

GetProof retrieves proofs in the given namespaces at the given height by commitment.

Auth level: read

func GetProof(
	height uint64,
	namespace share.Namespace,
	commitment blob.KzgCommitment,
) *blob.Proof
{
  "jsonrpc": "2.0",
  "method": "blob.GetProof",
  "params": [
    42,
    "AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA=",
    "Bw=="
  ],
  "id": 0
}

Included

Included checks whether a blob's given commitment(Merkle subtree root) is included at given height and under the namespace.

Auth level: read

func Included(
	height uint64,
	namespace share.Namespace,
	proof *blob.Proof,
	commitment blob.KzgCommitment,
) bool
{
  "jsonrpc": "2.0",
  "method": "blob.Included",
  "params": [
    42,
    "AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA=",
    [
      {
        "end": 15,
        "inclusion_or_absence": true,
        "open_end": {
          "index": 15,
          "proof": "gniKhnjrWbFG15O2a795/oEczV+xCXeho3zw6GV8W9OKA3eAqeU3FRVi5a+QcWU7",
          "value": "AAAAAAAAAAAAAAAAAAAAAAAAADEyMzQ1Njc4OTAAAAAAAAAAAAAAAAAAAAAAAAAAMTIzNDU2Nzg5MAABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ=="
        },
        "open_post_index": {
          "index": 16,
          "proof": "g7rrqOPnk4zsgq4S95DWAenHg0zYnOD6VaKo+MGbXG+BOedF1SNLjbusbz3NbTN/",
          "value": "//////////////////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAfXpxe3B3fH90RnV0dN89CwsL7UkU5OaRFqBeuwnzFGc8VKvZgAx62brz2XriGHoP2OODkCZW83/LuvPZ2ENF9ZRUq9mADBiBupEmCFFU49hvJ+In4mur46smgSLJqwh/VCb2ySJvDCfY2A26v0OHCwsLCwsLCwsLCwsLCwsLCwsLCxhR9iKFzGuvCL9TQrFKQvcZL9q87TwsLSJaMq/Icw1R4uorDG9wWc26WiMUfS12hvXLrAtDRPWD9Vb1ad1+89gd89h6fn8mkQzzetgNfpFRhcxuGHqDq9l8DSZDUPW+QjWBuSD6M8Gyx49a75IETxt8ir7Ql3jWGck0/svbar0SQ5b15RusveVDQ/WG9ZarVKvZQ5aFvxhrrRDTzlMl1o3jiGu5oc2JoHouUzRjBz0UpYLMiFw7MPk6dDeT+vLKFUccS9uvgXqKbGf5azrTB7Kv0VzLLhEw4jcTEZpx90Os5VOWkka4kwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCw=="
        },
        "open_pre_index": {
          "index": 1,
          "proof": "qm4Yt72dEqxKQ58lkke6RWbhTU69vnCwkXuzzP4SvYYOE4QwxZ1gqzlJD6LVu4Ij",
          "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAEAAAFWAAAAJtQCCsgCCpsBCpgBCh0vbnViaX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BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQ=="
        },
        "post_index": 16,
        "pre_index": 1,
        "start": 2
      }
    ],
    "Bw=="
  ],
  "id": 0
}

Submit

Submit sends Blobs and reports the height in which they were included. Allows sending multiple Blobs atomically synchronously. Uses default wallet registered on the Node.

Auth level: write

func Submit(
	blobs []*blob.Blob,
	gasPrice blob.GasPrice,
) uint64
{
  "jsonrpc": "2.0",
  "method": "blob.Submit",
  "params": [
    [
      {
        "commitment": "20qrISWy41i+3YG4pGbmtw3BbsK875MrcRX8bTgJOMk=",
        "data": "VGhpcyBpcyBhbiBleGFtcGxlIG9mIHNvbWUgYmxvYiBkYXRh",
        "index": -1,
        "namespace": "AAAAAAAAAAAAAAAAAAAAAAAAAAECAwQFBgcICRA=",
        "share_version": 0
      }
    ],
    0.002
  ],
  "id": 0
}

DAS

SamplingStats

SamplingStats returns the current statistics over the DA sampling process.

Auth level: read

func SamplingStats() das.SamplingStats
{
  "jsonrpc": "2.0",
  "method": "das.SamplingStats",
  "params": null,
  "id": 0
}

WaitCatchUp

WaitCatchUp blocks until DASer finishes catching up to the network head.

Auth level: read

func WaitCatchUp() 
{
  "jsonrpc": "2.0",
  "method": "das.WaitCatchUp",
  "params": null,
  "id": 0
}

GetBtcHeight

GetBtcHeight returns the anchored Bitcoin height by the height of the Nubit DA Chain. Allow modular Apps to link Bitcoin Chain and Nubit DA Chain via consensus.

Auth level: read

func GetBtcHeight(nubitHeight uint64) uint64
{
  "jsonrpc": "2.0",
  "method": "header.GetBtcHeight",
  "params": [
    42
  ],
  "id": 0
}

GetByHash

GetByHash returns the header of the given hash from the node's header store.

Auth level: read

func GetByHash(hash libhead.Hash) *header.ExtendedHeader
{
  "jsonrpc": "2.0",
  "method": "header.GetByHash",
  "params": [
    "07"
  ],
  "id": 0
}

GetByHeight

GetByHeight returns the ExtendedHeader at the given height if it is currently available.

Auth level: read

func GetByHeight(u uint64) *header.ExtendedHeader
{
  "jsonrpc": "2.0",
  "method": "header.GetByHeight",
  "params": [
    42
  ],
  "id": 0
}

GetHeightRangeAtBtcHeight

GetHeightRangeAtBtcHeight returns the anchored Nubit height range by the height of the Bitcoin Chain. Allow modular Apps to link Bitcoin Chain and Nubit DA Chain via consensus.

Auth level: read

func GetHeightRangeAtBtcHeight(btcHeight uint64) []*header.ExtendedHeader
{
  "jsonrpc": "2.0",
  "method": "header.GetHeightRangeAtBtcHeight",
  "params": [
    42
  ],
  "id": 0
}

GetRangeByHeight

GetRangeByHeight returns the given range (from:to) of ExtendedHeaders from the node's header store and verifies that the returned headers are adjacent to each other.

Auth level: read

func GetRangeByHeight(
	from *header.ExtendedHeader,
	to uint64,
) []*header.ExtendedHeader
{
  "jsonrpc": "2.0",
  "method": "header.GetRangeByHeight",
  "params": [
    {
      "commit": {
        "block_id": {
          "hash": "A7F6B1CF33313121539206754A73FDC22ADA48C4AA8C4BB4F707ED2E089E59D3",
          "parts": {
            "hash": "6634FE1E1DDDCB9914ACE81F146013986F5FDA03A8F1C16DC5ECA0D9B0E08FBC",
            "total": 1
          }
        },
        "height": 67374,
        "round": 0,
        "signatures": [
          {
            "block_id_flag": 2,
            "signature": "HyR/uRIUNc5GNqQteZyrVjJM47SI9sRAgrLsNqJDls3AzbvHUfN4zzWyw0afyEvNm98Bm2GIoJoZC5D8oQvdBA==",
            "timestamp": "2023-02-25T12:10:38.130121476Z",
            "validator_address": "57DC09D28388DBF977CFC30EF50BE8B644CCC1FA"
          }
        ]
      },
      "dah": {
        "column_roots": [
          "//////////7//////////ql+/VFmJ8PWE9BcjrTDLrY/hzVeGdzFCpfEhiXDXZmt",
          "/////////////////////zHeGnUtPJn8QyPpePSYl4qRVrcUvG2fwptyoA85Myik"
        ],
        "row_roots": [
          "//////////7//////////ql+/VFmJ8PWE9BcjrTDLrY/hzVeGdzFCpfEhiXDXZmt",
          "/////////////////////zHeGnUtPJn8QyPpePSYl4qRVrcUvG2fwptyoA85Myik"
        ]
      },
      "header": {
        "app_hash": "1FC70854A185737C7FD720FCCE9167876EE4B9ABE23DB1EBB8C552D3E3978435",
        "chain_id": "testnet",
        "consensus_hash": "048091BC7DDC283F77BFBF91D73C44DA58C3DF8A9CBC867405D8B7F3DAADA22F",
        "data_hash": "257760461993F8F197B421EC7435F3C36C3734923E3DA9A42DC73B05F07B3D08",
        "evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
        "height": "67374",
        "last_block_id": {
          "hash": "47A2C7758760988500B2F043D3903BBBF1C8B383CA33CF7056AA45E22055663E",
          "parts": {
            "hash": "33B012F244E27672169DD3D62CDBC92DA9486E410A5530F41FE6A890D8E2EE42",
            "total": 1
          }
        },
        "last_commit_hash": "888D47F5E9473501C99F2B6136B6B9FFBC9D1CD2F54002BCD5DF002FFEF0A83D",
        "last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
        "next_validators_hash": "883A0C92B8D976312B249C1397E73CF2981A9EB715717CBEE3800B8380C22C1D",
        "proposer_address": "57DC09D28388DBF977CFC30EF50BE8B644CCC1FA",
        "time": "2023-02-25T12:10:28.067566292Z",
        "validators_hash": "883A0C92B8D976312B249C1397E73CF2981A9EB715717CBEE3800B8380C22C1D",
        "version": {
          "block": "11"
        }
      },
      "validator_set": {
        "proposer": {
          "address": "57DC09D28388DBF977CFC30EF50BE8B644CCC1FA",
          "proposer_priority": "0",
          "pub_key": {
            "type": "tendermint/PubKeyEd25519",
            "value": "aoB4xU9//HAqOP9ciyp0+PTdZxt/UGKgZOabU6JxW8o="
          },
          "voting_power": "5000000000"
        },
        "validators": [
          {
            "address": "57DC09D28388DBF977CFC30EF50BE8B644CCC1FA",
            "proposer_priority": "0",
            "pub_key": {
              "type": "tendermint/PubKeyEd25519",
              "value": "aoB4xU9//HAqOP9ciyp0+PTdZxt/UGKgZOabU6JxW8o="
            },
            "voting_power": "5000000000"
          }
        ]
      }
    },
    42
  ],
  "id": 0
}

LocalHead

LocalHead returns the ExtendedHeader of the chain head.

Auth level: read

func LocalHead() *header.ExtendedHeader
{
  "jsonrpc": "2.0",
  "method": "header.LocalHead",
  "params": null,
  "id": 0
}

NetworkHead

NetworkHead provides the Syncer's view of the current network head.

Auth level: read

func NetworkHead() *header.ExtendedHeader
{
  "jsonrpc": "2.0",
  "method": "header.NetworkHead",
  "params": null,
  "id": 0
}