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 (3/3)

API reference for 0G. All methods ->

Part 3 of 3: 1 · 2 · 3

Transactions

broadcast_tx_sync

Returns with the response from CheckTx. Does not wait for DeliverTx result.

If you want to be sure that the transaction is included in a block, you can subscribe for the result using JSON-RPC via a websocket. See https://docs.cometbft.com/v0.34/core/subscription.html If you haven't received anything after a couple of blocks, resend it. If the same happens again, send it to some other node. A few reasons why it could happen:

  1. A malicious node drops or pretends it has committed your tx.
  2. A malicious proposer (not necessary the one you're communicating with) drops transactions, which might become valid in the future (https://github.com/tendermint/tendermint/issues/3322).

Please refer to Tendermint docs for formatting/encoding rules.

Parameters


  • tx (string; required): the signed transaction, encoded as Base64.

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": "broadcast_tx_sync",
"params": ["<BASE64_ENCODED_TRANSACTION>"],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"code": 0,
"data": "",
"log": "transaction successfully broadcasted",
"hash": "0xABC123..." // The transaction hash
}
}

broadcast_tx_async

Returns right away, with no response. Does not wait for CheckTx nor DeliverTx results.

If you want to be sure that the transaction is included in a block, you can subscribe for the result using JSON-RPC via a websocket. See https://docs.cometbft.com/v0.34/core/subscription.html If you haven't received anything after a couple of blocks, resend it. If the same happens again, send it to some other node. A few reasons why it could happen:

  1. A malicious node drops or pretends it has committed your tx.
  2. A malicious proposer (not necessary the one you're communicating with) drops transactions, which might become valid in the future (https://github.com/tendermint/tendermint/issues/3322).
  3. A node is offline.

Please refer to CometBFT docs for formatting/encoding rules.

Parameters


  • tx (string; required): the Base64-encoded signed transaction.

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": "broadcast_tx_async",
"params": ["<BASE64_ENCODED_TRANSACTION>"],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"code": 0,
"data": "",
"log": "",
"hash": "0xABC123..." // Transaction hash
}
}

broadcast_tx_commit

Returns with the responses from CheckTx and DeliverTx.

warning

Use only for testing and development. In production, use BroadcastTxSync or BroadcastTxAsync. You can subscribe for the transaction result using JSON-RPC via a websocket (see CometBFT docs).

tip

CONTRACT: only returns error if mempool.CheckTx() errs or if we timeout waiting for tx to commit. If CheckTx or DeliverTx fails, no error will be returned, but the result will contain a non-OK ABCI code. Please refer to CometBFT docs for formatting/encoding rules.

Parameters


  • tx (string; required): the Base64-encoded signed transaction.

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": "broadcast_tx_commit",
"params": ["<BASE64_ENCODED_TRANSACTION>"],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"check_tx": {
"code": 0,
"data": "",
"log": "Transaction checked successfully"
},
"deliver_tx": {
"code": 0,
"data": "",
"log": "Transaction delivered successfully",
"events": [
{
"type": "transfer",
"attributes": [
{ "key": "sender", "value": "0g1xyz..." },
{ "key": "recipient", "value": "0g1abc..." },
{ "key": "amount", "value": "10000u0g" }
]
}
]
},
"hash": "0xABC123...",
"height": "12345"
}
}

check_tx

Checks the transaction without executing it.

The transaction won't be added to the mempool.

Please refer to CometBFT docs for formatting/encoding rules.

Parameters


  • tx (string; required): the Base64-encoded signed transaction.

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": "check_tx",
"params": ["<BASE64_ENCODED_TRANSACTION>"],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"code": 0,
"data": "",
"log": "Transaction is valid",
"events": [
{
"type": "transfer",
"attributes": [
{ "key": "sender", "value": "0g1xyz..." },
{ "key": "recipient", "value": "0g1abc..." },
{ "key": "amount", "value": "10000u0g" }
]
}
]
}
}

ABCI

abci_info

Retrieves application info.

Parameters


None.

Returns

Application 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": "abci_info",
"params": [],
"id": 1
}'

Response example

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"response": {
"data": "0g",
"version": "0.27.0",
"app_version": "8",
"last_block_height": "13239641",
"last_block_app_hash": "wLirVXfBEeq0jZcrshBGWS7AGN19N7p8aQqMAiaIl+I="
}
}
}

abci_query

Queries the application for particular information.

Parameters


  • path (string; required): a path to the data ("/a/b/c").
  • data (string; required): the hex-encoded data.
  • height (integer; default: 0): the height (0 means latest).
  • prove (boolean; default: false): adds proofs of the transactions inclusion in the block.

Returns

Particular info according to the query submitted.

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": "abci_query",
"params": ["a/b/c", "the_data", "1", true],
"id": 1
}'

