For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

0G — Information, Transactions, ABCI, Methods (2/3)

API reference for 0G. All methods ->

Part 2 of 3: 1 · 2 · 3

Information

dump_consensus_state

Retrieves consensus state.

Not safe to call from inside the ABCI application during a block execution.

Parameters


None.

Returns

A complete consensus state. See the Vote string description.

Request example

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "dump_consensus_state",
"params": [],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"round_state": {
"height": "13211550",
"round": 0,
"step": 1,
"start_time": "2024-12-23T13:24:44.738595111Z",
"commit_time": "2024-12-23T13:24:39.738595111Z",
"validators": {
"validators": [
{
"address": "279EAD5DD43F82490C6B3CFB41EEF4E9A1A49D07",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "GFeC1pZ7fslcucbIsx44x9c0MPeJlLRb+WGG/wGflbw="
},
"voting_power": "21656144",
"proposer_priority": "-52387076"
}
],
"proposer": {
"address": "279EAD5DD43F82490C6B3CFB41EEF4E9A1A49D07",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "GFeC1pZ7fslcucbIsx44x9c0MPeJlLRb+WGG/wGflbw="
},
"voting_power": "21656144",
"proposer_priority": "-52387076"
}
},
"proposal": null,
"proposal_block": null,
"proposal_block_parts": null,
"locked_round": -1,
"locked_block": null,
"locked_block_parts": null,
"valid_round": -1,
"valid_block": null,
"valid_block_parts": null,
"votes": [
{
"round": 0,
"prevotes": [
"nil-Vote",
"nil-Vote"
],
"prevotes_bit_array": "BA{88:________________________________________________________________________________________} 0/117388861 = 0.00",
"precommits": [
"nil-Vote",
"nil-Vote"
],
"precommits_bit_array": "BA{88:________________________________________________________________________________________} 0/117388861 = 0.00"
}
],
"commit_round": -1,
"last_commit": {
"votes": [
"Vote{0:279EAD5DD43F 13211549/00/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 2F31A8E1F581 8B6CEAA65010 @ 2024-12-23T13:24:39.500074271Z}",
"Vote{1:BD417EAD7FF9 13211549/00/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 2F31A8E1F581 31E4D1FFA299 @ 2024-12-23T13:24:39.553047425Z}"
],
"votes_bit_array": "BA{88:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} 117388861/117388861 = 1.00",
"peer_maj_23s": {}
},
"last_validators": {
"validators": [
{
"address": "279EAD5DD43F82490C6B3CFB41EEF4E9A1A49D07",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "GFeC1pZ7fslcucbIsx44x9c0MPeJlLRb+WGG/wGflbw="
},
"voting_power": "21656144",
"proposer_priority": "43345641"
}
],
"proposer": {
"address": "5AA4440350230D5BB8CDFE6A5726656B4FC7DC6E",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "BM16Wru6ELaZXCyKZAH5WGxg5YiMYw2WlcpBnfdbnQg="
},
"voting_power": "162210",
"proposer_priority": "-63939004"
}
},
"triggered_timeout_precommit": false
},
"peers": [
{
"node_address": "f8d5e677f1f68f8bd798752595371817f61dc532@178.128.156.131:26656",
"peer_state": {
"round_state": {
"height": "13211550",
"round": 0,
"step": 1,
"start_time": "2024-12-23T13:24:43.982077345Z",
"proposal": false,
"proposal_block_part_set_header": {
"total": 0,
"hash": ""
},
"proposal_block_parts": null,
"proposal_pol_round": -1,
"proposal_pol": "________________________________________________________________________________________",
"prevotes": "________________________________________________________________________________________",
"precommits": "________________________________________________________________________________________",
"last_commit_round": 0,
"last_commit": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"catchup_commit_round": -1,
"catchup_commit": "________________________________________________________________________________________"
},
"stats": {
"votes": "14173",
"block_parts": "45"
}
}
}
]
}
}

consensus_state

Retrieves consensus state.

Not safe to call from inside the ABCI application during a block execution.

Parameters


None.

Returns

Consensus state results.

