Sandbox & Environments
How to use DUAL's sandbox environment for development and testing before going to production.
Environment Overview
DUAL provides two environments:
| Environment | Base URL | Purpose |
|---|---|---|
| Sandbox | https://sandbox.gateway-48587430648.europe-west6.run.app | Development and testing — no real assets or fees |
| Production | https://gateway-48587430648.europe-west6.run.app | Live operations with on-chain settlement |
Sandbox Characteristics
- All actions execute instantly — no Sequencer batching delay
- No gas fees or DUAL token costs
- On-chain settlement is simulated (no real Ethereum transactions)
- Data is reset periodically — do not store production data here
- Rate limits are more generous to support rapid iteration
Switching Environments
TypeScript SDK
import { DualClient } from "dual-sdk";
// Sandbox (development)
const sandbox = new DualClient({
token: process.env.DUAL_SANDBOX_KEY,
authMode: "api_key",
baseUrl: "https://sandbox.gateway-48587430648.europe-west6.run.app",
});
// Production
const production = new DualClient({
token: process.env.DUAL_API_KEY,
authMode: "api_key",
baseUrl: "https://gateway-48587430648.europe-west6.run.app", // default
});
Python SDK
from dual_sdk import DualClient
sandbox = DualClient(
token=os.environ["DUAL_SANDBOX_KEY"],
auth_mode="api_key",
base_url="https://sandbox.gateway-48587430648.europe-west6.run.app",
)
production = DualClient(
token=os.environ["DUAL_API_KEY"],
auth_mode="api_key",
# base_url defaults to https://gateway-48587430648.europe-west6.run.app
)
API Keys Per Environment
Sandbox and production use separate API keys. You can generate sandbox keys from the API Keys management page. Never use a production key in sandbox or vice-versa — the platform will reject the request.
Testing Webhooks in Sandbox
Use the Webhooks API test endpoint to simulate events without creating real objects:
// TypeScript
await client.webhooks.test(webhookId, {
event: "object.created",
payload: { object_id: "obj_test_123" },
});
# Python
client.webhooks.test(webhook_id, {
"event": "object.created",
"payload": {"object_id": "obj_test_123"},
})
Environment Variables Best Practice
# .env.development
DUAL_API_KEY=sandbox_key_xxxxxx
DUAL_BASE_URL=https://sandbox.gateway-48587430648.europe-west6.run.app
# .env.production
DUAL_API_KEY=prod_key_xxxxxx
DUAL_BASE_URL=https://gateway-48587430648.europe-west6.run.app
Use your framework's environment variable loading (e.g. dotenv, Next.js .env.local) to automatically switch between environments.
Further Reading
- Production Readiness — checklist before going live
- API Keys — key management reference
- Set Up Webhooks — webhook tutorial