Developers

Environments

Testnet and production hosts, chain IDs, and the one variable that switches between them.

On this page

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_DOMAIN to testnet.grvt.io or grvt.io. The raw Markdown examples use it.
EnvironmentGRVT_DOMAINChain IDEthereum chain ID
Testnettestnet.grvt.io32611155111 (Sepolia)
Productiongrvt.io3251 (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.

SDKTestnetProductionBy name (e.g. from GRVT_ENV)
PythonGrvt(env="testnet")Grvt(env="prod")Grvt(env=os.environ["GRVT_ENV"])
TypeScriptnew Grvt({ env: "testnet" })new Grvt({ env: "prod" })new Grvt({ env: process.env.GRVT_ENV! })
Gogrvt.Config{Env: grvt.Testnet()}grvt.Config{Env: grvt.Prod()}grvt.EnvironmentNamed(os.Getenv("GRVT_ENV"))
RustConfig::testnet()Config::prod()Config::named(&std::env::var("GRVT_ENV")?)?

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
ServiceURL
Market data (HTTP)https://market-data.testnet.grvt.io
Market data (WebSocket)wss://market-data.testnet.grvt.io/ws/full
Trading (HTTP)https://trades.testnet.grvt.io
Trading (WebSocket)wss://trades.testnet.grvt.io/ws/full
Edge (login)https://edge.testnet.grvt.io
Server timeGET https://market-data.testnet.grvt.io/time 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.

FullLite (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.EncodingFull in 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 (s is 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 /time have 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

  1. Open testnet.grvt.io/exchange/deposit.
  2. Click Mint testnet tokens (USDT, USDC or GRVT). They go to your Funding Account (main account).
  3. Move them to the Trading Account (sub-account) you trade from.

Watch out: without funds, orders fail with 2080 InsufficientMargin.

esc

↑ ↓ move↵ open⇧↵ open .mdTry an error code like 2002

Keyboard shortcuts

⌘ K
Search the docs
/
Search
l
Next code language (Python → TypeScript → Go → Rust → curl → WebSocket)
j / k
Next / previous page
t
Light / dark theme
?
This help
Esc
Close dialogs and drawers