Request example

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "consensus_state",
"params": [],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"round_state": {
"height/round/step": "13213043/0/6",
"start_time": "2024-12-23T15:53:01.989949876Z",
"proposal_block_hash": "78CB001605FE99454B82944CB47D65D093629DDD38454260E7B7980874A6A5D7",
"locked_block_hash": "78CB001605FE99454B82944CB47D65D093629DDD38454260E7B7980874A6A5D7",
"valid_block_hash": "78CB001605FE99454B82944CB47D65D093629DDD38454260E7B7980874A6A5D7",
"height_vote_set": [
{
"round": 0,
"prevotes": [
"Vote{0:279EAD5DD43F 13213043/00/SIGNED_MSG_TYPE_PREVOTE(Prevote) 78CB001605FE 619E4C697B2C @ 2024-12-23T15:53:02.160332603Z}",
"Vote{1:BD417EAD7FF9 13213043/00/SIGNED_MSG_TYPE_PREVOTE(Prevote) 78CB001605FE 82F0E2036082 @ 2024-12-23T15:53:02.374084828Z}"
],
"prevotes_bit_array": "BA{88:xxxxxxxxxx__xxxxxxxxxxxxxxxx_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxx_xxxxxxxxxxxxxxx} 110520639/117416870 = 0.94",
"precommits": [
"Vote{0:279EAD5DD43F 13213043/00/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 78CB001605FE 92F18B4F01EA @ 2024-12-23T15:53:02.551832113Z}",
"nil-Vote",
"Vote{2:BFA6235D9556 13213043/00/SIGNED_MSG_TYPE_PRECOMMIT(Precommit) 78CB001605FE 0FB040BC54A6 @ 2024-12-23T15:53:02.563127503Z}",
"nil-Vote"
],
"precommits_bit_array": "BA{88:x_x_x________x_x__x_xx____x__xxxx___x_xx_xx_xxx_xxx__x___xxx__xx_xxx__x___x___xx___xxxx_} 52462972/117416870 = 0.45"
},
{
"round": 1,
"prevotes": [
"nil-Vote",
"nil-Vote"
],
"prevotes_bit_array": "BA{88:________________________________________________________________________________________} 0/117416870 = 0.00",
"precommits": [
"nil-Vote",
"nil-Vote"
],
"precommits_bit_array": "BA{88:________________________________________________________________________________________} 0/117416870 = 0.00"
}
],
"proposer": {
"address": "026D3C349592A1A1D6534744106D7B0453E3C565",
"index": 29
}
}
}
}

consensus_params

Retrieves consensus parameters.

Parameters


  • height (integer; default: 0): the height to return. If no height is provided, the latest block commit info is to be returned.

Returns

Consensus parameters results.

Request parameters

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "consensus_params",
"params": ["1"],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"block_height": "1",
"consensus_params": {
"block": {
"max_bytes": "200000",
"max_gas": "20000000"
},
"evidence": {
"max_age_num_blocks": "1000000",
"max_age_duration": "6000000000000000",
"max_bytes": "50000"
},
"validator": {
"pub_key_types": [
"ed25519"
]
},
"version": {
"app": "0"
}
}
}
}

unconfirmed_txs

Retrieves the list of unconfirmed transactions.

Parameters


  • limit (integer; default: 30; max: 100): the maximum number of unconfirmed transactions to return.

Returns

The list of unconfirmed transactions.

