# Environments

Source: https://tenergy.me/docs/environments
Last updated: 2026-09-28

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](https://nileex.io/join/getJoinPage) |
| `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.

```bash title="cURL"
curl -s https://api-nile.tenergy.me/v1/prices | grep -o '"network":"[a-z]*"'
```

```ts title="TypeScript"
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}`);
```

```python title="Python"
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](https://tenergy.me/docs/sdk)) targets Nile by default.

1. Run `npm install && RECEIVER_ADDRESS=T… npm start` with no `TENERGY_KEY` set. It signs up with a generated wallet and prints an `ak_test_…` key, its secret and the account's Nile deposit address. Save the key and secret to `.env`.
2. Get Nile TRX from the public faucet: [nileex.io/join/getJoinPage](https://nileex.io/join/getJoinPage).
3. Send it to the Nile deposit address from step 1. It is credited after 19 confirmations, about a minute.
4. Run `npm start` again. It finds the balance and places a 65,000-energy `1h` order for `RECEIVER_ADDRESS`.
5. 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 |

> [!WARNING]
> 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

- [Quickstart](https://tenergy.me/docs/quickstart) — the five requests, pointed at Nile.
- [Authentication](https://tenergy.me/docs/authentication) — signing is identical on both hosts.
- [Webhooks](https://tenergy.me/docs/webhooks) — `network` and `test` in every payload.
