delegateEnergy

Example code for the delegateEnergy JSON RPC method

This endpoint delegates energy to a TRON address. In most cases, the order completes immediately with status "success".

Parameter

Parameter

Type

Required

Description

target_address

string

Yes

TRON wallet address (starts with T, 34 characters)

volume

integer

Yes

Energy amount: 30,000 — 5,000,000

duration

string

Yes

"1h", "1d", "3d", "7d"

Idempotency

delegateEnergy charges your balance and may place an on-chain order. To make retries safe, send a unique key with each intent:

Idempotency-Key: 6f9c2a1e-3b7d-4c08-9f21-2e5a7c0b1d44

A UUID is recommended. Generate a new key for each purchase, and reuse the same key when retrying the exact same purchase.

Situation
Result

Same key + same body

The original response is replayed. No second charge, no second order.

Same key + different body

422

Same key on a different endpoint

409

Duplicate sent while the first is still in flight

409 with a Retry-After header

Idempotency store temporarily unavailable

503 with a Retry-After header (retry shortly)

Always send an idempotency key on write endpoints. It is the difference between a safe retry and an accidental double on-chain charge.

Request Sample

curl -X POST https://services.getblock.io/v1/tron-energy/delegateEnergy \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f9c2a1e-3b7d-4c08-9f21-2e5a7c0b1d44" \
  -d '{
    "target_address": "TUo8pycbvje...zw67bpPs4GLFyD",
    "volume": 65000,
    "duration": "1h"
  }'

Response

Last updated

Was this helpful?