Environments
There are two environments, on two hosts. An account, its ledger, its keys and its webhook secrets belong to exactly one of them — nothing spans both.
Before you begin
| Mainnet | Nile testnet | |
|---|---|---|
| Base URL | https://api.tenergy.me/v1 | https://api-nile.tenergy.me/v1 |
| Key prefix | ak_live_… / sk_live_… | ak_test_… / sk_test_… |
| Balance | Credited by a real deposit | Credited by a deposit of Nile TRX from the public faucet |
| Test TRX and USDT | — | Free from the Nile faucet: nileex.io |
| Explorer (transactions, delegations) | tronscan.org | nile.tronscan.org |
| USDT contract | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t | TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf |
| Public TRON node | https://api.trongrid.io | https://nile.trongrid.io |
network in GET /v1/prices and webhook payloads | mainnet | nile |
A key sent to the other environment’s host is refused with 1012 key_environment_mismatch before it is looked up.
Check which one you are talking to
GET /v1/prices is public and names its network, so a client can assert the environment before it spends anything.
curl -s https://api-nile.tenergy.me/v1/prices | grep -o '"network":"[a-z]*"'
const prices = await (await fetch("https://api-nile.tenergy.me/v1/prices")).json();
if (prices.network !== "nile") throw new Error(`expected nile, got ${prices.network}`);
import json, urllib.request
with urllib.request.urlopen("https://api-nile.tenergy.me/v1/prices") as res:
prices = json.load(res)
assert prices["network"] == "nile", prices["network"]
Try it on Nile
The runnable quickstarts (tenergy-examples-ts, tenergy-examples-py) target Nile by default.
- Run
npm install && npm run quickstart(orpython quickstart.py). It creates two test wallets — A, which signs up and sends, and B, which receives — signs up with A, saves the wallets and anak_test_…key to.env, and prints both wallets with their TRX, energy and bandwidth. - Send wallet A test TRX and “JST test tokens” from the Nile faucet.
- The script waits for the faucet’s coins (up to 10 minutes) and goes on: it deposits from A, estimates sending 1 JST from A to B, rents exactly that energy, sends the JST and prints the energy used and TRX burned: 0, with nile.tronscan.org links.
On Nile, the USDT contract pays its callers’ energy itself, so renting energy for a USDT transfer there changes nothing you can see. JST charges the sender, exactly like USDT on mainnet — test the energy path with JST (TF17BgPaZYbz8oxbjhriubPDsA7ArKoLX3).
What Nile cannot prove
Nile is not an identical testnet. Rehearse the API’s shape there; prove behaviour on mainnet.
| Nile | Mainnet | |
|---|---|---|
| Supply | A small test inventory; a large order may fail with 5001 insufficient_supply | Live supply |
| Maximum delegate lock | 5 days (getMaxDelegateLockPeriod 144,000 blocks) | 30 days (864,000 blocks) |
| Unfreeze delay | 1 day | 14 days (getUnfreezeDelayDays) |
Webhook deliveries from Nile are signed with the Nile endpoint’s own secret. A receiver serving both environments picks the secret by environment — by network in the payload or by the URL the request arrived at — never by event type.