Query APIs
GetVersion
This API returns the version of the blockchain software.
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.GetVersion","params":[],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": {
"version": "4.0.1",
"git_hash": "f3a9ba905e0dabddf230a10f5af5dc03bd2d4983",
"timestamp": "Thu Sep 14 15:22:31 UTC 2023"
}
}
GetAccount
This API returns the details of the account being queried in json format.
Query Parameters
address: the address of the account
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.GetAccount","params":[{"address":"0x4b80a68a8469d33449eb101082e5500b932a23ce"}],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": {
"sequence": "0",
"coins": {
"thetawei": "0",
"tfuelwei": "0"
},
"reserved_funds": [],
"last_updated_block_height": "0",
"root": "0x0000000000000000000000000000000000000000000000000000000000000000",
"code": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
}
}
GetBlock
This API returns the block being queried in json format.
Query Parameters
include_eth_tx_hashes: whether to include the ETH tx hash of the smart contract transactions in the response.
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.GetBlock","params":[{"hash":"0x007efd56a7b5a8e0822c10a96b079ea3f0a5adf5af4c570c58584aa064e558ee", "include_eth_tx_hashes":false}],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": {
"chain_id": "mainnet",
"epoch": "28780191",
"height": "28508949",
"parent": "0x833c4455fa697d84d9ce076a79dda62766d852626b324cbc96d11ea09f29598f",
"transactions_hash": "0x8638bb45218e8c0601839c73eeee8b8af9934cdbc0826b1b5c81385d8ed4f0c2",
"state_hash": "0x5a283648834ebe150f451cf12c653892dee08e227fdd9bedf5b211c9a414bfc2",
"timestamp": "1738243721",
"proposer": "0x4b80a68a8469d33449eb101082e5500b932a23ce",
"hcc": {
...
GetBlockByHeight
This API returns the finalized block given the height. If none of the blocks at the given height are finalized (either directly or indirectly), the API simply returns an empty result.
Query Parameters
height: the block height (need to pass in as a string instead of an integer)
include_eth_tx_hashes: whether to include the ETH tx hash of the smart contract transactions in the response.
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.GetBlockByHeight","params":[{"height":"28508949", "include_eth_tx_hashes":false}],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": {
"chain_id": "mainnet",
"epoch": "28780191",
"height": "28508949",
"parent": "0x833c4455fa697d84d9ce076a79dda62766d852626b324cbc96d11ea09f29598f",
"transactions_hash": "0x8638bb45218e8c0601839c73eeee8b8af9934cdbc0826b1b5c81385d8ed4f0c2",
"state_hash": "0x5a283648834ebe150f451cf12c653892dee08e227fdd9bedf5b211c9a414bfc2",
"timestamp": "1738243721",
"proposer": "0x4b80a68a8469d33449eb101082e5500b932a23ce",
"hcc": {
...
GetTransaction
This API returns the transaction being queried in json format.
Query Parameters
hash: the transaction hash*
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.GetTransaction","params":[{"hash":"0xa77237a234a4acc3507130c0f188e60ddddad16fdcc6169180e232e87eb7452d"}],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": {
"block_hash": "0x39ce117541bf1abf8dc32c66b34b07e3067dff29a826c4bfb222e49aca0783b9",
"block_height": "28508981",
"status": "finalized",
"hash": "0xa77237a234a4acc3507130c0f188e60ddddad16fdcc6169180e232e87eb7452d",
"type": 0,
"transaction": {
"proposer": {
"address": "0x6872b883464bfba456ab674bbef9824849db91e2",
"coins": {
"thetawei": "0",
"tfuelwei": "0"
},
"sequence": "0",
...
GetPendingTransactions
This API returns the pending transactions in the mempool.
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.GetPendingTransactions","params":[],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"result": {
"tx_hashes": []
}
}
Tx APIs
BroadcastRawTransaction
This API submits the given raw transaction to the blockchain, and returns only after the transaction to be included in the blockchain, or timed out (i.e. synchronous call)
Query Parameters
tx_bytes: the signed transaction bytes
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.BroadcastRawTransaction","params":[{"tx_bytes":"02f8a4c78085e8d4a51000f86ff86d942e833968e5bb786ae419c4d13189fb081cc43babd3888ac7230489e800008901158e46f1e875100015b841c2daae6cab92e37308763664fcbe93d90219df5a3520853a9713e70e734b11f27a43db6b77da4f885213b45a294c2b4c74dc9a018d35ba93e5b9297876a293c700eae9949f1233798e905e173560071255140b4a8abd3ec6d3888ac7230489e800008901158e460913d00000"}],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32000,
"message": "ValidateInputAdvanced: Got 21, expected 144. (acc.seq=143)"
}
}
BroadcastRawTransactionAsync
This API submits the given raw transaction to the blockchain, and returns immediately (i.e. asynchronous call).
Query Parameters
tx_bytes: the signed transaction bytes*
Method: POST
Copy https://theta.nownodes.io/rpc
Example body (raw )
Copy {"jsonrpc":"2.0","method":"theta.BroadcastRawTransactionAsync","params":[{"tx_bytes":"02f8a4c78085e8d4a51000f86ff86d942e833968e5bb786ae419c4d13189fb081cc43babd3888ac7230489e800008901158e46f1e875100016b841393e2eba6241482098cf11ef4dd869209d7ebd716397f3c862ca5b762bbf403006b1fa009786102383c408cabdf7450c1c73d4dd4a20d3b48a39a88ffe0ecb0e01eae9949f1233798e905e173560071255140b4a8abd3ec6d3888ac7230489e800008901158e460913d00000"}],"id":1}
Example response: 200
Copy {
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32000,
"message": "ValidateInputAdvanced: Got 22, expected 144. (acc.seq=143)"
}
}
Last updated 2 months ago