API PAYMENT ADDRESS
TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx
Send TRX to this address. Your tx hash is used to claim the energy delegation.

Complete Python integration using tronpy. Each step is a standalone code block you can copy into your project. The full end-to-end example is at the bottom.

Prerequisites: Python 3.8+, tronpy installed (pip install tronpy), a funded Tron wallet.

The Flow

No API key. No sign-up. Your code sends TRX on-chain to the TronEnergy payment address, signs a message proving ownership, then claims the delegation. Energy arrives in approximately 3 seconds. Then your code sends USDT using the delegated energy.

Pricing is linear: 16,250 Energy per TRX. Minimum order 4 TRX (65,000 Energy — one standard USDT transfer), maximum 1,000 TRX (16.25M Energy). The amount you send determines exactly how much Energy comes back — there are no tiers or packages. For a single standard transfer, send 4. For a new-wallet transfer, send 8. For batch work, send more. The code below uses a TRX_AMOUNT variable so you can change it in one place.

Step by Step

1. Setup

sozlash; o'rnatish
import os, requests from tronpy import Tron from tronpy.keys import PrivateKey, keccak256 from coincurve import PrivateKey as CCKey # tronpy already depends on coincurve client = Tron() # mainnet — pass HTTPProvider(api_key=...) to avoid rate limits priv = PrivateKey(bytes.fromhex(os.environ['TRON_PRIVATE_KEY'])) sender = priv.public_key.to_base58check_address() API = 'https://api.tronnrg.com' ADDR = 'TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx' # API payment address USDT = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t'

2. Send TRX

to'lovni yuborish
TRX_AMOUNT = 4 # Linear: 16,250 energy per TRX. Min 4, max 1000. # 4 → 65k (standard) · 8 → 130k (new wallet) · 40 → 650k (10 transfers) payment = ( client.trx.transfer(sender, ADDR, TRX_AMOUNT * 1_000_000) .build().sign(priv).broadcast() ) print('Payment tx:', payment.txid)

3. Claim the Delegation

da'vo delegatsiyasi
# Sign: proves you are the sender. Must equal TronWeb signMessageV2 exactly: # keccak256("\x19TRON Signed Message:\n" + len + msg), secp256k1, v = rec + 27. def sign_message_v2(message, priv): msg = message.encode() prefix = b"\x19TRON Signed Message:\n" + str(len(msg)).encode() digest = keccak256(prefix + msg) raw = CCKey(priv.to_bytes()).sign_recoverable(digest, hasher=None) return '0x' + (raw[:64] + bytes([raw[64] + 27])).hex() msg = f"{payment.txid}:{sender}" sig = sign_message_v2(msg, priv) delegation = requests.post(f"{API}/delegate", json={ 'tx_hash': payment.txid, 'delegate_to': sender, 'signature': sig, }).json() if delegation.get('error'): raise Exception(delegation['message']) print('Energy delegated:', delegation['energy']) # TRX_AMOUNT × 16,250

4. Send USDT

AQSh dollarini yuborish
recipient = 'TRecipientWallet' contract = client.get_contract(USDT) tx = ( contract.functions.transfer(recipient, 10 * 1_000_000) .with_owner(sender).fee_limit(50_000_000) .build().sign(priv).broadcast() ) print('USDT sent:', tx.txid)

Error Handling

xatolarni qayta ishlash
result = requests.post(f"{API}/delegate", json=payload).json() if result.get('error'): err = result['error'] if err == 'payment_verification_failed': pass # Payment not yet indexed on-chain. Wait 3s and retry. elif err == 'hash_already_used': pass # Already claimed. Do not retry. elif err == 'signature_mismatch': pass # Sender of TRX != signer of the message. Sign with the same key. elif err == 'delegation_failed': pass # Provider could not deliver. Retry or contact support with result['ref'].

Complete Example

Copy this into a file, set your TRON_PRIVATE_KEY environment variable, and run it. The script sends TRX, signs the message, claims the delegation with retry, then sends USDT.

delegate_energy.py
import os, time, requests from tronpy import Tron from tronpy.keys import PrivateKey, keccak256 from coincurve import PrivateKey as CCKey client = Tron() # mainnet — pass HTTPProvider(api_key=...) to avoid rate limits priv = PrivateKey(bytes.fromhex(os.environ['TRON_PRIVATE_KEY'])) sender = priv.public_key.to_base58check_address() API = 'https://api.tronnrg.com' ADDR = 'TFqUiCu1JwLHHnBNeaaVKH7Csm4aA3YhZx' USDT = 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t' # Signature must match TronWeb signMessageV2 byte-for-byte. def sign_message_v2(message, priv): msg = message.encode() prefix = b"\x19TRON Signed Message:\n" + str(len(msg)).encode() digest = keccak256(prefix + msg) raw = CCKey(priv.to_bytes()).sign_recoverable(digest, hasher=None) return '0x' + (raw[:64] + bytes([raw[64] + 27])).hex() def claim_with_retry(tx_hash, delegate_to, signature, retries=3): for _ in range(retries): res = requests.post(f"{API}/delegate", json={ 'tx_hash': tx_hash, 'delegate_to': delegate_to, 'signature': signature, }).json() if not res.get('error'): return res if res['error'] != 'payment_verification_failed': raise Exception(res['message']) time.sleep(3) raise Exception('Transaction not found after retries') def main(): recipient = 'TRecipientWallet' trx_amount = 4 # min 4, max 1000 — you get trx_amount × 16,250 energy # 1. Send TRX (linear pricing: 16,250 energy per TRX) payment = ( client.trx.transfer(sender, ADDR, trx_amount * 1_000_000) .build().sign(priv).broadcast() ) print('Payment:', payment.txid) # 2. Claim delegation (the signature proves you sent the TRX) signature = sign_message_v2(f"{payment.txid}:{recipient}", priv) result = claim_with_retry(payment.txid, recipient, signature) print('Delegated:', result['energy'], 'energy') print('Delegation tx:', result['delegations'][0]['tx']) # verify on TronScan print('Ref:', result['ref']) # 3. Send USDT using the delegated energy contract = client.get_contract(USDT) tx = ( contract.functions.transfer(recipient, 10 * 1_000_000) .with_owner(sender).fee_limit(50_000_000) .build().sign(priv).broadcast() ) print('USDT sent:', tx.txid) if __name__ == '__main__': main()
Always include the signature. It proves you are the wallet that sent the TRX. Without it, the API rejects the request with missing_signature.
Telegram WhatsApp