The TRON network has a variety of API calls to allow users to interact with the blockchain. These API calls can be found in the <a href="https://developers.tron.network/v3.0/reference" target="_blank">API reference page</a>, which lists API calls from Full Node, Solidity Node, and TronWeb. While some of the API calls serve as stand-alone requests to get individual pieces of information, there are also many API calls which modify the user TRX wallet, resulting in a need to sign and broadcast the transaction. This guide walks the user through a TRX Balance Freezing example to show the API signature and broadcast process flow.
# Freeze Balance Example
One of the most commonly used APIs is the `
/wallet/freezebalance` call. This API call freezes the TRX balance within a user-specified wallet address, and provides either bandwidth OR energy and TRON Power (voting rights) to the wallet owner. This API call takes in the four input parameters of `
frozen_duration`, and `
owner_address` is the TRX wallet's address in string format.
frozen_balance` is the amount of TRX frozen in denominations of Sun, in integer format.
frozen_duration` is the duration in days to be frozen, in integer format.
resource` is the type of resource freezing for. This can be either `
ENERGY` or `
BANDWIDTH`, in string format.<br>
**Make a Transaction**: Freeze balance by making the API call to get the JSON data:
Below is the sample JSON output. It lists the various attributes associated with the Freeze Balance transaction. This JSON output will be used to sign the transaction.
**Sign the Transaction**: The `
/wallet/gettransactionsign` API call takes in two parameters. One is the `
transaction` parameters, which takes in the JSON output from the previous step. The other is the `
privateKey` parameter, which requires the private key associated with the frozen TRX address to sign the transaction.
Below is the sample JSON output, with the signature ID:
**Broadcast Transaction**: The `
/wallet/broadcasttransaction` API call takes in one parameter, which is the JSON output data from signing the transaction.
Below is the sample JSON Output, confirming successful transaction broadcast.