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 |
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 TypeScript quickstart (examples/ts-quickstart, see SDKs) targets Nile by default.
- Run
npm install && RECEIVER_ADDRESS=T… npm startwith noTENERGY_KEYset. It signs up with a generated wallet and prints anak_test_…key, its secret and the account’s Nile deposit address. Save the key and secret to.env. - Get Nile TRX from the public faucet: nileex.io/join/getJoinPage.
- Send it to the Nile deposit address from step 1. It is credited after 19 confirmations, about a minute.
- Run
npm startagain. It finds the balance and places a 65,000-energy1horder forRECEIVER_ADDRESS. - The order reaches
active; the script prints the settled order.
What Nile cannot prove
Nile is not an identical testnet. Rehearse the API’s shape there; prove behaviour on mainnet.
| Nile | Mainnet | |
|---|---|---|
| Provider execution | Through ITRX only — the other providers have no testnet | The full cascade |
| Supply | A small fixed inventory; a large order may fail with 5001 insufficient_supply | The live supply |
| Maximum delegate lock | 5 days (getMaxDelegateLockPeriod 144,000 blocks) | 30 days (864,000 blocks) |
| Unfreeze delay | 1 day | 14 days (getUnfreezeDelayDays) |
| Unstake pipeline | Cannot be exercised | Runs |
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.