Response example

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"response": {
"code": 0,
"log": "",
"info": "",
"index": -1,
"key": "0x6b61766131387879377a...",
"value": "0x123456789abcdef", // Hex-encoded value
"proofOps": null,
"height": "12345",
"codespace": ""
}
}
}

GET /eth/v1/node/version

Retrieves node version info.

Parameters

None.

Request example

curl https://rpc.ankr.com/http/0g_galileo_testnet_beaconkit/eth/v1/node/version

Response example

{
"data": {
"version": "1.1.0"
}
}

GET /eth/v2/debug/beacon/states/{state_id}

Retrieves debug info.

Returns a quantity of debug information, including the following:

  • Validator root.
  • Latest beacon and execution chain block headers.
  • Various root hashes.
  • The node's understanding of the validator set voting power, slashing status.

Parameters

  • state_id (string, hex; path): ID for the state to query. Can be one of the following:
    • A block root (32-byte hex string, e.g., 0xabc123...).
    • A state root (32-byte hex string).
    • A block ID alias such as:
      • head – the latest known state.
      • genesis – the genesis state.
      • finalized – the latest finalized state.
      • justified – the latest justified state.

Request example

curl https://rpc.ankr.com/http/0g_galileo_testnet_beaconkit/eth/v2/debug/beacon/states/head

Response example

