HTTP API
This article introduces FullNode's HTTP APIs and their usage.
First, Let's explain the selection of the address format in the HTTP API: Account addresses of the TRON network have two formats: HexString format and Base58 format. The Fullnode HTTP API supports address format selection. Users can set the address format through the visible
parameter. The default value is false
and the address format in the parameter and return value is hex format. When visible
is set to true
, the address format in the parameter and return value are in Base58 format. If the parameter format does not match the visible
setting, an error will be reported. Setting method:
For HTTP GET API or the api needs no parameter: by adding
visible=true
parameter to the url
For POST API: By adding
"visible": true
parameter to the most out layer of the json
Fullnode HTTP API
The FullNode HTTP API is categorized as follows:
Accounts
Transfer and Transactions
Account Resources
Query The Network
Smart Contracts
TRC-10 Token
Voting & SRs
Proposals
DEX Exchange
TRONZ Shielded Smart Contract
Pending Pool
Accounts
The following are the APIs related to on-chain accounts:
wallet/validateaddress
wallet/createaccount
wallet/getaccount
wallet/updateaccount
wallet/accountpermissionupdate
wallet/getaccountbalance
wallet/setaccountid
wallet/getaccountbyid
wallet/validateaddress
Description: Check the validity of the address
Parameters: address
Return: the address is correct or not
wallet/createaccount
Description: Create an account. Uses an already activated account to create a new account. If the owner_address has enough bandwidth obtained by freezing TRX, then creating an account will only consume bandwidth , otherwise, 0.1 TRX will be burned to pay for bandwidth, and at the same time, 1 TRX will be required to be created.
Parameters:
owner_address
Owner address, default hexStringaccount_address
New address, default hexStringPermission_id
Optional, for multi-signature use
Return: Unsigned transaction object
wallet/getaccount
Description: Query an account information
Parameters: address
- account address
Return: Account object
wallet/updateaccount
Description: Update the name of an account
Parameters:
account_name
Account name, default hexStringowner_address
Owner address, default hexStringPermission_id
Optional, for multi-signature use
Return: Transaction
wallet/accountpermissionupdate
Description: Update the account's permission.
Parameters:
owner_address: Owner address of the account, default hexString
owner: Account owner permission
witness: Account witness permission, only for witness
actives: List of active permissions for the account
Return: Unsigned transaction
wallet/getaccountbalance
Description: Get the account balance in a specific block.
Parameters:
account_identifier
: The account address.block_identifier
: The block number.
Return: The balance object of the account in a specific block, the block_identifier
is the block hash.
wallet/setaccountid
Description: To set an account id for an account
Parameters:
owner_address
: Owner address, default hexStringaccount_id
:Account id, default hexString
Return: Unsigned transaction
wallet/getaccountbyid
Description: Query an account information by account id
Parameters: account_id
Account id, default hexString
Return:Account object
Transfers and transactions
The following are transfer and transaction related APIs:
wallet/createtransaction
wallet/broadcasttransaction
wallet/broadcasthex
wallet/getsignweight
wallet/getapprovedlist
wallet/createtransaction
Description: Create a transfer transaction, if to address is not existed, then create the account on the blockchain
Parameters:
to_address
To address, default hexStringowner_address
Owner address, default hexStringamount
Transfer amountPermission_id
Optional, for multi-signature use
Return: Unsigned transaction
wallet/broadcasttransaction
Description: Broadcast transaction after sign
Parameters: Transaction after sign
Return:The result of the broadcast
wallet/broadcasthex
Description: Broadcast transaction hex string after sign
Parameters: Transaction hex after sign
Return: The result of the broadcast
wallet/getsignweight
Description: Query the current signatures total weight of a transaction after sign
Parameters: Transaction object after sign
Return: The current signatures total weight
wallet/getapprovedlist
Description: Query the signatures list of a transaction after sign
Parameter: Transaction object after sign
Return: The list of the signatures
Account Resources
The following are account resource related APIs:
wallet/getaccountresource
wallet/getaccountnet
wallet/unfreezebalance
wallet/getdelegatedresource
wallet/getdelegatedresourceaccountindex
wallet/freezebalancev2
wallet/unfreezebalancev2
wallet/cancelallunfreezev2
wallet/delegateresource
wallet/undelegateresource
wallet/withdrawexpireunfreeze
wallet/getavailableunfreezecount
wallet/getcanwithdrawunfreezeamount
wallet/getcandelegatedmaxsize
wallet/getdelegatedresourcev2
wallet/getdelegatedresourceaccountindexv2
wallet/getaccountresource
Description: Query the resource information of an account
Parameters:
address
: Address, default hexString
Return: The resource information
wallet/getaccountnet
Description: Query the bandwidth information of an account
Parameters: address
- Address, default hexString
Return: Bandwidth information
wallet/freezebalance
Description: Stake TRX. This interface has been deprecated, please use FreezeBalanceV2 to stake TRX to obtain resources.
wallet/unfreezebalance
Description: Unstake the TRX that staked during stake1.0 phase.
Parameters:
owner_address
Owner address, default hexStringresource
unstake type 'BANDWIDTH' or 'ENERGY'receiverAddress
The address that will lose the resource, default hexStringPermission_id
Optional, for multi-signature use
Return: Unsigned transaction
wallet/getdelegatedresource
Description: Query the resource delegation information
Parameters:
fromAddress
: from address, default hexStringtoAddress
: to address, default hexString
Return: Resource delegation information
wallet/getdelegatedresourceaccountindex
Description: Query the resource delegation by an account during stake1.0 phase. i.e. list all addresses that have delegated resources to an account.
Parameters:
value
: account address
Return:resource delegation index
wallet/freezebalancev2
Description: Stake TRX
Parameters:
owner_address
: Owner address, default hexStringfrozen_balance
: TRX stake amount, the unit is sunresource
: TRX stake type, 'BANDWIDTH' or 'ENERGY'permission_id
: Optional, for multi-signature use
Return: Unsigned transaction
wallet/unfreezebalancev2
Description: Unstake some TRX staked in Stake2.0, release the corresponding amount of bandwidth or energy, and voting rights (TP)
Parameters:
owner_address
: Owner address, default hexStringresource
: Resource type: 'BANDWIDTH' or 'ENERGY'unfreeze_balance
: The amount of TRX to unstake, in sunpermission_id
: Optional, for multi-signature use
Return:Unsigned transaction
wallet/cancelallunfreezev2
Description: Cancel unstakings, all unstaked funds still in the waiting period will be re-staked, all unstaked funds that exceeded the 14-day waiting period will be automatically withdrawn to the owner’s account
Parameters:
owner_address
: Owner address, default hexStringpermission_id
: Optional, for multi-signature use
Return:Unsigned transaction
wallet/delegateresource
Description: Delegate bandwidth or energy resources to other accounts in Stake2.0.
Parameters:
owner_address
: Account addressreceiver_address
: Resource receiver addressbalance
: Amount of TRX staked for resources to be delegated, unit is sunresource
: Resource type: 'BANDWIDTH' or 'ENERGY'lock
: Whether it is locked, if it is set to true, the delegated resources cannot be undelegated within 3 days. When the lock time is not over, if the owner delegates the same type of resources using the lock to the same address, the lock time will be reset to 3 dayslock_period
: lock time,The unit is block interval(3 seconds), indicates the time of how many blocks will be produced from the moment the transaction is executed. Only when lock is true, this field is valid. If the delegate lock period is 1 day, the lock_period is: 28800permission_id
: Optional, for multi-signature use
Return:Unsigned transaction
wallet/undelegateresource
Description: Cancel the delegation of bandwidth or energy resources to other account
Parameters:
owner_address
: Account addressreceiver_address
: Resource receiver addressbalance
: Amount of TRX staked for resources to be delegated, unit is sunresource
: Resource type: 'BANDWIDTH' or 'ENERGY'permission_id
: Optional, for multi-signature use
Return:Unsigned transaction
wallet/withdrawexpireunfreeze
Description: Withdraw unfrozen balance in Stake2.0, the user can call this API to get back their funds after executing /wallet/unfreezebalancev2 transaction and waiting N days, N is a network parameter
Parameters:
owner_address
: Account addresspermission_id
: Optional, for multi-signature use
Return: Unsigned transaction
wallet/getavailableunfreezecount
Description:Remaining times of executing unstake operation in Stake2.0
Parameters:
owner_address
: Account address
Return:Remaining times of available unstaking.
wallet/getcanwithdrawunfreezeamount
Description:Query the withdrawable balance at the specified timestamp In Stake2.0
Parameters:
owner_address
: Account addresstimestamp
: query cutoff timestamp, in milliseconds.
Return: withdrawable balance, unit is sun.
wallet/getcandelegatedmaxsize
Description: In Stake2.0, query the amount of delegatable resources share of the specified resource type for an address, unit is sun.
Parameters:
owner_address
: Account addresstype
: resource type, 0 is bandwidth, 1 is energy
Return:the amount of delegatable resource share, unit is sun.
wallet/getdelegatedresourcev2
In Stake2.0, query the detail of resource share delegated from fromAddress to toAddress
Parameters:
fromAddress
: resource from address, default hexStringtoAddress
: resource to address
Return:Resource delegation list
wallet/getdelegatedresourceaccountindexv2
In Stake2.0, query the resource delegation index by an account. Two lists will return, one is the list of addresses the account has delegated its resources(toAddress), and the other is the list of addresses that have delegated resources to the account(fromAddress).
Parameters:
value
: account address
Return:Two lists will return, one is the list of addresses the account has delegated its resources(toAddress), and the other is the list of addresses that have delegated resources to the account(fromAddress).
Query The Network
The following is the API for querying data on the chain:
wallet/getnowblock
wallet/getblock
wallet/getblockbynum
wallet/getblockbyid
wallet/getblockbylatestnum
wallet/getblockbylimitnext
wallet/getblockbalance
wallet/gettransactionbyid
wallet/gettransactioninfobyid
wallet/gettransactioncountbyblocknum
wallet/gettransactioninfobyblocknum
wallet/listnodes
wallet/getnodeinfo
wallet/getchainparameters
wallet/getenergyprices
wallet/getbandwidthprices
wallet/getburntrx
wallet/getnowblock
Description: Query the latest block information
Parameters: N/A
Return: The latest block
wallet/getblock
Query block header information or entire block information according to block height or block hash
Parameters:
id_or_num
: id_or_num can be the block height or the block hash. No value entered means to query the latest block.detail
: true means query the entire block information include the header and body. false means only query the block header information.
Return: block or block header
wallet/getblockbynum
Description: Query a block information by block height
Parameters: Block height
Return: block
wallet/getblockbyid
Description: Query a block information by block id
Parameters: Block id
Return: block
wallet/getblockbylatestnum
Description: Query the several latest blocks
Parameters: The number of the blocks expected to return
Return:The list of the blocks
wallet/getblockbylimitnext
Description: Query a list of blocks by range
Parameters:
startNum
: The start block height, itself includedendNum
: The end block height, itself not included
Return: The list of the blocks
wallet/getblockbalance
Description:Get all balance change operations in a block.
Parameters: The hash and block number must match.
Return:
wallet/gettransactionbyid
Description: Query a transaction information by transaction id
Parameters: Transaction id
Return: Transaction information
wallet/gettransactioninfobyid
Description: Query the transaction fee, block height by transaction id
Parameters: value - Transaction id
Return: Transaction fee & block height
wallet/gettransactioncountbyblocknum
Description: Query th the number of transactions in a specific block
Parameters: num - Block height
Return: The number of transactions
wallet/gettransactioninfobyblocknum
Description: Query the list of transaction information in a specific block
Parameters: num is the Block height
Return:The list of transaction information
wallet/listnodes
Description: Query the list of nodes connected to the ip of the api
Parameters: N/A
Return: The list of nodes
wallet/getchainparameters
Description: Query the parameters of the blockchain used for witnessses to create a proposal
Return: The list of parameters of the blockchain
wallet/getenergyprices
Description: Query historical energy unit price
Return: All historical energy unit price information. Each unit price change is separated by a comma. Before the colon is the millisecond timestamp, and after the colon is the energy unit price in sun.
wallet/getbandwidthprices
Description: Query historical bandwidth unit price
Return: All historical bandwidth unit price information. Each unit price change is separated by a comma. Before the colon is the millisecond timestamp, and after the colon is the bandwidth unit price in sun.
wallet/getburntrx
Description: Query the amount of TRX burned due to on-chain transaction fees since No. 54 Committee Proposal took effect
Return: Amount of TRX burned, in sun.
Smart Contracts
The following are smart contract related APIs:
wallet/getcontract
wallet/getcontractinfo
wallet/deploycontract
wallet/triggersmartcontract
wallet/triggerconstantcontract
wallet/updatesetting
wallet/updateenergylimit
wallet/clearabi
wallet/estimateenergy
wallet/getcontract
Queries a contract's information from the blockchain, including the bytecode of the contract, ABI, configuration parameters, etc.
Parameters: value - Contract address
Return:SmartContract
wallet/getcontractinfo
Queries a contract's information from the blockchain. The difference from the wallet/getcontract interface is that this interface returns not only the bytecode but also the runtime bytecode of the contract. Compared with bytecode, runtime bytecode does not contain constructor and constructor parameter information.
Parameters: value - Contract address
Return: contract's information
wallet/deploycontract
Description: Deploy a smart contract
Parameters:
abi
:abibytecode
:bytecode,hexStringparameter
:The list of the parameters of the constructor, It should be converted hexString after encoded according to ABI encoder. If constructor has no parameter, this can be optionalconsume_user_resource_percent
: Consume user's resource percentage. It should be an integer between [0, 100]. if 0, means it does not consume user's resource until the developer's resource has been used upfee_limit
: The maximum TRX burns for resource consumptioncall_value
: The TRX transfer to the contract for each callowner_address
:Owner address of the contract, default hexStringname
:Contract nameorigin_energy_limit
: The maximum resource consumption of the creator in one execution or creationcall_token_value
: The amount of trc10 token transfer to the contract for each call (Optional)token_id
:The id of trc10 token transfer to the contract (Optional)Permission_id
: Optional, for multi-signature use
Return:Unsigned transaction
wallet/triggersmartcontract
Description: Trigger smart contract
Parameters:
contract_address
: Contract address, default hexStringfunction_selector
: Function call, must not leave a blank spaceparameter
: The parameter passed to 'function_selector', the format must match with the VM's requirement. You can use a js tool provided by remix to convert a parameter like [1,2] to the format that VM requiresdata
: The data for interacting with smart contracts, including the contract function and parameters. You can choose to use this field, or you can choose to usefunction_selector
andparameter
for contract interaction. When both ofdata
andfunction_selector
exist,function_selector
is preferredfee_limit
: The maximum TRX burns for resource consumptioncall_value
: The TRX transfer to the contract for each callcall_token_value
: The amount of trc10 token transfer to the contract for each calltoken_id
: The id of trc10 token transfer to the contractowner_address
: Owner address that triggers the contract, default hexStringpermission_id
: Optional, for multi-signature use
Return:Unsigned transaction
wallet/triggerconstantcontract
Description: Trigger the constant of the smart contract, the transaction is off the blockchain
Parameters:
contract_address
: Smart contract address, default hexStringfunction_selector
: Function call, must not leave a blank spaceparameter
: The parameter passed to 'function_selector', the format must match with the VM's requirement. You can use a hs tool provided by remix to convert a parameter like [1,2] to the format that VM requiresdata
: The data for interacting with smart contracts, including the contract function and parameters. You can choose to use this field, or you can choose to usefunction_selector
andparameter
for contract interaction. When both ofdata
andfunction_selector
exist,function_selector
is preferredcall_value
: The TRX transfer to the contract for each callowner_address
: Owner address that triggers the contract, default hexStringcall_token_value
: The amount of trc10 token transfer to the contract for each calltoken_id
: The id of trc10 token transfer to the contract
Return: Transaction object
Note: The unit of TRX in the parameters is SUN
wallet/updatesetting
Description: Update the consume_user_resource_percent parameter of a smart contract
owner_address
:Owner address of the smart contract, default hexStringcontract_address
:Smart contract address, default hexStringconsume_user_resource_percent
:Consume user's resource percentagePermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/updateenergylimit
Description: Update the origin_energy_limit parameter of a smart contract
Parameters:
owner_address
: Owner address of the smart contract, default hexStringcontract_address
: Smart contract address, default hexStringorigin_energy_limit
: The maximum resource consumption of the creator in one execution or creationpermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/clearabi
Description: To clear the abi of a smart contract
Parameters:
owner_address
:Owner address of the smart contractcontract_address
: Smart contract address, default hexString
Return: Transaction object
wallet/estimateenergy
Estimate the energy required for the successful execution of smart contract transactions
Parameters:
contract_address
: Smart contract address. If visible=true, use base58check format, otherwise use hex format.function_selector
: Function call, must not be left blank.parameter
: Parameter encoding needs to be in accordance with the ABI rules, the rules are more complicated, users can use the ethers library to encodedata
: The data for interacting with smart contracts, including the contract function and parameters. You can choose to use this field, or you can choose to usefunction_selector
andparameter
for contract interaction. When both ofdata
andfunction_selector
exist,function_selector
is preferredcall_value
: The TRX transfer to the contract for each callowner_address
:Owner address that triggers the contract. If visible=true, use base58check format, otherwise use hexcall_token_value
: The amount of trc10 token transfer to the contract for each calltoken_id
: The id of trc10 token transfer to the contract
Return:Estimated the energy value
TRC10 token
The following are TRC10 token-related APIs:
wallet/getassetissuebyaccount
wallet/getassetissuebyname
wallet/getassetissuelistbyname
wallet/getassetissuebyid
wallet/getassetissuelist
wallet/getpaginatedassetissuelist
wallet/transferasset
wallet/participateassetissue
wallet/createassetissue
wallet/unfreezeasset
wallet/updateasset
wallet/getassetissuebyaccount
Description: Query the token issue information of an account
Parameter address: Token issuer's address, default hexString
Return: Token object
wallet/getassetissuebyname
Description: Query a token by token name
Parameter value: Token name, default hexString
Return: Token object
wallet/getassetissuelistbyname
Description: Query the list of tokens by name
Parameter value: Token name, default hexString
Return: The list of tokens
wallet/getassetissuebyid
Description: Query a token by token id
Parameter value: Token id
Return: Token object
wallet/getassetissuelist
Description: Query the list of all the tokens
Parameter: No parameter
Return: The list of all the tokens
wallet/getpaginatedassetissuelist
Description: Query the list of all the tokens by pagination
Parameters:
offset
: The index of the start tokenlimit
: The amount of tokens per page
Return: The list of tokens by pagination
wallet/transferasset
Description: Transfer token
Parameters:
owner_address
: Owner address, default hexStringto_address
: To address, default hexStringasset_name
: Token id, default hexStringamount
: Token transfer amountpermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: The unit of 'amount' is the smallest unit of the token
wallet/participateassetissue
Description: Participate a token
Parameters:
to_address
: The issuer address of the token, default hexStringowner_address
: The participant address, default hexStringamount
: Participate token amountasset_name
: Token id, default hexStringpermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: The unit of 'amount' is the smallest unit of the token
wallet/createassetissue
Description: Issue a token
Parameters:
owner_address
: Owner address, default hexStringname
: Token name, default hexStringabbr
: Token name abbreviation, default hexStringtotal_supply
: Token total supplytrx_num
: Define the price by the ratio of trx_num/numnum
: Define the price by the ratio of trx_num/numstart_time
: ICO start timeend_time
: ICO end timedescription
: Token description, default hexStringurl
: Token official website url, default hexStringfree_asset_net_limit
: Token free asset net limitpublic_free_asset_net_limit
: Token public free asset net limitfrozen_supply
: Token staked supplypermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: The unit of 'trx_num' is SUN
wallet/unfreezeasset
Description: Unstake the staked token that is due
Parameters:
owner_address
: Owner address, default hexStringpermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/updateasset
Description: Update token information
Parameters:
owner_address
: The issuers address of the token, default hexStringdescription
: The description of token, default hexStringurl
: The token's website url, default hexStringnew_limit
: Each token holder's free bandwidthnew_public_limit
: The total free bandwidth of the tokenpermission_id
: Optional, for multi-signature use
Return: Transaction object
Vote and SR
The following are voting and SR related APIs:
wallet/createwitness
wallet/updatewitness
wallet/listwitnesses
wallet/withdrawbalance
wallet/votewitnessaccount
wallet/getBrokerage
wallet/updateBrokerage
wallet/getReward
wallet/getnextmaintenancetime
wallet/createwitness
Description: Apply to become a witness
Parameters:
owner_address
: Owner address, default hexStringurl
: Website url, default hexStringpermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/updatewitness
Description: Update the witness' website url
Parameters:
owner_address
: Owner address, default hexStringupdate_url
: Website url, default hexStringpermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/listwitnesses
Description: Qyery the list of the witnesses
Parameters: N/A
Return:witness list
wallet/withdrawbalance
Description: Withdraw reward to account balance for witnesses
Parameters:
owner_address
: Owner address, default hexStringpermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: It can only withdraw once for every 24 hours
wallet/votewitnessaccount
Description: Vote for witnesses
Parameters:
owner_address
: Owner address, default hexStringvotes
: 'vote_address' stands for the address of the witness you want to vote, default hexString, 'vote_count' stands for the number of votes you want to votepermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/getBrokerage
Description: Query the ratio of brokerage of the witness
Parameter address
: The address of the witness's account, default hexString
Return: The ratio of brokerage of the witness
wallet/updateBrokerage
Description: Update the ratio of brokerage
Parameters:
owner_address
: The address of the witness's account, default hexStringbrokerage
: The ratio of brokerage you want to update to
Return: Transaction object
wallet/getReward
Description: Query unclaimed reward
Parameter address
: The address of the voter's account, default hexString
Return: Unclaimed reward
wallet/getnextmaintenancetime
Description: Query the time interval till the next vote round
Parameters: N/A
Return: The time interval till the next vote round(unit: ms)
Proposals
The following are proposal-related APIs:
wallet/proposalcreate
wallet/getproposalbyid
wallet/listproposals
wallet/proposalapprove
wallet/proposaldelete
wallet/getpaginatedproposallist
wallet/proposalcreate
Description: Create a proposal
Parameters:
owner_address
: Creator addressparameters
: Proposal parameterspermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/getproposalbyid
Description: Query a proposal by proposal id
Parameter id
: Proposal id
Return: The proposal information
wallet/listproposals
Description: Query all the proposals
Parameter: No parameter
Return: The list of all the proposals
wallet/proposalapprove
Description: To approve a proposal
Parameters:
owner_address
: The address that makes the approve action, default hexStringproposal_id
: Proposal idis_add_approval
: Whether to approvepermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/proposaldelete
Description: To delete a proposal
Parameters:
owner_address
: Owner address of the proposal, default hexStringproposal_id
: Proposal idpermission_id
: Optional, for multi-signature use
Return: Transaction object
wallet/getpaginatedproposallist
Description: Query the list of all the proposals by pagination
Parameters:
offset
: The index of the start proposallimit
: The amount of proposals per page
Return: The list of proposals by pagination
DEX Exchange
The following are the APIs related to decentralized exchanges:
wallet/exchangecreate
wallet/exchangeinject
wallet/exchangewithdraw
wallet/exchangetransaction
wallet/getexchangebyid
wallet/listexchanges
wallet/getpaginatedexchangelist
wallet/marketsellasset
wallet/marketcancelorder
wallet/getmarketorderbyaccount
wallet/getmarketpairlist
wallet/getmarketorderlistbypair
wallet/getmarketpricebypair
wallet/getmarketorderbyid
wallet/exchangecreate
Description: Create an exchange pair
Parameters:
owner_address
: addressfirst_token_id
: The first token's id, default hexStringfirst_token_balance
: The first token's balancesecond_token_id
: The second token's id, default hexStringsecond_token_balance
: The second token's balancepermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: The unit of 'first_token_balance' and 'second_token_balance' is the smallest unit of the token
wallet/exchangeinject
Description: Inject funds for exchange pair
Parameters:
owner_address
: Owner address of the exchange pair, default hexStringexchange_id
: Exchange pair idtoken_id
: Token id, default hexStringquant
: Token inject amountpermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: The unit of 'quant' is the smallest unit of the token
wallet/exchangewithdraw
Description: Withdraw from exchange pair
Parameters:
owner_address
: Owner address of the exchange pair, default hexStringexchange_id
: Exchange pair idtoken_id
: Token id, default hexStringquant
: Token withdraw amountpermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: The unit of 'quant' is the smallest unit of the token
wallet/exchangetransaction
Description: Participate the transaction of exchange pair
Parameters:
owner_address
: Owner address of the exchange pair, default hexStringexchange_id
: Exchange pair idtoken_id
: Token id, default hexStringquant
: Sell token amountexpected
: Expected token amount to getpermission_id
: Optional, for multi-signature use
Return: Transaction object
Note: The unit of 'quant' and 'expected' is the smallest unit of the token
wallet/getexchangebyid
Description: Query an exchange pair by exchange pair id
Parameter id: Exchange pair id
Return: Exchange pair information
wallet/listexchanges
Description: Query the list of all the exchange pairs
Parameter: No parameter
Return: The list of all the exchange pairs
wallet/getpaginatedexchangelist
Description: Query the list of all the exchange pairs by pagination
Parameters:
offset
: The index of the start exchange pairlimit
: The amount of exchange pairs per page
Return: The list of exchange pairs by pagination
wallet/marketsellasset
Description:Create an market order
Parameters:
owner_address
:owner address, default hexStringsell_token_id
:sell token id, default hexStringsell_token_quantity
:sell token quantitybuy_token_id
:buy token id, default hexStringbuy_token_quantity
:buy token quantity (min to receive)
Return:Transaction object
wallet/marketcancelorder
Description:Cancel the order
Parameters:
owner_address
:owner address, default hexStringorder_id
:order id
Return:Transaction object
wallet/getmarketorderbyaccount
Description:Get all orders for the account
Parameters:value
- owner address, default hexString
Return:order list
wallet/getmarketpairlist
Description:Get all trading pairs
Parameters: N/A
Return: makket pair list
wallet/getmarketorderlistbypair
Description:Get all orders for the trading pair demo:
Parameters:
sell_token_id
:sell token id, default hexStringbuy_token_id
:buy token id, default hexString
Return:order list
wallet/getmarketpricebypair
Description:Get all prices for the trading pair
Parameters:
sell_token_id
:sell token id, default hexStringbuy_token_id
:buy token id, default hexString Return:price list
wallet/getmarketorderbyid
Description:Get all orders for the account
Parameters:value
- order id, default hexString
Return:order
TRONZ Shielded Smart Contract
The following are TRONZ anonymous smart contract related APIs:
wallet/getexpandedspendingkey
wallet/getakfromask
wallet/getnkfromnsk
wallet/getspendingkey
wallet/getdiversifier
wallet/getincomingviewingkey
wallet/getzenpaymentaddress
wallet/createshieldedtransactionwithoutspendauthsig
wallet/scannotebyivk
wallet/scanandmarknotebyivk
wallet/scannotebyovk
wallet/createshieldnullifier
wallet/getshieldtransactionhash
wallet/createshieldedtransaction
wallet/getnewshieldedaddress
wallet/createshieldedcontractparameters
wallet/createshieldedcontractparameterswithoutask
wallet/scanshieldedtrc20notesbyivk
wallet/scanshieldedtrc20notesbyovk
wallet/isshieldedtrc20contractnotespent
wallet/gettriggerinputforshieldedtrc20contract
wallet/getrcm
wallet/getmerkletreevoucherinfo
wallet/isspend
wallet/createspendauthsig
wallet/getexpandedspendingkey
Description: To get expanded spending keys from spending key
Parameters: value:Spending key
Return: Expanded spending keys, it consists of three keys: ask, nsk and ovk.
wallet/getakfromask
Description: To get ak key from ask key
Parameters: value:Ask
Return:Ak
wallet/getnkfromnsk
Description: To get nk key from nsk key
Parameters: value:Nsk
Return:Nk
wallet/getspendingkey
Description: To get spending key
Parameters: N/A
Return:Spending key
wallet/getdiversifier
Description: To get diversifier
Parameters: N/A
Return: Diversifier
wallet/getincomingviewingkey
Description: To get incoming viewing key
Parameters:
ak
:Aknk
:Nk
Return:Incoming viewing key
wallet/getzenpaymentaddress
Description: To get payment address
Parameters:
ivk
:Ivkd
:D
Return: Payment address
wallet/createshieldedtransactionwithoutspendauthsig
Description: To create shielded transaction without using ask
Parameters:
transparent_from_address
: Transparent sender's addressfrom_amount
: Send amount from transparent addressask
: Asknsk
: Nskovk
: Ovkshielded_receives
: Shielded receive informationshieldedSpends
: Shielded spend informationtransparent_to_address
: Transparent receiver's addressto_amount
: Send amount to transparent address
Return: Transaction object
wallet/createshieldedtransactionwithoutspendauthsig
Description: To create shielded transaction with using ask
Parameters:
transparent_from_address
: Transparent sender's addressfrom_amount
: Send amount from transparent addressak
: Aknsk
: Nskovk
: Ovkshielded_receives
: Shielded receive informationshieldedSpends
: Shielded spend informationtransparent_to_address
: Transparent receiver's addressto_amount
: Send amount to transparent address
Return: Transaction object
wallet/scannotebyivk
Description: To get all the notes by ivk
Parameters:
start_block_index
: The start block height, itself includedend_block_index
: The end block height, itself not includedivk
: Incoming viewing key
Return: Notes list
Note: Range limit (end_block_index - start_block_index <= 1000)
wallet/scanandmarknotebyivk
Description: To get all the notes with spent status by ivk
Parameters:
start_block_index
: The start block height, itself includedend_block_index
: The end block height, itself not includedivk
: Incoming viewing keyak
: Ak keynk
: Nk key
Return: Notes list
Note: Range limit (end_block_index - start_block_index <= 1000)
wallet/scannotebyovk
Description: To get all the notes by ovk
Parameters:
start_block_index
: The start block height, itself includedend_block_index
: The end block height, itself not includedovk
: Outgoing viewing key
Return: Notes list
Note: Range limit (end_block_index - start_block_index <= 1000)
wallet/createshieldnullifier
Description: To create a shielded nullifier
Parameters:
note
: Note informationvoucher
: Voucher informationak
: Aknk
: Nk
Return: A shielded nullifier
wallet/getshieldtransactionhash
Description: To get a shielded transaction hash
Parameter transaction: Transaction object
Return: a shielded transaction hash
wallet/createshieldedtransaction
Description: To create shielded transaction Please refer to The Demo
Parameters:
transparent_from_address
: Transparent sender's addressfrom_amount
: Send amount from transparent addressask
: Asknsk
: Nskovk
: Ovkshielded_receives
: Shielded receive informationshieldedSpends
: Shielded spend informationtransparent_to_address
: Transparent receiver's addressto_amount
: Send amount to transparent address
Return: Transaction object
wallet/getnewshieldedaddress
Description: To get new shieldedAddress
Parameters: N/A Return: Spending key Ask key Nsk key Outgoing viewing key Ak Key Nk key incoming viewing key Diversifier pkD payment address
wallet/createshieldedcontractparameters
Description: create the shielded TRC-20 transaction parameters, which has three types: mint, transfer and burn
Parameters:
ask
: Asknsk
: Nskovk
: Outgoing view keyfrom_amount
: the amount for mint, which is scaled byscalingfactor
with notevalue
, namelyfrom_amount
=value
*scalingFactor
. In the above example, the value ofscalingFactor
is 100shielded_receives
: the shielded notes to be createdshielded_TRC20_contract_address
: shielded TRC-20 contract address
Return: the shielded TRC-20 transaction parameters
Note: the input parameters will differ according to the variety of shielded TRC-20 transaction type
wallet/createshieldedcontractparameterswithoutask
Description: create the shielded TRC-20 transaction parameters without Ask, which has three types: mint, transfer and burn
Parameters:
ovk
: Outgoing view keyfrom_amount
: the amount for mint, which is scaled byscalingfactor
with notevalue
, namelyfrom_amount
=value
*scalingFactor
. In the above example, the value ofscalingFactor
is 100shielded_receives
: the shielded notes to be createdshielded_TRC20_contract_address
: shielded TRC-20 contract address
Return: the shielded TRC-20 transaction parameters
Note: the input parameters will differ according to the variety of shielded TRC-20 transaction type
wallet/scanshieldedtrc20notesbyivk
Description: scan the shielded TRC-20 notes by ivk and mark their status of whether spent
Parameters:
start_block_index
: the start block index, inclusiveend_block_index
: the end block index, exclusiveshielded_TRC20_contract_address
: shielded TRC-20 contract addressivk
: Incoming viewing keyak
: Ak keynk
: Nk key
Return: notes list
Note: block limit(end_block_index - start_block_index <= 1000)
wallet/scanshieldedtrc20notesbyovk
Description: scan the shielded TRC-20 notes by ovk
Parameters:
start_block_index
: start block index, inclusiveend_block_index
: end block index, exclusiveshielded_TRC20_contract_address
: shielded TRC-20 contract addressovk
: Outgoing viewing key
Return: notes list
Note: block limit(end_block_index - start_block_index <= 1000)
wallet/isshieldedtrc20contractnotespent
Description: check the status whether the specified shielded TRC-20 note is spent
Parameters:
note
: the specified noteak
: Aknk
: Nkposition
: the leaf position index of note commitment in the Merkle treeshielded_TRC20_contract_address
: the shielded TRC-20 contract address
Return: note status
Note: the value
in note is the scaled value by scalingFactor
set in the shielded TRC-20 contract, namely real_amount
= value
* scalingFactor
.
wallet/gettriggerinputforshieldedtrc20contract
Description: get the trigger input data of shielded TRC-20 contract for the shielded TRC-20 parameters without spend authority signature.
Parameters:
shielded_TRC20_Parameters
: the generated shielded TRC-20 parametersspend_authority_signature
: the spend authority signaturesamount
: the amounttransparent_to_address
: the receiver for theburn
operation.
Return: the input data for triggering shielded TRC-20 contract.
wallet/getrcm
Description: To get a random commitment trapdoor
Parameters: N/A
Return:rcm
wallet/getmerkletreevoucherinfo
Description: To get a merkle tree information of a note
Parameter out_points
: Note information
Return: A merkle tree of a note
wallet/isspend
Description: To check whether a note is spent or not
Parameters:
ak
: Ak keynk
: Nk keynote
: Note informationtxid
: Transaction idindex
: Note index
Return: Note status
wallet/createspendauthsig
Description: To create a signature for a transaction
Parameters:
ask
: Ask keytx_hash
: Transaction hashalpha
: Alpha
Return: A signature
Pending Pool
The following are Pending Pool related APIs:
wallet/gettransactionfrompending
wallet/gettransactionlistfrompending
wallet/getpendingsize
wallet/gettransactionfrompending
Get transaction details from the pending pool
Parameters: value: transaction id
Return: Transaction details
wallet/gettransactionlistfrompending
Get transaction list information from pending pool
Parameters: N/A
Return: Pending transaction IDs in the pool
wallet/getpendingsize
Get the size of the pending pool queue
Parameters: N/A
Return:pending pool size
FullNode Solidity HTTP API
Account Resources
walletsolidity/getaccount
Description: Query an account information
Parameters: address
- Account to query, default hexString
Return: Account object
walletsolidity/getdelegatedresource
Description: Query the energy delegation information
Parameters:
fromAddress
: Energy from address, default hexStringtoAddress
: Energy to address, default hexString
Return: Energy delegation information list, the elements of the list is DelegatedResource
walletsolidity/getdelegatedresourceaccountindex
Description: Query the energy delegation index by an account
Parameters:
value
: Address, default hexString
Return: DelegatedResourceAccountIndex of the address
walletsolidity/getaccountbyid
Description: Query an account information by account id
Parameters: account_id
- Account id, default hexString
Return: Account object
walletsolidity/getavailableunfreezecount
Description:Remaining times of executing unstake operation in Stake2.0
Parameters:
owner_address
: Account address
Return:Remaining times of available unstaking.
walletsolidity/getcanwithdrawunfreezeamount
Description: Query the withdrawable balance at the specified timestamp In Stake2.0
Parameters:
owner_address
: Account addresstimestamp
: query cutoff timestamp, in milliseconds.
Return: Withdrawable balance, unit is sun.
walletsolidity/getcandelegatedmaxsize
Description: In Stake2.0, query the amount of delegatable resources share of the specified resource type for an address, unit is sun.
Parameters:
owner_address
: Account addresstype
: Resource type, 0 is bandwidth, 1 is energy
Return: The amount of delegatable resource share, unit is sun.
walletsolidity/getdelegatedresourcev2
In Stake2.0, query the detail of resource share delegated from fromAddress
to toAddress
Parameters:
fromAddress
: resource from address, default hexStringtoAddress
: resource to address
Return: Resource delegation list
walletsolidity/getdelegatedresourceaccountindexv2
In Stake2.0, query the resource delegation index by an account. Two lists will return, one is the list of addresses the account has delegated its resources(toAddress
), and the other is the list of addresses that have delegated resources to the account(fromAddress
).
Parameters:
value
: account address
Return: Two lists will return, one is the list of addresses the account has delegated its resources(toAddress
), and the other is the list of addresses that have delegated resources to the account(fromAddress
).
Voting & SRs
walletsolidity/listwitnesses
Description: Query the list of witnesses
Parameters: N/A
Return: List of all witnesses
TRC10 Token
walletsolidity/getassetissuelist
Description: Query the list of all tokens
Parameters: N/A
Return: The list of all tokens
walletsolidity/getpaginatedassetissuelist
Description: Query the list of all the tokens by pagination
Parameters:
offset
: The index of the start tokenlimit
: The amount of tokens per page
Return: List of tokens
walletsolidity/getassetissuebyname
Description: Query a token by token name
Parameters: value
- Token name, default hexString
Return: Token object Note: Since Odyssey-v3.2, getassetissuebyid
or getassetissuelistbyname
is recommended, as since v3.2, token name can be repeatable. If the token name you query is not unique, this api will throw out an error.
walletsolidity/getassetissuelistbyname
Description: Query the token list by name
Parameters: value
- Token name, default hexString
Return: Token list
walletsolidity/getassetissuebyid
Description: Query a token by token id
Parameters: value
- Token id
Return: Token object
Blocks
walletsolidity/getnowblock
Description: Query the latest block information
Parameters: N/A
Return: The latest block from solidityNode
walletsolidity/getblockbynum
Description: Query a block information by block height
Parameters: num
- Block height
Return: Block information
walletsolidity/getblockbyid
Description: Query a block information by block id
Parameters: value
- Block id
Return: The block object
walletsolidity/getblockbylimitnext
Description: Query a list of blocks by range
Parameters:
startNum
: The start block height, inclusiveendNum
: The end block height, exclusive
Return: List of blocks
walletsolidity/getblockbylatestnum
Description: Query the latest few blocks
Parameters: num
- The number of blocks expected to return
Return: List of blocks
Transactions
walletsolidity/gettransactionbyid
Description: Query an transaction information by transaction id
Parameters: value
- Transaction id
Return: Transaction information
walletsolidity/gettransactioncountbyblocknum
Description: Query th the number of transactions in a specific block
Parameters: num
- Block height
Return: The number of transactions
walletsolidity/gettransactioninfobyid
Description: Query the transaction fee, block height by transaction id
Parameters: value
- Transaction id
Return: Transaction fee, block height and the time of creation
walletsolidity/gettransactioninfobyblocknum
Description: Query the list of transaction information in a specific block
Parameters: num
- Block height
Return: The list of transaction information inside the queried block
DEX Exchanges
walletsolidity/getexchangebyid
Description: Query an exchange pair by exchange pair id
Parameters:
id: Exchange pair id
Return: Exchange pair information
walletsolidity/listexchanges
Description: Query the list of all the exchange pairs
Parameters: N/A
Return: The list of all the exchange pairs
TRONZ Shielded Smart Contract
walletsolidity/getmerkletreevoucherinfo
Description: Get the Merkle tree information of a note
Parameters:
out_points
: Note information
Return: Merkle tree information of a note
walletsolidity/scannotebyivk
Description: Get all notes related to ivk
Parameters:
start_block_index
: The start block height, inclusiveend_block_index
: The end block height, exclusiveivk
: Incoming viewing key
Return: Notes list Note: Range limit (end_block_index - start_block_index <= 1000)
walletsolidity/scanandmarknotebyivk
Description: Get all notes with spent status related to ivk
Parameters:
start_block_index
: The start block height, inclusiveend_block_index
: The end block height, exclusiveivk
: Incoming viewing keyak
: Ak keynk
: Nk key
Return: Notes list Note: Range limit (end_block_index - start_block_index <= 1000)
walletsolidity/scannotebyovk
Description: Query all notes related to ovk
Parameters:
start_block_index
: The start block height, inclusiveend_block_index
: The end block height, exclusiveovk
: Outgoing viewing key
Return: Notes list Note: Range limit (end_block_index - start_block_index <= 1000)
walletsolidity/isspend
Description: Check whether a note has been spent
Parameters:
ak
: Aknk
: Nknote
: Note informationtxid
: Transaction idindex
: Note index
Return: Whether a note has been spent
walletsolidity/scanshieldedtrc20notesbyivk
Description: Scan the shielded TRC-20 notes by ivk, and mark whether it has been spent
Parameters:
start_block_index
: The start block index, inclusiveend_block_index
: The end block index, exclusiveshielded_TRC20_contract_address
: Shielded TRC-20 contract addressivk
: Incoming viewing keyak
: Ak keynk
: Nk key
Return: Notes list Note: Block limit(end_block_index - start_block_index <= 1000)
walletsolidity/scanshieldedtrc20notesbyovk
Description: Scan the shielded TRC-20 notes by ovk
Parameters:
start_block_index
: Start block index, inclusiveend_block_index
: Start block index, inclusiveshielded_TRC20_contract_address
: Shielded TRC-20 contract addressovk
: Outgoing viewing key
Return: Notes list
Note: Block limit (end_block_index - start_block_index <= 1000)
walletsolidity/isshieldedtrc20contractnotespent
Description: Check the status whether the specified shielded TRC-20 note is spent
Parameters:
note
: The specified noteak
: Aknk
: Nkposition
: The leaf position index of note commitment in the Merkle treeshielded_TRC20_contract_address
: The shielded TRC-20 contract address
Return: Note status
Note: The value
in note is the scaled value by scalingFactor
set in the shielded TRC-20 contract, namely real_amount = value * scalingFactor
.
Last updated