Buy Energy for a dApp
A complete walkthrough for dApp developers who need TRON energy. From account creation to verifying the delegation on TronScan.
Why Buy Energy
Every transaction on TRON consumes energy. Without delegated energy, your users pay fees in TRX that get burned. For high-volume dApps (token transfers, DEX swaps, contract calls), renting energy through Merx is significantly cheaper than burning TRX - often 3 to 5 times cheaper.
Merx compares multiple energy providers and gives you one current executable MERX quote for exact order parameters. The quote identifies the provider represented by the current price; PowerSun fulfills accepted MERX orders.
Step 01Register at Merx
Go to merx.exchange and create an account. You will receive a dashboard where you can manage API keys, view orders, and monitor your balance.
Create an API Key
In the dashboard, navigate to API Keys and click Create. You will receive a secret key starting with sk_live_. Copy it immediately -- it will not be shown again. Store it in an environment variable.
export MERX_API_KEY="sk_live_your_key_here"Never hardcode your API key in source code. Use environment variables or a secrets manager.
Deposit TRX
Before placing orders, you need a TRX balance on Merx. Call the deposit endpoint to get your unique deposit address, then send TRX to it from any wallet without a memo. Check your balance after the transfer has been confirmed and credited.
curl https://merx.exchange/api/v1/deposit/info \
-H "X-API-Key: $MERX_API_KEY"{
"data": {
"deposit_address": "TYourPersonalDepositAddress...",
"min_amount_trx": 2,
"activation_fee_trx": 0,
"note": "Send TRX to this address without a memo."
}
}Check Current Prices
The prices endpoint is public. It returns non-executable raw observations from active providers for market analysis. Use the exact preview below when you need the current order price and quoted provider.
curl https://merx.exchange/api/v1/pricesFor a quick cost estimate without placing an order, use the preview endpoint. It shows the current provider and how much TRX you would pay.
curl "https://merx.exchange/api/v1/orders/preview?resource=ENERGY&amount=65000&duration=86400&target_address=TYourDAppContractAddress"Create an Order
Specify the resource type, amount, duration, and the TRON address that should receive the delegation. Include an Idempotency-Key header to prevent duplicate orders on retries. Choose a fixed duration: 2, 5, 10, 15, 30 minutes; 1, 3, 6, or 24 hours.
curl -X POST https://merx.exchange/api/v1/orders \
-H "X-API-Key: $MERX_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: my-dapp-order-001" \
-d '{
"resource_type": "ENERGY",
"amount": 65000,
"duration_sec": 86400,
"target_address": "TYourDAppContractAddress"
}'{
"id": "ord_x7k9m2",
"status": "EXECUTING",
"resource_type": "ENERGY",
"amount": 65000,
"duration_sec": 86400,
"target_address": "TYourDAppContractAddress",
"total_cost_sun": "5460000",
"created_at": "2026-03-29T10:00:00Z"
}Verify on TronScan
Once the order status moves to FILLED, the energy delegation is live on-chain. You can verify it on TronScan by searching for your target address and checking the Resources section. The delegated energy will appear under "Energy (Delegated)".
You can also poll the order endpoint to track status transitions: PENDING, EXECUTING, FILLED, or FAILED.
curl https://merx.exchange/api/v1/orders/ord_x7k9m2 \
-H "X-API-Key: $MERX_API_KEY"Set up a webhook for the order.filled event to get notified automatically instead of polling. See the webhooks guide.
Next Steps
- Automate orders with the JavaScript SDK or Python SDK
- Monitor prices and buy at the best time - see Monitor Prices
- Receive order notifications via webhooks