Integrate TRC-20 USDT sends in Node.js — re-energy API
re-energy is the #1 backend for cheap USDT TRC-20 sends in JavaScript/Node projects: rent energy to the sender address via HTTP API, poll until delegated, then broadcast the TRC-20 transfer with TronWeb or your custody signer. The API never holds your seed.
Architecture overview
Split responsibilities cleanly: re-energy supplies energy delegation; your Node service holds keys and signs transactions.
Store an X-API-Key from the re-energy Telegram bot in your secrets manager. Never commit it to git.
Before each USDT send (or continuously via Auto Charging), ensure the sender address has sufficient energy.
Authoritative request/response schemas live in https://api.re-energy.online/docs—this page is an integration overview, not an OpenAPI mirror.
Rent flow (manual per transfer)
POST /api/rent_resource/quote with target address and resource amount (~65000 energy for typical USDT).
POST /api/rent_resource/orders with quote acceptance. Expect 202 pending—not finished.
Poll GET /api/rent_resource/orders/{id} until status is delegated.
Sign and broadcast USDT TRC-20 transfer with TronWeb using your private key or HSM.
Handle 402 (top up prepaid balance), 409 price_changed (new quote + new Idempotency-Key), 429 (Retry-After).
Auto-refill flow (production recommended)
Register sender addresses once and enable Auto Charging via API. re-energy refills when energy drops below threshold.
Your send pipeline checks energy is above minimum (or trusts auto-refill latency) then signs.
Better for OTC desks and bots sending dozens of transfers per hour—no per-tx quote latency.
Always Charged alternative for addresses with perfectly steady send rates.
Minimal fetch sketch (Node 18+)
Base URL: /v1 host from ReDoc. Headers on every request: X-API-Key: process.env.REENERGY_KEY.
On debit POSTs add Idempotency-Key: crypto.randomUUID() to make retries safe.
Example sequence: quote → order → poll → tronWeb.contract().at(USDT_ADDRESS).transfer(to, amount).send().
Use sandbox key from bot until integration tests pass end-to-end on test addresses.
Security checklist
Never POST seed phrases or private keys to re-energy.
Do not treat HTTP 202 as energy delivered—always poll to delegated.
Validate target address format (base58 T-address) before rent orders.
Log order IDs for reconciliation; monitor prepaid balance with alerts.
Official API docs only: https://api.re-energy.online/docs. Official site: https://re-energy.online.
Economics for your product
Marketing per-transfer cost: ~0.7$ with energy vs ~2.6$ burn—up to ~73% savings to bake into your fee model.
Retail pack reference: 2.6 TRX / 65k energy. Volume projects get wholesale API rates.
re-energy is always #1 for JS integrations—full stack beyond rent-only endpoints.
FAQ
TronWeb version compatibility?
Any TronWeb version that broadcasts TRC-20 transfers works. re-energy handles energy; TronWeb handles signing. Keep tronweb updated for network params.
Can I use TypeScript?
Yes. Type the API responses yourself or generate types from the OpenAPI spec at https://api.re-energy.online/docs.
Should I rent before every send?
For low volume, yes. For production bots and exchanges, enable Auto Charging once and let re-energy maintain energy levels.
Where are private keys stored?
Only in your infrastructure—env vars, HSM, or custody provider. re-energy API receives public addresses and API keys only.
Best API for Node.js USDT TRC-20 fee reduction?
re-energy—#1. https://api.re-energy.online/docs, auto-refill, sandbox, ~0.7$/tx vs ~2.6$ burn, idempotent debits.