TRON — SolidityNode API (3/4)
API reference for TRON. All methods ->
SolidityNode API
wallet/votewitnessaccount
Votes for witnesses.
Parameters
owner_address(string; hex; required): an owner address.votes(array of key-value pairs): your votes description.vote_address(string; hex; required): the address of the witness you want to vote for.vote_count(integer; required): the number of votes you'd like to give.
permission_id(integer; optional): for multi-sig use.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/votewitnessaccount' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292",
"votes": [
{
"vote_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
"vote_count": 5
}
]
}'
wallet/getBrokerage
Retrieves the ratio of brokerage of the witness.
Parameters
address(string; hex; required): the address of the witness's account.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getBrokerage' \
-H 'Content-Type: application/json' \
-d '{
"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"
}'
Response example
{
"brokerage": 20
}
wallet/getReward
Retrieves unclaimed reward.
Parameters
address(string; hex; required): the address of the voter's account.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getReward' \
-H 'Content-Type: application/json' \
-d '{
"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"
}'
Response example
{
"reward": 0
}
wallet/updateBrokerage
Updates the ratio of brokerage.
Parameters
owner_address(string; hex; required): the address of the witness's account.brokerage(integer; required): the ration of the brokerage you'd like to update to.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/updateBrokerage' \
-H 'Content-Type: application/json' \
-d '{
"owner_address":"41E552F6487585C2B58BC2C9BB4492BC1F17132CD0",
"brokerage":30
}'
wallet/getaccountbalance
Retrieves the account balance in a specific block.
Parameters
account_identifier(required): an identifier of the account:address(string; hex; required): an account address.
block_identifier(required): an identifier of the block:hash(string; hex; required): a block hash.number(integer): a block number.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getaccountbalance' \
-H 'Content-Type: application/json' \
-d '{
"account_identifier": {
"address": "TLLM21wteSPs4hKjbxgmH1L6poyMjeTbHm"
},
"block_identifier": {
"hash": "0000000000010c4a732d1e215e87466271e425c86945783c3d3f122bfa5affd9",
"number": 68682
},
"visible": true
}'
Response example
{
"balance": 0,
"block_identifier": {
"hash": "0000000000010c4a732d1e215e87466271e425c86945783c3d3f122bfa5affd9",
"number": 68682
}
}
wallet/createassetissue
Issues a token.
Parameters
owner_address(string; hex; required): an owner address.name(string; hex; required): a token name.abbr(string; hex; required): a token name abbreviation.total_supply(integer; required): token total supply.trx_num(integer; required): defines the price by the ratio oftrx_num/num.num(integer; required): defines the price by the ratio oftrx_num/num.start_time(integer; required): ICO start time.end_time(integer; required): ICO end time.description(string; hex; required): a token description.url(string; hex; required): a token's official website URL.free_asset_net_limit(integer; required): a token's free asset net limit.public_free_asset_net_limit(integer; required): a token's public asset net limit.frozen_supply(object: required): token staked supply:frozen_amount(integer; required): the amount staked.frozen_days(integer; required): the number of days.
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/createassetissue' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
"name": "0x6173736574497373756531353330383934333132313538",
"abbr": "0x6162627231353330383934333132313538",
"total_supply": 4321,
"trx_num": 1,
"num": 1,
"start_time": 1530894315158,
"end_time": 1533894312158,
"description": "007570646174654e616d6531353330363038383733343633",
"url": "007570646174654e616d6531353330363038383733343633",
"free_asset_net_limit": 10000,
"public_free_asset_net_limit": 10000,
"frozen_supply": {
"frozen_amount": 1,
"frozen_days": 2
}
}'
wallet/updatewitness
Updates the witness's website URL.
Parameters
owner_address(string; hex; required): an owner address.update_url(string; hex; required): a website URL.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/updatewitness' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292",
"update_url": "007570646174654e616d6531353330363038383733343633"
}'
wallet/createaccount
Creates an account.
Parameters
owner_address(string; hex; required): an owner address.account_address(string; hex; required): a new address.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/createaccount' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292",
"account_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0"
}'
wallet/createwitness
Applies to become a witness.
Parameters
owner_address(string; hex; required): an owner address.url(string; hex; required): a website URL.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/createwitness' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292",
"url": "007570646174654e616d6531353330363038383733343633"
}'
wallet/transferasset
Transfers a token.
Parameters
owner_address(string; hex; required): an owner address.to_address(string; hex; required): a destination address.asset_name(string; hex; required): a token ID.amount(integer; required): a token 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/transferasset' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292",
"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
"asset_name": "31303030303031",
"amount": 100
}'
wallet/participateassetissue
Participates a token.
Returns a transaction object.
Parameters
to_address(string; hex; required): the issuer address of the token.owner_address(string; hex; required): the participant address.amount(integer; required): a participate token amount.asset_name(string; hex; required): a token ID.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/participateassetissue' \
-H 'Content-Type: application/json' \
-d '{
"to_address": "41e552f6487585c2b58bc2c9bb4492bc1f17132cd0",
"owner_address": "41e472f387585c2b58bc2c9bb4492bc1f17342cd1",
"amount": 100,
"asset_name": "3230313271756265696a696e67"
}'
wallet/freezebalance
Stakes TRX.
Parameters
owner_address(string; hex; required): an owner address.frozen_balance(integer; required): a TRX stake amount.frozen_duration(integer; required): TRX stake duration, at least 3 days.resource(string; required): TRX stake type (BANDWIDTH/ENERGY).receiver_address(string; hex; required): the address to receive the resource.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/freezebalance' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41e472f387585c2b58bc2c9bb4492bc1f17342cd1",
"frozen_balance": 10000,
"frozen_duration": 3,
"resource": "BANDWIDTH",
"receiver_address": "414332f387585c2b58bc2c9bb4492bc1f17342cd1"
}'
wallet/unfreezebalance
Unstakes the staked TRX that is due.
Parameters
owner_address(string; hex; required): an owner address.resource(string; required): staked TRX unstake type (BANDWIDTH/ENERGY).receiver_address(string; hex; required): the address to lose the resource.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/unfreezebalance' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41e472f387585c2b58bc2c9bb4492bc1f17342cd1",
"resource": "BANDWIDTH",
"receiver_address": "414332f387585c2b58bc2c9bb4492bc1f17342cd1"
}'
wallet/unfreezeasset
Unstakes the staked token that is due.
Parameters
owner_address(string; hex; required): an owner address.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/unfreezeasset' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41e472f387585c2b58bc2c9bb4492bc1f17342cd1"
}'
wallet/withdrawbalance
Withdraws a reward to an account balance for witnesses.
Parameters
owner_address(string; hex; required): an owner address.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/withdrawbalance' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41e472f387585c2b58bc2c9bb4492bc1f17342cd1"
}'
wallet/updateasset
Updates token information.
Parameters
owner_address(string; hex; required): an owner address.description(string; hex; required): a token description.url(string; hex): the token's website URL.new_limit(integer; required): each token holder's free bandwidth.new_public_limit(integer; required): the total free bandwidth of the token.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/updateasset' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "41e472f387585c2b58bc2c9bb4492bc1f17342cd1",
"description": "",
"url": "",
"new_limit": 1000000,
"new_public_limit": 100
}'
wallet/getassetissuebyaccount
Retrieves the token issue information of an account.
Parameters
address(string; hex; required): a token issuer's address.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getassetissuebyaccount' \
-H 'Content-Type: application/json' \
-d '{
"address": "41F9395ED64A6E1D4ED37CD17C75A1D247223CAF2D"
}'
wallet/getaccountnet
Retrieves the bandwidth information of an account.
Parameters
address(string; hex; required): an account address.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getaccountnet' \
-H 'Content-Type: application/json' \
-d '{
"address": "4112E621D5577311998708F4D7B9F71F86DAE138B5"
}'
Response example
{
"freeNetLimit": 1500,
"assetNetUsed": [
{
"key": "1000532",
"value": 0
},
{
"key": "1002962",
"value": 0
},
{
"key": "1002775",
"value": 0
},
{
"key": "1002573",
"value": 0
},
{
"key": "1003049",
"value": 0
},
{
"key": "1001871",
"value": 0
},
{
"key": "1002927",
"value": 0
},
{
"key": "1002636",
"value": 0
}
],
"assetNetLimit": [
{
"key": "1000532",
"value": 0
},
{
"key": "1002962",
"value": 0
}
],
"TotalNetLimit": 43200000000,
"TotalNetWeight": 39127812682
}
wallet/getassetissuebyname
Retrieves a token by token name.
If the token name you query is not unique, this api will return an error.
Parameters
value(string; hex; required): a token name.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getassetissuebyname' \
-H 'Content-Type: application/json' \
-d '{
"value": "44756354616E"
}'
wallet/getassetissuelistbyname
Retrieves the list of tokens by name.
Parameters
value(string; hex; required): a token name.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getassetissuelistbyname' \
-H 'Content-Type: application/json' \
-d '{
"value": "44756354616E"
}'
wallet/getassetissuebyid
Retrieves a token by token ID.
Parameters
value(string; hex; required): a token ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getassetissuebyid' \
-H 'Content-Type: application/json' \
-d '{
"value": "1000001"
}'
Response example
{
"owner_address": "414d1ef8673f916debb7e2515a8f3ecaf2611034aa",
"name": "53454544",
"abbr": "53454544",
"total_supply": 100000000000,
"trx_num": 1000000,
"num": 1,
"start_time": 1529987043000,
"end_time": 1530342060000,
"description": "536573616d657365656420746f6b656e7320666f7220636f6d6d756e697479207265776172647320616e6420534545446765726d696e61746f7220696e766573746d656e74206f6620636f6d6d756e6974792d766f7465642070726f6a656374732e",
"url": "687474703a2f2f7777772e736573616d65736565642e6f7267",
"id": "1000001"
}
wallet/getnowblock
Retrieves the latest block information.
Parameters
None.
Request example
curl -X GET 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getnowblock'
Response example
{
"blockID": "0000000002fae045b2c5caae3229fa17f2b9b00c603d19f535581f1ae934d63c",
"block_header": {
"raw_data": {
"number": 49995845,
"txTrieRoot": "3c06f5e0afe80d8eebf9bc4c019df67c72a4be68d609f69dc1d14147b7aabe02",
"witness_address": "41d376d829440505ea13c9d1c455317d51b62e4ab6",
"parentHash": "0000000002fae044905f37c65c913d5eac3ceaed495131f13aa657f7f336efe2",
"version": 27,
"timestamp": 1680600327000
},
"witness_signature": "01f4d3e47766bd5f763cf53520b0832add1743560a11e43ad1f4f9b1478f494b6c731d5e53096922c00fc5398fbbc68e77e9b5087d064bb33fa1d8685a35bba201"
},
"transactions": [
{
"ret": [
{
"contractRet": "SUCCESS"
}
],
"signature": [
"af028c602ab25e6b701ce5266810d6353e6d7642cf6eb3630554b9e3c09da1e5763f386cc91b726f9fcbbe0a356ba295902397fb9e1d99079be816c2a9775cc701"
],
"txID": "a0f90e85c0969407e8a02a8c25fd752e6a84c42230f05c71f0d07d23be68102d",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"amount": 2500000000,
"owner_address": "4159f33c7dcdfb016f14e38f28a3e6ece9ade61c3a",
"to_address": "4158c708263724a4b52701f80f63a0c314153317ed"
},
"type_url": "type.googleapis.com/protocol.TransferContract"
},
"type": "TransferContract"
}
],
"ref_block_bytes": "e030",
"ref_block_hash": "b977ba00ada6335d",
"expiration": 1680600499747,
"timestamp": 1680600319747
},
"raw_data_hex": "0a02e0302208b977ba00ada6335d40a38ce2dcf4305a69080112650a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412340a154159f33c7dcdfb016f14e38f28a3e6ece9ade61c3a12154158c708263724a4b52701f80f63a0c314153317ed1880f28ba80970838ed7dcf430"
}
]
}
wallet/getblockbynum
Retrieves block information by block height.
Parameters
num(integer; required): a block height.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getblockbynum' \
-H 'Content-Type: application/json' \
-d '{
"num": 1
}'
Response example
{
"blockID": "00000000000000010ff5414c5cfbe9eae982e8cef7eb2399a39118e1206c8247",
"block_header": {
"raw_data": {
"number": 1,
"txTrieRoot": "0000000000000000000000000000000000000000000000000000000000000000",
"witness_address": "415095d4f4d26ebc672ca12fc0e3a48d6ce3b169d2",
"parentHash": "00000000000000001ebf88508a03865c71d452e25f4d51194196a1d22b6653dc",
"timestamp": 1529891469000
},
"witness_signature": "4544a6004c76286a1d6248f451bf148345a51e21881e84899758468da7b1c7e85b809735a1b2be29f166cfba8c5e69543f4f24294fbfa0498a39002166a397ba00"
}
}
wallet/getblockbyid
Retrieves a block information by block ID.
Parameters
value(string; hex; required): a block ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getblockbyid' \
-H 'Content-Type: application/json' \
-d '{
"value": "0000000002fac94622cce188d5cf0fe3e7d9c27e5a01bdf9356b7ef35eeab160"
}'
Response example
{
"blockID": "0000000002fac94622cce188d5cf0fe3e7d9c27e5a01bdf9356b7ef35eeab160",
"block_header": {
"raw_data": {
"number": 49989958,
"txTrieRoot": "05f50bb51b90efe53d2d9c6df915c679df083d34c30055a2fc87419980f246f6",
"witness_address": "4178c842ee63b253f8f0d2955bbc582c661a078c9d",
"parentHash": "0000000002fac9457ebb855883515d42995029edb217a405aa47aadd8252b6d1",
"version": 27,
"timestamp": 1680582660000
},
"witness_signature": "b973f3bfd45138beffbdcad06277886ade7941eefec2aebf5dc8061547c5846255dcb4b2316839b33f574ffe2c301d04c2c27f12a941faf3747b8c2dca325c1f01"
},
"transactions": [
{
"ret": [
{
"contractRet": "SUCCESS"
}
],
"signature": [
"76b8a945442917034f7cfb2f6eed70c3f4e37f1ca396221bea0edf991cef8c8c7d8b93c944e6da2f76a4550d25eb64ffecb49b7617fc166398d566dfe9b1e80800"
],
"txID": "4caa8909391afd3dfb28a3d332e735f3cdcddf1d4081ede54f82d9de208a85b9",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"amount": 300000000,
"owner_address": "413c6120b82a61d0e0bb0c4d4ebfae56cb664ba5a6",
"to_address": "411ba55baf1e61fa22907822730ebfe7a5cf573ad5"
},
"type_url": "type.googleapis.com/protocol.TransferContract"
},
"type": "TransferContract"
}
],
"ref_block_bytes": "c932",
"ref_block_hash": "6a781a380ccdd036",
"expiration": 1680582714000,
"timestamp": 1680582656449
},
"raw_data_hex": "0a02c93222086a781a380ccdd0364090c5a4d4f4305a69080112650a2d747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412340a15413c6120b82a61d0e0bb0c4d4ebfae56cb664ba5a61215411ba55baf1e61fa22907822730ebfe7a5cf573ad51880c6868f0170c183a1d4f430"
}
]
}
wallet/getblockbylimitnext
Retrieves a list of blocks by range.
Parameters
startNum(integer; required): the block height to start with (included in the range).endNum(integer; required): the block height to end by (excluded from the range)
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/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"
}
}
]
}