TRON — SolidityNode API (2/4)
API reference for TRON. All methods ->
SolidityNode API
/walletsolidity/getaccountbyid
Retrieves an account information by account ID.
Parameters
account_id(string; hex; required): an account ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/getaccountbyid' \
-H 'Content-Type: application/json' \
-d '{
"account_id": "41712d3993327b916c33eea0c3e8ea3eab592e88da"
}'
/walletsolidity/getblockbyid
Retrieves block information by block ID.
Parameters
value(string; required): a block ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/getblockbyid' \
-H 'Content-Type: application/json' \
-d '{
"value": "0000000002fa856df555c6441cf755a551b131a5ca8d84f116dc59c042ef18fa"
}'
Response example
{
"blockID": "0000000002fa856df555c6441cf755a551b131a5ca8d84f116dc59c042ef18fa",
"block_header": {
"raw_data": {
"number": 49972589,
"txTrieRoot": "354bd442f2111081081826ae638a0d07422609aeea8dc63c3ad208088525567e",
"witness_address": "41022939a4a06cbc7b384096c1af8657ec435173af",
"parentHash": "0000000002fa856c18e27615c5ea553ff7c8318059b555801f329e9533dec810",
"version": 27,
"timestamp": 1680530541000
},
"witness_signature": "aad4536d655327bcb64a0046f69fc2fa5be5dfc2f76e391736c1bf7e0a96c08c0498a3b5aae821360ffa2a2b1797731a06e02fa9fd314a3d3c23a4eda0301fe501"
},
"transactions": [
{
"ret": [
{
"contractRet": "SUCCESS"
}
],
"signature": [
"c3c631c6d079838166807e67dbf2c734dec6f30cd981066c44758dcd1f4fe1e835d035e7f60501ea9bf42fdd0a54f8592771714c66a4f2a581c2b3d7c3f9d43f01"
],
"txID": "eb337d551043fc90e2f3cbd4ad8a2a61f0e3496e0662114628f0f2ff8a231bb0",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"data": "a9059cbb000000000000000000000000b034574a3a36a2e8c77d7d187facf91b8c3dd80300000000000000000000000000000000000000000000000000000000177bf680",
"owner_address": "418695dfd9b3e39cb574fa3893372fa3c6e329320c",
"contract_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c"
},
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
},
"type": "TriggerSmartContract"
}
],
"ref_block_bytes": "8559",
"ref_block_hash": "537fd1c2c65c4c31",
"expiration": 1680530795000,
"fee_limit": 100000000,
"timestamp": 1680530537504
},
"raw_data_hex": "0a0285592208537fd1c2c65c4c3140f8d3c3bbf4305aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a15418695dfd9b3e39cb574fa3893372fa3c6e329320c121541a614f803b6fd780986a42c78ec9c7f77e6ded13c2244a9059cbb000000000000000000000000b034574a3a36a2e8c77d7d187facf91b8c3dd80300000000000000000000000000000000000000000000000000000000177bf68070a0f8b3bbf430900180c2d72f"
}
]
}
/walletsolidity/getblockbylimitnext
Retrieves a list of blocks by range.
Parameters
startNum(integer; required): the block height to start from (included in the range).endNum(integer; required): the block height to end with (excluded from the range).
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/getblockbylimitnext' \
-H 'Content-Type: application/json' \
-d '{
"startNum": 1,
"endNum": 2
}'
Response example
{
"block": [
{
"blockID": "00000000000000010ff5414c5cfbe9eae982e8cef7eb2399a39118e1206c8247",
"block_header": {
"raw_data": {
"number": 1,
"txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000",
"witness_address": "415095d4f4d26ebc672ca12fc0e3a48d6ce3b169d2",
"parentHash": "00000000000000001ebf88508a03865c71d452e25f4d51194196a1d22b6653dc",
"timestamp": 1529891469000
},
"witness_signature": "4544a6004c76286a1d6248f451bf148345a51e21881e84899758468da7b1c7e85b809735a1b2be29f166cfba8c5e69543f4f24294fbfa0498a39002166a397ba00"
}
}
]
}
/walletsolidity/getblockbylatestnum
Retrieves several latest blocks.
Parameters
num(integer; required): the number of blocks to return.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/getblockbylatestnum' \
-H 'Content-Type: application/json' \
-d '{
"num": 1
}'
Response example
{
"block": [
{
"blockID": "0000000002fa889448bff265ae132d3ce3a61c02f5f2f3a8307df772014e2f66",
"block_header": {
"raw_data": {
"number": 49973396,
"txTrieRoot": "1c530d753117305b7ffdca38f6087dc4f5f2cf3f18f46f03f9353be6df733f32",
"witness_address": "418440ffd578f7a5abf3537b5f46a6980d382db581",
"parentHash": "0000000002fa88938e671ca492f416843f3d8e69ec12f0750955f72cf11604f1",
"version": 27,
"timestamp": 1680532962000
},
"witness_signature": "f2d71f8b28afc21f71c5a2e80a815cfe6f7cc6f56f8059cbb3d0dfed6ad36826299956284650041ca06aaae7f45657f2e2ed8363b9a6eb999d6c6207fa7a830400"
},
"transactions": [
{
"ret": [
{
"contractRet": "SUCCESS"
}
],
"signature": [
"f072741d74c3d637b7f2070be99a8362383e119e08f00db5de31d025fee4cf817cc9f5551479bfb0ad9cf056cb76a76192ddd293ea67096aa94cb129cdc455be01"
],
"txID": "929a0c3976c4fc26b3b8a5d922ec5fc1bf3685a0cd7e303d50d3c394120e1ffb",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"data": "a9059cbb00000000000000000000004133751dd8f732e5c0f7c32eb247b524cb3f0b17b0000000000000000000000000000000000000000000000000000000000606f800",
"owner_address": "41d1c4bb7b2f39aba5707711719b2236b5b605af2e",
"contract_address": "41a614f803b6fd780986a42c78ec9c7f77e6ded13c"
},
"type_url": "type.googleapis.com/protocol.TriggerSmartContract"
},
"type": "TriggerSmartContract"
}
],
"ref_block_bytes": "8880",
"ref_block_hash": "24c789571ad256f0",
"expiration": 1680533018597,
"fee_limit": 30000000,
"timestamp": 1680532902000
},
"raw_data_hex": "0a028880220824c789571ad256f040e5afcbbcf4305aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a1541d1c4bb7b2f39aba5707711719b2236b5b605af2e121541a614f803b6fd780986a42c78ec9c7f77e6ded13c2244a9059cbb00000000000000000000004133751dd8f732e5c0f7c32eb247b524cb3f0b17b0000000000000000000000000000000000000000000000000000000000606f80070f0a0c4bcf43090018087a70e"
}
]
}
]
}
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/getdeferredtransactionbyid' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/getdeferredtransactioninfobyid' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/getmerkletreevoucherinfo' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/scannotebyivk' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/scanandmarknotebyivk' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/scannotebyovk' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/isspend' )
//: # (-H 'Content-Type: application/json' )
//: # (curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/walletsolidity/scanshieldedtrc20notesbyivk' )
//: # (-H 'Content-Type: application/json' )
FullNode API:
wallet/createtransaction
Creates a transfer transaction.
If to_address doesn't exist, creates an account on the blockchain.
Parameters
to_address(string; hex; required): a destination address.owner_address(string; hex; required): a sender address.amount(integer; required): a transfer amount.permission_id(string; optional): for multi-signature use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/createtransaction' \
-H 'Content-Type: application/json' \
-d '{
"to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d",
"owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292",
"amount": 1000
}'
wallet/broadcasttransaction
Broadcasts a transaction after signing.
Parameters
A transaction after signing, containing signature, txID, raw_data
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/broadcasttransaction' \
-H 'Content-Type: application/json' \
-d '{
"signature": [
"97c825b41c77de2a8bd65b3df55cd4c0df59c307c0187e42321dcc1cc455ddba583dd9502e17cfec5945b34cad0511985a6165999092a6dec84c2bdd97e649fc01"
],
"txID": "454f156bf1256587ff6ccdbc56e64ad0c51e4f8efea5490dcbc720ee606bc7b8",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"amount": 1000,
"owner_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
"to_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292"
},
"type_url": "type.googleapis.com/protocol.TransferContract"
},
"type": "TransferContract"
}
],
"ref_block_bytes": "267e",
"ref_block_hash": "9a447d222e8de9f2",
"expiration": 1530893064000,
"timestamp": 1530893006233
}
}'
wallet/broadcasthex
Broadcasts a transaction hex string after signing.
Parameters
transaction(string; hex; required): a transaction hex after signing.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/broadcasthex' \
-H 'Content-Type: application/json' \
-d '{
"transaction": "0A8A010A0202DB2208C89D4811359A28004098A4E0A6B52D5A730802126F0A32747970652E676F6F676C65617069732E636F6D2F70726F746F636F6C2E5472616E736665724173736574436F6E747261637412390A07313030303030311215415A523B449890854C8FC460AB602DF9F31FE4293F1A15416B0580DA195542DDABE288FEC436C7D5AF769D24206412418BF3F2E492ED443607910EA9EF0A7EF79728DAAAAC0EE2BA6CB87DA38366DF9AC4ADE54B2912C1DEB0EE6666B86A07A6C7DF68F1F9DA171EEE6A370B3CA9CBBB00"
}'
Response example
{
"result": false,
"code": "SIGERROR",
"txid": "38a0482d6d5a7d1439a50b848d68cafa7d904db48b82344f28765067a5773e1d",
"message": "Validate signature error: 8bf3f2e492ed443607910ea9ef0a7ef79728daaaac0ee2ba6cb87da38366df9ac4ade54b2912c1deb0ee6666b86a07a6c7df68f1f9da171eee6a370b3ca9cbbb00 is signed by TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW but it is not contained of permission.",
"transaction": "{\"raw_data\": {\"ref_block_bytes\": \"02db\",\"ref_block_hash\": \"c89d4811359a2800\",\"expiration\": 1560496575000,\"contract\": [{\"type\": \"TransferAssetContract\",\"parameter\": {\"type_url\": \"type.googleapis.com/protocol.TransferAssetContract\",\"value\": \"0a07313030303030311215415a523b449890854c8fc460ab602df9f31fe4293f1a15416b0580da195542ddabe288fec436c7d5af769d242064\"}}]},\"signature\": [\"8bf3f2e492ed443607910ea9ef0a7ef79728daaaac0ee2ba6cb87da38366df9ac4ade54b2912c1deb0ee6666b86a07a6c7df68f1f9da171eee6a370b3ca9cbbb00\"]}"
}
wallet/updateaccount
Updates the name of an account.
Parameters
account_name(string; hex; required): an account name.owner_address(string; hex; required): an owner address.permission_id(string; optional): for multi-sig use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/updateaccount' \
-H 'Content-Type: application/json' \
-d '{
"account_name": "0x7570646174654e616d6531353330383933343635353139",
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292"
}'
Response example
{
"visible": false,
"txID": "5814a0c0b25f3cc8926f56b4742f4b7b32979f7c6c2dc240fcfd7bc3061de3a5",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"account_name": "7570646174654e616d6531353330383933343635353139",
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292"
},
"type_url": "type.googleapis.com/protocol.AccountUpdateContract"
},
"type": "AccountUpdateContract"
}
],
"ref_block_bytes": "cd8f",
"ref_block_hash": "4441a3e65f66075c",
"expiration": 1680586065000,
"timestamp": 1680586007964
},
"raw_data_hex": "0a02cd8f22084441a3e65f66075c40e888f1d5f4305a6a080a12660a32747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e4163636f756e74557064617465436f6e747261637412300a177570646174654e616d6531353330383933343635353139121541d1e7a6bc354106cb410e65ff8b181c600ff14292709ccbedd5f430"
}