TRON — SolidityNode API (1/4)
API reference for TRON. All methods ->
wallet/getaccount
Retrieves account information.
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/getaccount' \
-H 'Content-Type: application/json' \
-d '{
"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"
}'
Response example
[
{
"blockNumber": 49989959,
"contractResult": [
""
],
"blockTimeStamp": 1680582663000,
"receipt": {
"net_usage": 268
},
"id": "1dca7ae3d0fc5b73b5bc3ede1d2eb1b63fc128fce39196088a2198ff83fbc5ed"
},
{
"blockNumber": 49989959,
"contractResult": [
""
],
"blockTimeStamp": 1680582663000,
"receipt": {
"net_usage": 265
},
"id": "04d86b079842247e14cd0c4648e315b78c861eb91abcaf4e022f88155b73f628"
},
{
"blockNumber": 49989959,
"contractResult": [
""
],
"blockTimeStamp": 1680582663000,
"receipt": {
"net_usage": 280
},
"id": "a1b550fa6681c4afc90f619a2fa4ca26305b09bc964bef5a833123626e451391"
}
]
wallet/listwitnesses
Retrieves the list of witnesses.
Parameters
None.
Request example
curl -X GET 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/listwitnesses'
Response example
{
"witnesses": [
{
"address": "4100e9fdbd1d24ab56996bd37d76fb7b16dcf62ff1",
"voteCount": 1087436,
"url": "https://www.tronmacau.com"
},
{
"address": "41012f81bd368f632fb22b9ddfeb284155f1f04198",
"voteCount": 314,
"url": "https://firekraken.media"
},
{
"address": "4101c17562ee5a1ecb60f9ea6e49ef94ec0de99580",
"voteCount": 377,
"url": "https://tronpad.com"
},
{
"address": "41021957c4576cbeae8bdf0576248e3e486a4cf3fa",
"voteCount": 5,
"url": "HTTPS://BEFREE"
},
{
"address": "41022939a4a06cbc7b384096c1af8657ec435173af",
"voteCount": 1404388255,
"url": "antinvestmentgroup",
"totalProduced": 895427,
"totalMissed": 1119,
"latestBlockNum": 49996531,
"latestSlotNum": 560200795,
"isJobs": true
},
{
"address": "4102a0ed82a9609e7ea9155f00137dc3fce818033f",
"voteCount": 98954,
"url": "XREGlobal.com"
}
]
}
wallet/getassetissuelist
Retrieves the list of all tokens.
Parameters
None.
Request example
curl -X GET 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getassetissuelist'
Response example
{
"assetIssue": [
{
"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"
},
{
"owner_address": "410b53ce4aa6f0c2f3c849f11f682702ec99622e2e",
"name": "545258",
"abbr": "545258",
"total_supply": 99000000000,
"trx_num": 1000000,
"num": 1,
"start_time": 1529989896000,
"end_time": 1537632000000,
"description": "74726f6e546f6b656e",
"url": "68747470733a2f2f74726f6e2e6e6574776f726b",
"id": "1000002"
},
{
"owner_address": "41d13433f53fdf88820c2e530da7828ce15d6585cb",
"name": "49504653",
"abbr": "49504653",
"total_supply": 100000000000,
"trx_num": 1000000,
"num": 1,
"start_time": 1529990700000,
"end_time": 1537632000000,
"description": "4950465320636f696e",
"url": "687474703a2f2f",
"id": "1000003"
}
]
}
wallet/getpaginatedassetissuelist
Retrieves the list of all tokens by pagination.
Parameters
offset(integer; required): the index of the start token.limit(integer; required): the amount of tokens per page.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getpaginatedassetissuelist' \
-H 'Content-Type: application/json' \
-d '{
"offset": 0,
"limit": 10
}'
Response example
{
"assetIssue": [
{
"owner_address": "416b1171698969a36e5eb2eb6ea7aa9204d5e10cfc",
"name": "21212121474f4c44434f494e",
"abbr": "474f4c44",
"total_supply": 9000000000000000000,
"trx_num": 1000000,
"num": 1000,
"start_time": 1556094180182,
"end_time": 1871799840182,
"description": "474f4c44",
"url": "68747470733a2f2f676f6c64636861696e2e78797a",
"id": "1002341"
},
{
"owner_address": "418f82a73b283c7bf8515fa3cc2c0399d4d593e2e3",
"name": "21212121476f6c6453706f7421212121",
"abbr": "476f6c64",
"total_supply": 99000000000,
"frozen_supply": [
{
"frozen_amount": 2000000000,
"frozen_days": 30
}
],
"trx_num": 1000000,
"num": 100,
"start_time": 1559106000646,
"end_time": 1609451940646,
"description": "476f6c6453706f7420666f6c6c6f7720746865207072696365206f6620676f6c6420696e2074686520626c6f636b636861696e212121204f776e6572732077696c6c2067657420414753202861476f6c6453706f74292064726f70206d6f6e74686c792e20476f6c6453706f742077696c6c20626520757067726164656420746f206120747263323020696e20323032302e20496e7665737420696e2074686520676f6c64206d61726b657421212120476c6f62616c20476f6c6420547261646572732121",
"url": "7777772e676f6c6473706f742e6575",
"id": "1002467"
}
]
}
wallet/getpaginatedproposallist
Retrieves the list of all proposals by pagination.
Parameters
offset(integer; required): the index of the proposals starting position.limit(integer; required): the amount of proposals per page.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getpaginatedproposallist' \
-H 'Content-Type: application/json' \
-d '{
"offset": 0,
"limit": 10
}'
Response example
{
"proposals": [
{
"proposal_id": 1,
"proposer_address": "41c189fa6fc9ed7a3580c3fe291915d5c6a6259be7",
"parameters": [
{
"key": 9,
"value": 1
}
],
"expiration_time": 1539259200000,
"create_time": 1538981229000,
"approvals": [
"41c189fa6fc9ed7a3580c3fe291915d5c6a6259be7",
"4167e39013be3cdd3814bed152d7439fb5b6791409",
"418c66e4883782b793fcf2dcb92b23eece57769499",
"41bac7378c4265ad2739772337682183b8864f517a",
"414a193c92cd631c1911b99ca964da8fd342f4cddd",
"41d25855804e4e65de904faf3ac74b0bdfc53fac76",
"4193a8bc2e7d6bb1bd75fb2d74107ffbda81af439d",
"41d1dbde8b8f71b48655bec4f6bb532a0142b88bc0",
"417b88db9da8aacae0a7e967d24c0fc00129e815f6",
"41243accc5241d97ce79272b06952ee88a34d8e1f9",
"41f70386347e689e6308e4172ed7319c49c0f66e0b",
"41d49bf5202b3dba65d46a5be73396b6b66d3555aa",
"41beab998551416b02f6721129bb01b51fceceba08",
"412fb5abdf8a1670f533c219e7251fe30b89849359",
"4116440834509c59de4ee6ba4933678626f451befe",
"414d1ef8673f916debb7e2515a8f3ecaf2611034aa",
"415863f6091b8e71766da808b1dd3159790f61de7d",
"4138e3e3a163163db1f6cfceca1d1c64594dd1f0ca",
"41fc45da0e51966bd1af2cb1e0f66633f160603a8b",
"41d376d829440505ea13c9d1c455317d51b62e4ab6",
"41b487cdc02de90f15ac89a68c82f44cbfe3d915ea",
"411103d62d8299e90fa011b4ce7fc6ba151e5f1a23"
],
"state": "APPROVED"
}
]
}
wallet/getpaginatedexchangelist
Retrieves the list of all exchange pairs by pagination.
Parameters
offset(integer; required): the index of the starting exchange pair.limit(integer; required): the amount of exchange pairs per page.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getpaginatedexchangelist' \
-H 'Content-Type: application/json' \
-d '{
"offset": 0,
"limit": 10
}'
Response example
{
"exchanges": [
{
"exchange_id": 1,
"creator_address": "41f596e85bfd042744f76880979a133da0728679d9",
"create_time": 1539673398000,
"first_token_id": "31303030353634",
"first_token_balance": 5,
"second_token_id": "5f",
"second_token_balance": 4326459
},
{
"exchange_id": 2,
"creator_address": "41cd3444bd2d493628b14d6dcec93181e15f94d169",
"create_time": 1541678472000,
"first_token_id": "31303031333035",
"first_token_balance": 1,
"second_token_id": "5f",
"second_token_balance": 3015102
},
{
"exchange_id": 3,
"creator_address": "412d7bdb9846499a2e5e6c5a7e6fb05731c83107c7",
"create_time": 1541717787000,
"first_token_id": "31303030303138",
"second_token_id": "5f"
}
]
}
wallet/getnextmaintenancetime
Retrieves the time interval till the next vote round.
Parameters
None.
Request example
curl -X GET 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getnextmaintenancetime'
Response example
{
"num": 1680609600000
}
wallet/validateaddress
Checks the validity of the address.
Parameters
address(string; hex; required): an address to check.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/validateaddress' \
-H 'Content-Type: application/json' \
-d '{
"address": "4189139CB1387AF85E3D24E212A008AC974967E561"
}'
Response example
{
"result": true,
"message": "Hex string format"
}
wallet/deploycontract
Deploys a smart contract.
Parameters
abi(array of key-value pairs; required): an ABI.bytecode(string; hex; required): bytecode.parameter(string; hex; optional): the list of constructor parameters, converted to Hex after being encoded according to ABI encoder.call_value(integer; required): a TRX transfer to the contract for each call.name(string; required): a contract name.consume_user_resource_percent(integer; required): the percentage of user's resource consumption; an integer between [0, 100]; 0 means it does not consume user's resource until the developer's resource has been used up.fee_limit(integer; required): the maximum TRX burns for resource consumption.origin_energy_limit(integer; required): the maximum resource consumption of the creator in one execution or creation.owner_address(string; hex; required): an owner address of the contract.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/deploycontract' \
-H 'Content-Type: application/json' \
-d '{
"abi": "[{\"constant\":false,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"key\",\"type\":\"uint256\"}],\"name\":\"get\",\"outputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]",
"bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029",
"parameter": "",
"call_value": 100,
"name": "SomeContract",
"consume_user_resource_percent": 30,
"fee_limit": 10,
"origin_energy_limit": 10,
"owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292"
}'
Response example
{
"visible": false,
"txID": "b0311a4ac0b819f06be5957ca5ec707d6e1e2895db615f1e98d314780f821b89",
"contract_address": "41a1bade45e57cd6883d745f3cfaa9e71e60a1ea70",
"raw_data": {
"contract": [
{
"parameter": {
"value": {
"owner_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292",
"new_contract": {
"bytecode": "608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b25040029",
"consume_user_resource_percent": 30,
"name": "SomeContract",
"origin_address": "41d1e7a6bc354106cb410e65ff8b181c600ff14292",
"abi": {
"entrys": [
{
"inputs": [
{
"name": "key",
"type": "uint256"
},
{
"name": "value",
"type": "uint256"
}
],
"name": "set",
"stateMutability": "Nonpayable",
"type": "Function"
},
{
"outputs": [
{
"name": "value",
"type": "uint256"
}
],
"constant": true,
"inputs": [
{
"name": "key",
"type": "uint256"
}
],
"name": "get",
"stateMutability": "View",
"type": "Function"
}
]
},
"origin_energy_limit": 10,
"call_value": 100
}
},
"type_url": "type.googleapis.com/protocol.CreateSmartContract"
},
"type": "CreateSmartContract"
}
],
"ref_block_bytes": "e938",
"ref_block_hash": "16069bb4f2f73549",
"expiration": 1680607314000,
"fee_limit": 10,
"timestamp": 1680607256012
},
"raw_data_hex": "0a02e938220816069bb4f2f7354940d08082e0f4305add03081e12d8030a30747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e437265617465536d617274436f6e747261637412a3030a1541d1e7a6bc354106cb410e65ff8b181c600ff142921289030a1541d1e7a6bc354106cb410e65ff8b181c600ff142921a5c0a2b1a03736574220e12036b65791a0775696e743235362210120576616c75651a0775696e74323536300240030a2d10011a03676574220e12036b65791a0775696e743235362a10120576616c75651a0775696e743235363002400222fd01608060405234801561001057600080fd5b5060de8061001f6000396000f30060806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631ab06ee58114604d5780639507d39a146067575b600080fd5b348015605857600080fd5b506065600435602435608e565b005b348015607257600080fd5b50607c60043560a0565b60408051918252519081900360200190f35b60009182526020829052604090912055565b600090815260208190526040902054905600a165627a7a72305820fdfe832221d60dd582b4526afa20518b98c2e1cb0054653053a844cf265b250400292864301e3a0c536f6d65436f6e7472616374400a70ccbbfedff43090010a"
}
wallet/triggersmartcontract
Triggers a smart contract.
Note: The unit of TRX in the parameters is SUN.
Parameters
contract_address(string; hex; required): a contract address.function_selector(string; required): a function call; must not leave any blank space.parameter(string; required): the parameter passed tofunction_selector; the format must match with the VM's requirements; you can use a tool provided by remix to convert a parameter [1,2] into the format required by VM.fee_limit(integer; required): the maximum TRX burns for resource consumption.call_value(integer; required): the TRX transfer to the contract for each call.owner_address(string; hex; required): an owner address that triggers the contract.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/triggersmartcontract' \
-H 'Content-Type: application/json' \
-d '{
"contract_address": "4189139CB1387AF85E3D24E212A008AC974967E561",
"function_selector": "set(uint256,uint256)",
"parameter": "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002",
"fee_limit": 10,
"call_value": 100,
"owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292"
}'
Response example
{
"result": {
"code": "CONTRACT_VALIDATE_ERROR",
"message": "4e6f20636f6e7472616374206f72206e6f7420612076616c696420736d61727420636f6e7472616374"
}
}
wallet/getcontract
Retrieves a contract.
Parameters
value(string; hex; required): a contract address.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getcontract' \
-H 'Content-Type: application/json' \
-d '{
"value": "4189139CB1387AF85E3D24E212A008AC974967E561"
}'
wallet/proposalcreate
Creates a proposal.
Parameters
owner_address(string; hex; required): a creator address.parameters(array of objects): proposal parameters.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/proposalcreate' \
-H 'Content-Type: application/json' \
-d '{
"owner_address": "419844F7600E018FD0D710E2145351D607B3316CE9",
"parameters": [
{
"key": 0,
"value": 100000
},
{
"key": 1,
"value": 2
}
]
}'
wallet/getproposalbyid
Retrieves a proposal by proposal ID.
Parameters
id(integer; required): a proposal ID.
Request example
curl -X POST 'https://rpc.ankr.com/premium-http/tron/YOUR_ANKR_API_KEY/wallet/getproposalbyid' \
-H 'Content-Type: application/json' \
-d '{
"id": 1
}'
Response example
{
"proposal_id": 1,
"proposer_address": "41c189fa6fc9ed7a3580c3fe291915d5c6a6259be7",
"parameters": [
{
"key": 9,
"value": 1
}
],
"expiration_time": 1539259200000,
"create_time": 1538981229000,
"approvals": [
"41c189fa6fc9ed7a3580c3fe291915d5c6a6259be7",
"4167e39013be3cdd3814bed152d7439fb5b6791409",
"418c66e4883782b793fcf2dcb92b23eece57769499",
"41bac7378c4265ad2739772337682183b8864f517a",
"414a193c92cd631c1911b99ca964da8fd342f4cddd",
"41d25855804e4e65de904faf3ac74b0bdfc53fac76",
"4193a8bc2e7d6bb1bd75fb2d74107ffbda81af439d",
"41d1dbde8b8f71b48655bec4f6bb532a0142b88bc0",
"417b88db9da8aacae0a7e967d24c0fc00129e815f6",
"41243accc5241d97ce79272b06952ee88a34d8e1f9",
"41f70386347e689e6308e4172ed7319c49c0f66e0b",
"41d49bf5202b3dba65d46a5be73396b6b66d3555aa",
"41beab998551416b02f6721129bb01b51fceceba08",
"412fb5abdf8a1670f533c219e7251fe30b89849359",
"4116440834509c59de4ee6ba4933678626f451befe",
"414d1ef8673f916debb7e2515a8f3ecaf2611034aa",
"415863f6091b8e71766da808b1dd3159790f61de7d",
"4138e3e3a163163db1f6cfceca1d1c64594dd1f0ca",
"41fc45da0e51966bd1af2cb1e0f66633f160603a8b",
"41d376d829440505ea13c9d1c455317d51b62e4ab6",
"41b487cdc02de90f15ac89a68c82f44cbfe3d915ea",
"411103d62d8299e90fa011b4ce7fc6ba151e5f1a23"
],
"state": "APPROVED"
}