For the complete documentation index, see llms.txt. This page is also available as Markdown.

/wallet/freezebalancev2 - Tron

Example code for the freezebalancev2 REST method. Complete guide on how to use freezebalancev2 REST method in GetBlock Web3 documentation.

This endpoint builds an unsigned Stake 2.0 transaction that stakes TRX to gain Energy or Bandwidth. The returned transaction must be signed and broadcast.

Parameters

Parameter
Type
Required
Description

owner_address

string

Yes

Staking account address

frozen_balance

integer

Yes

Amount of TRX to stake, in SUN

resource

string

Yes

Resource to gain: ENERGY or BANDWIDTH

visible

boolean

No

Accept and return addresses in base58 format

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/wallet/freezebalancev2' \
--header 'Content-Type: application/json' \
--data-raw '{
  "owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g",
  "frozen_balance": 1000000000,
  "resource": "ENERGY",
  "visible": true
}'
example.js
const response = await fetch(
    'https://go.getblock.io/<ACCESS-TOKEN>/wallet/freezebalancev2',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", "frozen_balance": 1000000000, "resource": "ENERGY", "visible": true})
    }
);
console.log(await response.json());
example.py
import requests

response = requests.post(
    'https://go.getblock.io/<ACCESS-TOKEN>/wallet/freezebalancev2',
    headers={'Content-Type': 'application/json'},
    json={"owner_address": "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g", "frozen_balance": 1000000000, "resource": "ENERGY", "visible": true}
)

print(response.json())

Response

Response Parameters

Field
Type
Description

txID

string

The transaction id of the unsigned staking transaction

raw_data

object

The FreezeBalanceV2Contract and metadata

raw_data_hex

string

Hex serialization used as the signing payload

Use Cases

  • Gain Energy: Stake TRX to obtain Energy for contract calls

  • Gain Bandwidth: Stake TRX to obtain Bandwidth for transactions

  • Fee Reduction: Reduce burned TRX by staking for resources

  • Validator Support: Acquire TRON Power for voting through staking

Error Handling

HTTP Status
Message
Description

200

OK

The request succeeded; some TRON errors are returned in the 200 body as an Error field

400

Bad request

The request body is malformed or a required field is missing

500

Internal error

The node failed to process the request

Was this helpful?