Docs menu

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

MainnetNile testnet
Base URLhttps://api.tenergy.me/v1https://api-nile.tenergy.me/v1
Key prefixak_live_… / sk_live_…ak_test_… / sk_test_…
BalanceCredited by a real depositCredited 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.orgnile.tronscan.org
USDT contractTR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6tTXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf
Public TRON nodehttps://api.trongrid.iohttps://nile.trongrid.io
network in GET /v1/prices and webhook payloadsmainnetnile

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.

  1. Run npm install && npm run quickstart (or python 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 an ak_test_… key to .env, and prints both wallets with their TRX, energy and bandwidth.
  2. Send wallet A test TRX and “JST test tokens” from the Nile faucet.
  3. 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.

NileMainnet
SupplyA small test inventory; a large order may fail with 5001 insufficient_supplyLive supply
Maximum delegate lock5 days (getMaxDelegateLockPeriod 144,000 blocks)30 days (864,000 blocks)
Unfreeze delay1 day14 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.

Next steps

    ↑ ↓ to move · Enter to open · Esc to close