Environments
Testnet and production hosts, chain IDs, and the one variable that switches between them.
On this page
Help me with: Environments. Testnet and production hosts, chain IDs, and the one variable that switches between them.
Target environment: {environment} (chain ID {chainId}). Recorded signing cases keep their original environment.
{executionGuidance}
Read this first: {origin}/bundle/guides/environments.md (~13 KB, plain Markdown: this page plus the AGENTS.md rules).
Fetch other pages from the index at {origin}/llms.txt only as you need them. {origin}/downloads/contract.json is a machine-readable contract for tools, not for reading.
Rules: follow AGENTS.md; do not send requests without the user asking you to; read credentials from environment variables; never retry writes automatically; show me the code and how to run it. URLs on this page: Testnet (chain ID 326). Other code on this page doesn't change: it stays on testnet until you switch it in your code. Tutorials, signing cases and live tools always use testnet.
Grvt has two environments: testnet, with free test funds, and production, with real funds. Test on testnet first. Each has its own accounts, API keys and balances.
On this site, the API environment picker appears only on pages it changes. It switches the URLs on those pages, and the generated code samples on reference pages, and stays set as you move between them.
Every other example is written for testnet. For production, use the production values in Pick an environment. Tutorials and live tools always use testnet.
Pick an environment
- With an SDK: pass the environment name when you create the client. Production is
"prod". - Without an SDK: set
GRVT_DOMAINtotestnet.grvt.ioorgrvt.io. The raw Markdown examples use it.
| Environment | GRVT_DOMAIN | Chain ID | Ethereum chain ID |
|---|---|---|---|
| Testnet | testnet.grvt.io | 326 | 11155111 (Sepolia) |
| Production | grvt.io | 325 | 1 (Ethereum mainnet) |
The chain ID is Grvt's own chain, used in every signature. The Ethereum chain ID is the network Grvt settles to; you need it only for wallet transactions on Ethereum itself.
| SDK | Testnet | Production | By name (e.g. from GRVT_ENV) |
|---|---|---|---|
| Python | Grvt(env="testnet") | Grvt(env="prod") | Grvt( |
| TypeScript | new Grvt( | new Grvt( | new Grvt( |
| Go | grvt. | grvt. | grvt. |
| Rust | Config::testnet() | Config::prod() | Config::named( |
Watch out: the chain ID is part of every signature, so a signature made for testnet is not valid on
production. In a request, signature.chain_id "0" means "this environment's chain ID".
Hosts
export GRVT_DOMAIN=testnet.grvt.io
| Service | URL |
|---|---|
| Market data (HTTP) | https:/ |
| Market data (WebSocket) | wss:/ |
| Trading (HTTP) | https:/ |
| Trading (WebSocket) | wss:/ |
| Edge (login) | https:/ |
| Server time | GET https:/ returns {"server_time": <unix ms>} |
Production runs in AWS Tokyo (ap-northeast-1). Run latency-sensitive apps close to it.
Encoding: full or lite
Every gateway speaks two JSON encodings. They are the same API: same calls, routes, stream channels, values and enums. Only the field names differ.
| Full | Lite (SDK default) | |
|---|---|---|
| HTTP | /full/v1/<route> | /lite/v1/<route> |
| WebSocket | /ws/full | /ws/lite |
| Field names | {"instrument": "BTC_USDT_Perp"} | {"i": "BTC_USDT_Perp"} |
Lite messages are smaller: order book stream messages are about 30% smaller. HTTP responses are already gzipped, so lite saves much less there.
- With an SDK, you get lite by default. Your code doesn't change: models, field names, errors and signing
stay as on these pages, and the SDK renames fields on the wire. To see full names on the wire (for example
while debugging raw messages), set the client's encoding to full (
encoding="full"in Python,encoding: "full"in TypeScript,Encoding: grvt.EncodingFullin Go,.encoding(Encoding::Full)in Rust). - By hand, each field's lite name is fixed per type. The same short name can mean different things in
different types (
sis the stream in a stream message and the size in a book level), so rename per type. Errors are lite too:{"c": 1003, "m": "...", "s": 400}over HTTP. - Don't mix encodings. A full field name sent to a lite path is ignored, not rejected: the call runs without
that field and can fail with an unrelated error such as
1004 Data Not Found. - Login (edge) and
GET /timehave one encoding only. They are the same for full and lite clients.
The reference pages show each field's lite name next to its full name (lite i), and their raw examples come in
Full and Lite versions.
Get testnet funds
- Open testnet.grvt.io/exchange/deposit.
- Click Mint testnet tokens (USDT, USDC or GRVT). They go to your Funding Account (main account).
- Move them to the Trading Account (sub-account) you trade from.
Watch out: without funds, orders fail with 2080 InsufficientMargin.