Request example

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "unconfirmed_txs",
"params": ["1"],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"n_txs": "2",
"total": "4",
"total_bytes": "2012",
"txs": [
"CoYBCoMBCiQva2F2YS5wcmljZWZlZWQudjFiZXRhMS5Nc2dQb3N0UHJpY2USWwora2F2YTE5cmprNXFtbXd5d256ZmNjd3p5bjAyanl3Z3B3anFmNjBhZmo5MhILdXNkeDp1c2Q6MzAaEjcxODkzMDAwMDAwMDAwMDA2OSILCPHVsLsGEMCO5TcSagpSCkYKHy9jb3Ntb3MuY3J5cHRvLnNlY3AyNTZrMS5QdWJLZXkSIwohA31VSgUTeXh1kcCYwNrx04+4ItSC8M6wuKV96JLq9G0pEgQKAggBGJHBFxIUCg4KBXVrYXZhEgU1MDAwMBDwkwkaQKvIEvEmlpm5Xuw9on+NLx53kPmvw3QI2Fic1/IDowITWeN8bbGHdomSC1cdnrtZ8rxaBUnfpLM7Yisnk4cqcl4=",
"CoQBCoEBCiQva2F2YS5wcmljZWZlZWQudjFiZXRhMS5Nc2dQb3N0UHJpY2USWQora2F2YTF1ZWFrN256ZXNtM3BuZXY2bG5ncDZsZ2swcnkwMmRqejhwanBjZxIIdXNkeDp1c2QaEjczMzg5OTk5OTk5OTk5OTk5NyIMCLSAp7sGEMCR+NQCEmkKUgpGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQJh+Rd6tFqIDMHzDY2LUqIfd6iQjaxEk7kCf/PggVVILxIECgIIARj78XASEwoNCgV1a2F2YRIENTAwMBDwkwkaQNH1d9rV6P0l8EktESQ6pSg1htx5I8FNNit3kfg/bOXqJ0c5PxTgBfeitv167yLxWxyXBWaJueQGMVh8KOHi1W0="
]
}
}

num_unconfirmed_txs

Retrieves data on unconfirmed transactions.

Parameters


None.

Returns

The status of unconfirmed transactions.

Request example

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "num_unconfirmed_txs",
"params": [],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"n_txs": "0",
"total": "0",
"total_bytes": "0",
"txs": null
}
}

Searches for transactions with their results.

Parameters


  • query (string; required): query is a string, which has a form: "condition AND condition ..." (no OR at the moment). condition has a form: "key operation operand". key is a string with a restricted set of possible symbols ( \t\n\r()"'=>< are not allowed). operation can be =, <, <=, >, >=, CONTAINS. An operand can be a string (escaped with single quotes), number, date, or time.
  • prove (boolean; default: false): adds proofs of the transactions inclusion in the block.
  • page (integer; default: 1): a page number (1-based).
  • per_page (integer; default: 30, max: 100): a number of entries per page.
  • order_by (string; default: asc): the order in which transactions are sorted (asc or desc), by height & index. If empty, default sorting still applies.
  • match_events (boolean; default: false): match attributes in query within events, in addition to the height and txhash.

Returns

The list of unconfirmed transactions.

Request example

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "tx_search",
"params": {
"query": "tx.height=13225811",
"prove": true,
"page": "1",
"per_page": "5",
"order_by": "desc"
},
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"txs": [],
"total_count": "0"
}
}

Searches for blocks by BeginBlock and EndBlock events.

