Пурра хаттӣ. Бе сатҳҳо, бе бастаҳо ва бе тахфифҳо.
Формула:energy = trxSent × 16,250. Ҳудудҳо: ҳадди ақал 4 TRX (65,000 энергия), ҳадди аксар 1,000 TRX (16,250,000 энергия). Ҳарду дар сатҳи API татбиқ карда мешаванд — маблағҳои камтар аз ҳадди ақал бо below_minimum рад карда мешаванд ва баргардонида мешаванд; маблағҳои аз ҳадди аксар болотар пеш аз ваколатдиҳӣ рад карда мешаванд. Ҳамеша арзишҳои зиндаро аз GET /supply пеш аз рамзгузории сахт дар истеҳсолот хонед — ба зер нигаред.
GET /supply
GET/supply
Маълумоти нархгузорӣ ва суроғаи пардохтро гиред. Ин нуқтаи ниҳоии иттилоотӣ аст — энергия ҳамеша дастрас аст, пеш аз фиристодани пардохт ба шумо лозим нест, ки тафтиш кунед.
curl https://api.tronnrg.com/supply
const supply = awaitfetch('https://api.tronnrg.com/supply')
.then(r => r.json());
// Energy is always available. Use supply.pay_to for the payment address.
console.log('Pay to:', supply.pay_to);
import requests
supply = requests.get('https://api.tronnrg.com/supply').json()
# Energy is always available. Use supply['pay_to'] for the payment address.print(supply['pay_to'])
$supply = json_decode(
file_get_contents('https://api.tronnrg.com/supply'),
true
);
// if less than you require, wait and retry// Energy is always available. Use $supply['pay_to'] for the payment address.echo$supply['pay_to'];
var client = newHttpClient();
var json = await client.GetStringAsync("https://api.tronnrg.com/supply");
var supply = JsonSerializer.Deserialize<JsonElement>(json);
// Energy is always available. Use pay_to for the payment address.var payTo = supply.GetProperty("pay_to").GetString();
On-chain delegation transaction hashes. Each tx is verifiable on TronScan. This is your receipt.
GET /health
GET/health
Liveness check for monitoring and uptime tools. Returns 200 OK when the API process is up. Does not check upstream nodes or providers.
Response 200
{ "status": "ok" }
Рамзҳои хато
Every error response has error (stable, machine-readable) and message (human-readable). Always switch on error.
Code
HTTP
Meaning
invalid_tx_hash
400
Сатри шашкунҷаи 64-рақама нест
invalid_address
400
Суроғаи Tron дуруст нест
missing_signature
400
Имзо дода нашудааст
invalid_signature
401
Имзо тасдиқ карда нашуд
signature_mismatch
403
Суроғаи имзокунанда бо фиристандаи пардохт мувофиқат намекунад
hash_already_used
409
Хеши транзаксия аллакай талаб карда шудааст
payment_verification_failed
404 / 400
On-chain verification of the payment failed. Read the message field for the specific cause: tx not found yet (404, retry in a few seconds), wrong recipient, not a TRX transfer, or below the 4 TRX minimum.
delegation_failed
400 / 500
Provider could not deliver energy. If the failure happened after the payment was verified, an automatic refund is queued. The error response includes a refund object when this happens.
rate_limited
429
Дархостҳо аз ҳад зиёд дар як сония аз ин IP. Маҳдудият 20/сония аст.
const result = awaitfetch('https://api.tronnrg.com/delegate', { ... })
.then(r => r.json());
if (result.error) {
switch (result.error) {
case'payment_verification_failed':
// Most common cause: tx not yet indexed. Wait 3s and retry.// Read result.message for the specific cause.break;
case'hash_already_used':
// Already claimed. Don't retry.break;
case'signature_mismatch':
// Signer != payment sender. Sign with the same key that sent TRX.break;
case'delegation_failed':
// Refund queued automatically if payment was verified.if (result.refund) console.log('Refund queued:', result.refund);
break;
}
}
result = requests.post('https://api.tronnrg.com/delegate', json=data).json()
if'error'in result:
if result['error'] == 'payment_verification_failed':
# Most common cause: tx not yet indexed. Wait 3s and retry.passelif result['error'] == 'hash_already_used':
# Already claimed. Don't retry.passelif result['error'] == 'signature_mismatch':
# Signer != payment sender. Sign with the same key.passelif result['error'] == 'delegation_failed':
# Refund queued automatically if payment was verified.pass
if (isset($result['error'])) {
switch ($result['error']) {
case'payment_verification_failed':
// Most common cause: tx not yet indexed. Wait 3s and retry.break;
case'hash_already_used':
// Already claimed. Don't retry.break;
case'signature_mismatch':
// Signer != payment sender. Sign with the same key.break;
case'delegation_failed':
// Refund queued automatically if payment was verified.break;
}
}
# 1. Send TRX to TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx# Pricing is linear at 16,250 energy per TRX.# Min 4 TRX (65,000 energy), max 1,000 TRX (16.25M energy).# (use your wallet or tronweb CLI)# 2. Sign the message {tx_hash}:{delegate_to} (proves you are the sender)# (use tronWeb.trx.signMessageV2 in your code)# 3. Claim delegation with tx hash + signature
curl -X POST https://api.tronnrg.com/delegate \
-H "Content-Type: application/json" \
-d '{
"tx_hash": "YOUR_PAYMENT_TX_HASH",
"delegate_to": "TWalletThatNeedsEnergy",
"signature": "YOUR_SIGNATURE"
}'# Response includes delegations[].tx — the on-chain hash you can verify on TronScan