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文字の16進数文字列ではありません
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アドレスからの1秒あたりのリクエスト数が多すぎます。制限は20件/秒です。
server_error
500
予期せぬ内部エラーが発生しました。数秒後に再試行してください。
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