Parameters


  • query (string; required): query is a string, which has a form: "condition AND condition ..." (no OR at the moment). condition has a form: "key operation operand". key is a string with a restricted set of possible symbols ( \t\n\r()"'=>< are not allowed). operation can be =, <, <=, >, >=, CONTAINS. An operand can be a string (escaped with single quotes), number, date, or time.
  • page (integer; default: 1): a page number (1-based).
  • per_page (integer; default: 30, max: 100): a number of entries per page.
  • order_by (string; default: asc): the order in which transactions are sorted (asc or desc), by height & index. If empty, default sorting still applies.
  • match_events (boolean; default: false): match attributes in query within events, in addition to the height.

Returns

The list of paginated blocks matching the search criteria.

Request example

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "block_search",
"params": {
"query": "block.height=13225811",
"page": "1",
"per_page": "10",
"order_by": "desc"
},
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blocks": [
{
"block_id": {
"hash": "F054E236608C0E65DFE9231F9332D7F54F1A282D4C2C3DA6B35FAED5D4EE9169",
"parts": {
"total": 1,
"hash": "4F02FC67A8503D1D5428EE6D1209FC5BC1BB67382DBDB53F38C3FD0783B2FC8A"
}
},
"block": {
"header": {
"version": {
"block": "11"
},
"chain_id": "0g_2222-10",
"height": "13225811",
"time": "2024-12-24T12:58:00.512093988Z",
"last_block_id": {
"hash": "304F208093FA799825FA221EB9B517B73A0879E6D9B971DD28FDF96F564EEC7C",
"parts": {
"total": 1,
"hash": "4158FCF92A13A2A5F8D466BD0189EB466DDD5D1FCA7ACF0E40069A8A0B775792"
}
},
"last_commit_hash": "CCFD88F120E554844A8DED71E1DAF3FA8089B1D7CFDC276917C8A5E34FDE6DBD",
"data_hash": "2E1EC915F83863741270A49157E2787F5F34F3B0E2E67BB1527368F8BA05D1CD",
"validators_hash": "7C3AABDFAA6A53BF1C63DC025201337CA9CB3F7DE8A51EA0C54B2CEBDCEF6E39",
"next_validators_hash": "7C3AABDFAA6A53BF1C63DC025201337CA9CB3F7DE8A51EA0C54B2CEBDCEF6E39",
"consensus_hash": "AD82B220C509602720D74FD75BCE7CFE9B148039958F236D8894E00EB1599E04",
"app_hash": "2AA5FE48061351DF5DD4F79C25A902466C31975199BEE286FE294273DB4FBF4A",
"last_results_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
"evidence_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",
"proposer_address": "279EAD5DD43F82490C6B3CFB41EEF4E9A1A49D07"
},
"data": {
"txs": [
"CrIHCv4GCh8vZXRoZXJtaW50LmV2bS52MS5Nc2dFdGhlcmV1bVR4EtoGCpMGChovZXRoZXJtaW50LmV2bS52MS5MZWdhY3lUeBL0BQiXvhMSDDEwMTAwMDAwMDAwMBjJ9hgiKjB4ODE1ZjI3QTU2MTcxMUE2QjA0YmNFM0FhNjVjNUQ5QTE5NDVBNWVFQioBMDLkBHgmYbwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGdqr9oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA..."
]
},
"evidence": {
"evidence": []
},
"last_commit": {
"height": "13225810",
"round": 0,
"block_id": {
"hash": "304F208093FA799825FA221EB9B517B73A0879E6D9B971DD28FDF96F564EEC7C",
"parts": {
"total": 1,
"hash": "4158FCF92A13A2A5F8D466BD0189EB466DDD5D1FCA7ACF0E40069A8A0B775792"
}
},
"signatures": [
{
"block_id_flag": 2,
"validator_address": "279EAD5DD43F82490C6B3CFB41EEF4E9A1A49D07",
"timestamp": "2024-12-24T12:58:00.458392974Z",
"signature": "LU+rS0/HPXczwL9jxzAWYHSck0ORgzD9MGLXx6POcKO2XpNnHRG8/QsxDSs4Ouy3hO9AAiG0RNUWBrVlgjlpBg=="
}
]
}
}
}
],
"total_count": "1"
}
}

tx

Retrieves a transaction by hash.

Parameters


  • hash (string; required): a hash of a transaction to retrieve.
  • prove (boolean; default: false): adds proofs of the transaction's inclusion in the block.

Returns

Transaction info.

Request example

curl -X POST https://rpc.ankr.com/0g_galileo_testnet_tendermint/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "tx",
"params": ["4B6D8FEA3786BFC6152EAEA791C4DAF00C41E93DAD56A7230B565179CD29CAA1", true],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"hash": "4B6D8FEA3786BFC6152EAEA791C4DAF00C41E93DAD56A7230B565179CD29CAA1",
"height": "12345",
"index": 2,
"tx_result": {
"code": 0,
"log": "Success",
"events": [
{
"type": "transfer",
"attributes": [
{ "key": "sender", "value": "0g1xyz..." },
{ "key": "recipient", "value": "0g1abc..." },
{ "key": "amount", "value": "10000u0g" }
]
}
]
},
"tx": "BASE64_ENCODED_TX", // The transaction itself in Base64 format
"proof": {
"root_hash": "0xABC123...",
"data": "BASE64_ENCODED_PROOF",
"proof": { /* Detailed proof structure */ }
}
}
}