TronEnergy Energy 위임에 대한 전체 REST API 문서입니다. 엔드포인트, 매개변수, 응답 형식 및 오류 코드가 포함되어 있습니다.
기본 URL:https://api.tronnrg.com인증: 필수 사항이 아닙니다. 모든 엔드포인트는 공개되어 있습니다.
속도 제한: IP 주소당 초당 20개 요청
결제 주소:TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx ( API 통해서만 가능하며, 수동 대여는 불가능합니다.)
작동 방식
단 세 단계. API 키 필요 없음, 회원가입 필요 없음, 지갑 연결 필요 없음. 소유권은 암호학적으로 증명됩니다.
TRX 전송 — 결제 주소로 4 TRX (또는 그 이상)를 보내주세요. 4 TRX 는 65,000 에너지, 8 TRX 는 130,000 에너지입니다. 비례적으로 계산됩니다.
징후 — 메시지에 서명하세요 {tx_hash}:{delegate_to} TRX 를 보낸 지갑을 사용하면 위임 승인을 증명할 수 있습니다.
주장하다 — POST /delegate ~와 함께 tx_hash, delegate_to, 그리고 signatureEnergy 약 3초 만에 도착합니다.
결제 주소
TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx
API 결제 주소만 해당됩니다. 이 주소는 API 통한 프로그램 통합용입니다. 수동 에너지 임대에는 사용하지 마십시오. 수동 임대 주소는 다르며 에서 확인할 수 있습니다.tronnrg.com.
이 주소로 TRX 보내주세요. 결제 건의 거래 해시값이 위임을 활성화하는 데 필요한 토큰입니다. 각 해시값은 한 번만 사용할 수 있습니다.
TRX 전송됨
Energy 위임
사용 사례
4 TRX
65,000
기존 지갑으로의 표준 USDT 이체 (최소 주문 금액)
8 TRX
130,000
USDT 최초 수신자에게 송금
16 TRX
260,000
한 주문에 표준 이송 4건
40 TRX
650,000
10가지 표준 전송
100 TRX
1,625,000
약 25회의 표준 전송 - 소형 플랫폼에서 흔히 볼 수 있는 횟수입니다.
1,000 TRX
16,250,000
최대 주문량: 표준 이송 약 250회
그 사이의 금액
trx × 16,250
완전히 선형적인 방식입니다. 단계별 요금제, 패키지 상품, 할인 혜택이 없습니다.
공식: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자 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 주소에서 초당 요청 수가 너무 많습니다. 제한은 초당 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;
}
}
Refunds
결제 확인 후 위임이 실패하면 TRX 환불이 자동으로 대기열에 추가되어 온체인의 발신자 주소로 반환됩니다. 오류 응답에서 환불 객체를 확인하세요.
Error with refund
{
"error": "delegation_failed",
"message": "Energy delegation failed. Your payment will be refunded.",
"ref": "nrg_d_43",
"refund": {
"type": "queued",
"to": "TSenderAddress",
"amount": 4
}
}
전체 예시
전체 엔드투엔드 흐름: TRX 전송, 서명, 재시도 기능을 사용한 청구. 복사하여 실행하세요.
const API = 'https://api.tronnrg.com';
const ADDR = 'TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx';
async functionrentEnergy(delegateTo, trxAmount = 4) {
// 1. Send TRX to the payment addressconst payment = await tronWeb.trx.sendTransaction(ADDR, trxAmount * 1e6);
// 2. Sign: proves you are the senderconst message = `${payment.txid}:${delegateTo}`;
const signature = await tronWeb.trx.signMessageV2(message);
// 3. Claim delegation (retry if tx not indexed yet)let result;
for (let i = 0; i < 3; i++) {
result = awaitfetch(`${API}/delegate`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
tx_hash: payment.txid,
delegate_to: delegateTo,
signature,
}),
}).then(r => r.json());
if (!result.error) break;
if (result.error !== 'payment_verification_failed') throw newError(result.message);
await newPromise(r => setTimeout(r, 3000));
}
if (result.error) throw newError(result.message);
return result;
}
// Usage — send any amount between 4 and 1,000 TRXconst result = awaitrentEnergy('TWalletThatNeedsEnergy', 4); // 4 TRX → 65k energy// rentEnergy(addr, 8) // → 130,000 energy (new-wallet transfer)// rentEnergy(addr, 40) // → 650,000 energy (10 transfers)// rentEnergy(addr, 1000) // → 16,250,000 energy (max)
console.log(result.energy); // trxAmount × 16,250
console.log(result.delegations[0].tx); // on-chain tx hash
console.log(result.ref); // "nrg_d_42"
import requests
import time
API = 'https://api.tronnrg.com'
ADDR = 'TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx'defrent_energy(delegate_to, trx_amount=4):
# 1. Send TRX to ADDR (via your Tron library)
tx_hash = send_trx(ADDR, trx_amount) # your TRX send function# 2. Sign: proves you are the sender
message = f'{tx_hash}:{delegate_to}'
signature = tron.trx.sign_message_v2(message)
# 3. Claim delegation (retry if tx not indexed yet)for attempt inrange(3):
result = requests.post(f'{API}/delegate', json={
'tx_hash': tx_hash,
'delegate_to': delegate_to,
'signature': signature,
}).json()
if'error'not in result:
return result
if result['error'] != 'payment_verification_failed':
raiseException(result['message'])
time.sleep(3)
raiseException('Transaction not found after retries')
# Usage
result = rent_energy('TWalletThatNeedsEnergy', 4)
print(f"Delegated: {result['energy']} energy")
print(f"Delegation tx: {result['delegations'][0]['tx']}")
print(f"Ref: {result['ref']}")
# 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