{
"version": "electra",
"execution_optimistic": false,
"finalized": true,
"data": {
"genesis_validators_root": "0xc22d6f6c6672c738e5696fa0e43c0aa0acf25ec09bd301b68036d61eb79c2daf",
"slot": "0x1c3b08",
"fork": {
"previous_version": "0x05000000",
"current_version": "0x05000000",
"epoch": "0x0"
},
"latest_block_header": {
"slot": "0x1c3b08",
"proposer_index": "0x0",
"parent_block_root": "0x7ce89c85094fa830a5cf6649621000400d3a882240fa222ddd0f021f0bcbb42a",
"state_root": "0x0000000000000000000000000000000000000000000000000000000000000000",
"body_root": "0xa8e552f88c09ff0f7394b82041ab25a712cbe73d9e646190ac5330d50073d21f"
},
"block_roots": [
"0x2f3a417b224d5262596c7d4dfa696abaf3800ccf7593cc749952f88e3948c7cd",
"0x7f40aa67f38b9eb7dc36a9dd5f6cdf6a3e9a94a206084240f81345100708290f",
"0xa703243bff9736a2154d4fbb158bfc0317a8c52af58516ae6844a17d497d739d",
"0x0d9701998fbf960cebe13cdb89647595334db848c2a326bd39cce67815e42adb",
"0x6a705f37d7fccfe3b7ae202bd22840c3c70f7138a366f3506fa533da4f26dea7",
"0x7bc0ea29114f8a334cf28eb1de33443de5214810fbe5c5b49a07d4878c5342ff",
"0xf3875ec20169e7f48c576a7076ab04a4dac25c15a7c80c721defcc10851af802",
"0x7ce89c85094fa830a5cf6649621000400d3a882240fa222ddd0f021f0bcbb42a"
],
"state_roots": [
"0xde5cf944fec524820e3d4d9174ca5b42855ebb9ad89104d92bc5001c4a9b9e32",
"0xac2e45403552d2b2372950fea027f0c826b4d09b8af1bafba14be45347b1e69a",
"0x5a5663ca9e37572174e5957e1260c221aca96384a3b441de8491de58afd6e44f",
"0x593206fbb5b8f1ae140c4041d8ab865cb5afb7fccc7da019ce2834ce9f11bb0a",
"0x39262683ed866217509ec6bd75b655c8380b42874d8b1d1eb5c40ead206ef700",
"0x5dc2e2b8c9f04cea3e5574aefca4365d2a920d90c9cdad3eb4d5adee26fec217",
"0x8a048f206b906dddb5c0144e2d6248b32ed5e593ef1494f9d0e9141a19cc5862",
"0x6cede03f993b5ee611cea35969a54f655693f8004fba4ab7e3740ffd5d1b9cbc"
],
"eth1_data": {
"depositRoot": "0xa14b8fd2b3468db5bc151c63cf07b85bf774bfa94cc45e4bd4c7d5f450888a79",
"depositCount": "0x0",
"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
},
"eth1_deposit_index": 7,
"latest_execution_payload_header": {
"parentHash": "0x812d076cc7ea828fbb4a93a23db0b68e0e952ced2e56eaaadff43a48e1ca2337",
"feeRecipient": "0x0000000000000000000000000000000000000001",
"stateRoot": "0x115cfcd4e912feb47ca34a490b02f1a71fea4dd402893ed62385bc0688d1f26a",
"receiptsRoot": "0xc1e4e11c4d71733acebe11c2ea4c179267e56838eefbec0cd2609500010f66bd",
"logsBloom": "0x1201000014800000100006808228400420c010020100800102000110400020104300c0004008010000100004010000092010691000202040020140000028800000002040080000094888010804000800400040800400050002080000000000c030022800024100020800000020040c0200080100000c8008010880308408002000000010000420020020040b02840000900080021100040a00041110200004000e001210009026000b0a100000040004113020200801000944220000440440100408200640000401200004000200000004000002f4100200922000080101280080d80c0880048400000000001c00000020a0200008280040002000084000c001",
"prevRandao": "0x73ca1a22bd4c673a6a320736f17e462c01f024303d6b74bd7dadd78296500348",
"blockNumber": "0x1c3b08",
"gasLimit": "0x2255100",
"gasUsed": "0x4f71d5",
"timestamp": "0x6848429c",
"extraData": "0xd883010f0b846765746888676f312e32332e38856c696e7578",
"baseFeePerGas": "9",
"blockHash": "0xf43ec3c5eb64cb5c205af34fc90675117f6ad9ed1b8453220e77d7d424a2952e",
"transactionsRoot": "0xb6577e8b117a399b7ef1a8b25080c4601f01cd9ccc5bd2fc02388ef4deb37d73",
"withdrawalsRoot": "0x0145cc91e1ba724070abab6da58080fc905c13e071e17882988043e70efe0988",
"blobGasUsed": "0x0",
"excessBlobGas": "0x0"
},
"validators": [
{
"pubkey": "0xa21978649e2dca81ff5b5a9c1206ff28d86f55debf3cf0e47ed0354a168ffcdbf14ed556ad4e9260b9bdd6b0f01907a9",
"withdrawalCredentials": "0x01000000000000000000000063df5c411aa90b9866e7e6082230ffbf61aeda8c",
"effectiveBalance": "0x1fe5d61a000",
"slashed": false,
"activationEligibilityEpoch": "0x0",
"activationEpoch": "0x0",
"exitEpoch": "0xffffffffffffffff",
"withdrawableEpoch": "0xffffffffffffffff"
},
{
"pubkey": "0xa68a786ea4c5b0d5b327a91d7eab6c07e69c58d301f86bc3e39991d124c7d7638efa1964089ac5d81f9f7f151a86eebf",
"withdrawalCredentials": "0x01000000000000000000000063df5c411aa90b9866e7e6082230ffbf61aeda8c",
"effectiveBalance": "0x773594000",
"slashed": false,
"activationEligibilityEpoch": "0x0",
"activationEpoch": "0x0",
"exitEpoch": "0xffffffffffffffff",
"withdrawableEpoch": "0xffffffffffffffff"
},
{
"pubkey": "0x975d7a0569f6dd5560fa5054690d87f48fd99026f2336f9666f47d2c74a22611d1158d0ec3feb3511331ec4ef714f608",
"withdrawalCredentials": "0x01000000000000000000000063df5c411aa90b9866e7e6082230ffbf61aeda8c",
"effectiveBalance": "0x773594000",
"slashed": false,
"activationEligibilityEpoch": "0x0",
"activationEpoch": "0x0",
"exitEpoch": "0xffffffffffffffff",
"withdrawableEpoch": "0xffffffffffffffff"
},
{
"pubkey": "0x94f8722acefe3b6d2de811a64cb4f93209bba50bb3613eaeab1d720ae09c7313c29f7de71a8718d351983c9c0c48ad09",
"withdrawalCredentials": "0x010000000000000000000000565e66aa2bcb27116937983f2f208efabf620ab2",
"effectiveBalance": "0xee6b28000",
"slashed": false,
"activationEligibilityEpoch": "0x4308",
"activationEpoch": "0x4309",
"exitEpoch": "0xffffffffffffffff",
"withdrawableEpoch": "0xffffffffffffffff"
}
],
"balances": [
2192000000000,
32000000000,
32000000000,
64000000000
],
"randao_mixes": [
"0xf3dadd64aafe134e583f639ab5b9fc650a7f0d008789b867ecb05b68e0037e2a",
"0x0570972fa2cb1548eb6d3b5161d638708d89b3cf49d88727b7dd7721141325c0",
"0x6761890246fa48731c333166236dd4bca041ad5ba491abf299bd94ee84faa551",
"0x995cb20d32dca378b4e09f625575141ae1bac9276982971b6402dfd9bc985928",
"0x995cb20d32dca378b4e09f625575141ae1bac9276982971b6402dfd9bc985928",
"0x5784db6dd330eaeb0215c5de57eef097cac679458038aac95a4c6d4b2d247590",
"0x7890bf970c57a80a27f1ad9e2425e9b80f5cbbb7ac1f8e3a17bbd1fd2dafadf2",
"0x6ec60f8c3be68f54efe87f84c48a8474039d30922674ca1d9043eb9205eeb0df"
],
"next_withdrawal_validator_index": "0x1"
}
}