Overview
SX Bet runs a full testnet environment (called Toronto) that mirrors mainnet. Use testnet to develop and test your integration without risking real funds, then switch to mainnet by updating a few configuration values.Testnet setup
1. Create a testnet account
Sign up at toronto.sx.bet and export your private key from the assets page, the same way you would on mainnet.2. Get testnet funds
Open a support chat on sx.bet to receive testnet USDC.3. Enable betting on testnet
Approve theTokenTransferProxy on the testnet chain. The simplest way is to place a test bet through the toronto.sx.bet UI. To do it programmatically, see Enabling Betting — just use the testnet RPC URL and contract addresses below.
Configuration reference
Everything that differs between testnet and mainnet:| Setting | Testnet (Toronto) | Mainnet |
|---|---|---|
| API Base URL | https://api.toronto.sx.bet | https://api.sx.bet |
| App URL | https://toronto.sx.bet | https://sx.bet |
| Chain ID | 79479957 | 4162 |
| RPC URL | https://rpc-rollup.toronto.sx.technology | https://rpc-rollup.sx.technology |
| Explorer API | https://explorerl2.toronto.sx.technology/api | https://explorerl2.sx.technology/api |
| USDC Address | 0x1BC6326EA6aF2aB8E4b6Bc83418044B1923b2956 | 0x6629Ce1Cf35Cc1329ebB4F63202F3f197b3F050B |
| Metadata | https://api.toronto.sx.bet/metadata | https://api.sx.bet/metadata |
Structuring your code for easy switching
The cleanest approach is to store all environment-specific values in a config object and swap based on an environment variable:cfg everywhere instead of hardcoding values:
Switching to mainnet checklist
When you’re ready to go live:- Set
SX_ENV=mainnet(or update your config to use mainnet values) - Use your mainnet private key and API key (testnet keys won’t work on mainnet)
- Fund your mainnet wallet with USDC
- Approve the
TokenTransferProxyon mainnet — either through sx.bet or programmatically - Confirm your fill signing domain uses chain ID
4162andEIP712FillHasherfrom/metadataasverifyingContract - Test with a small order before scaling up
Common pitfalls
Wrong chain ID in signatures
If you seeTAKER_SIGNATURE_MISMATCH or orders being rejected, check that your signing domain’s chainId matches the network you’re targeting. Testnet is 79479957, mainnet is 4162.
Wrong token addresses
USDC has different contract addresses on each network. Using a testnet token address on mainnet (or vice versa) will result inBAD_BASE_TOKEN errors.
Hardcoded executor or TokenTransferProxy
These addresses differ between networks. You can fetch them fromGET /metadata at startup and cache them in your config.
Testnet API key on mainnet
API keys are network-specific. Generate a separate key for each environment.Related
References →
Full list of addresses, URLs, and chain IDs.
Enabling Betting →
Approve the TokenTransferProxy for trading.
Querying Balances →
Check your balance on either network.
Quickstart →
End-to-end guide from setup to first fill.
