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

delegate-bandwidth - TRON energy

Example code for the delegate-bandwidth JSON RPC method. Сomplete guide on how to use delegate-bandwidth JSON RPC in GetBlock Web3 documentation.

This is used to purchase and delegate TRON bandwidth to a target address. Unlike energy, bandwidth orders may be confirmed asynchronously: if the provider accepts the order but on-chain delivery is not yet confirmed, the API returns 202 Accepted and no charge is applied until delivery is confirmed.

Body Parameter

Parameter

Type

Required

Description

target_address

string

Yes

TRON wallet address (starts with T, 34 characters)

volume

integer

Yes

Bandwidth amount: 1,000 — 200,000

duration

string

Yes

"1h" (only 1 hour supported for Bandwidth)

Request Sample

curl -X POST https://services.getblock.io/v1/tron-energy/delegate-bandwidth \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "target_address": "TUo8pycbvje9w2XYsNnnzw67bpPs4GLFyD",
    "volume": 5000,
    "duration": "1h"
  }
'
import axios from 'axios';
const data = JSON.stringify({
    "target_address": "TUo8pycbvje9w2XYsNnnzw67bpPs4GLFyD",
    "volume": 5000,
    "duration": "1h"
  }
);

const config = {
    method: 'post',
    url: 'https://services.getblock.io/v1/tron-energy/delegate-bandwidth',
    headers: {
        'Content-Type': 'application/json',
        'Authorization: Bearer YOUR_API_KEY'
    },
    data: data
};
axios(config)
    .then(response => console.log(JSON.stringify(response.data)))
    .catch(error => console.log(error));

Response Sample

Idempotency

Send a unique Idempotency-Key header (UUID format recommended) to ensure safe retries:

Scenario
Behavior

Same key + same body

Original response replayed, no duplicate charge

Same key + different body

422

Same key on different endpoint

409

In-flight duplicate request

409 with Retry-After header

A retry of a 202 response replays the same 202 — it does not create a second order

Last updated

Was this helpful?