This guide explains how to migrate the Canton MCP Server from localnet (cn-quickstart) to DevNet (ChainSafe).
| Component | Localnet (cn-quickstart) | DevNet (ChainSafe) |
|---|---|---|
| OAuth2 | Keycloak @ localhost:8082 |
Auth0 @ dev-2j3m40ajwym1zzaq.eu.auth0.com |
| Ledger API | http://localhost:3975 |
https://canton-ledger-api-http-dev1.01.chainsafe.dev/api/json-api |
| Validator API | http://localhost:3903 |
https://wallet-validator-dev1.01.chainsafe.dev/api/validator |
| DSO Party | Local DSO (quickstart) | DSO::1220be58c29e65de40bf273be1dc2b266d43a9a002ea5b18955aeef7aac881bb471a |
| Network ID | canton-local |
canton-devnet |
| Authentication | Service account + OAuth2 client credentials | Auth0 OAuth2 client credentials |
You need Auth0 OAuth2 credentials to access ChainSafe DevNet:
Contact ChainSafe to get:
CANTON_OAUTH_CLIENT_ID- Your Auth0 client IDCANTON_OAUTH_CLIENT_SECRET- Your Auth0 client secretCANTON_USER_ID- Your Canton user ID (may be same as client ID)
Or if you have existing DevNet access:
- Check your Auth0 account for existing applications
- Use credentials from your ChainSafe DevNet account
You need a party on DevNet to receive payments. Options:
- Go to ChainSafe Canton Wallet (DevNet instance)
- Create an account or login
- Your party ID will be shown in the wallet UI
- Format:
your-party-name::1220<fingerprint>
# Using the validator API to create an external party
curl -X POST https://wallet-validator-dev1.01.chainsafe.dev/api/validator/v0/parties \
-H "Authorization: Bearer <auth0-token>" \
-H "Content-Type: application/json" \
-d '{
"partyHint": "damlcopilot-receiver",
"displayName": "DAML Copilot Receiver"
}'See /home/skynet/canton/canton-x402-facilitator/scripts/create-external-party.ts for example code.
If you're using on-chain billing with ChargeReceipt contracts:
# 1. Build your DAR
cd /path/to/your/daml/project
daml build
# 2. Upload to DevNet (need to implement this)
# Use Canton Console or participant admin API
# This will give you the BILLING_PACKAGE_IDNote: Package upload on DevNet may require coordination with ChainSafe or use of their deployment tools.
Copy the template:
cd /home/skynet/canton/canton-mcp-server
cp .env.canton.devnet .env.cantonUpdate these values in .env.canton:
-
OAuth2 Credentials (from Step 1):
CANTON_OAUTH_CLIENT_ID=your-auth0-client-id CANTON_OAUTH_CLIENT_SECRET=your-auth0-client-secret CANTON_USER_ID=your-canton-user-id
-
Your Party IDs (from Step 2):
CANTON_PAYEE_PARTY=your-party::1220... CANTON_PROVIDER_PARTY=your-party::1220...
-
Package ID (from Step 3, if using on-chain billing):
BILLING_PACKAGE_ID=your-package-id
-
Billing Portal URL (if you have a devnet instance):
BILLING_PORTAL_URL=https://your-devnet-billing-portal.com
Or comment out if not using:
# BILLING_PORTAL_URL=http://localhost:3050
- ✅
CANTON_LEDGER_URL- ChainSafe DevNet ledger API - ✅
CANTON_OAUTH_TOKEN_URL- Auth0 token endpoint - ✅
CANTON_DSO_PARTY- DevNet DSO party - ✅
CANTON_NETWORK=canton-devnet - ✅
TOKEN_STANDARD_URL- ChainSafe validator API
Verify OAuth2 credentials work:
# Get Auth0 token
curl -X POST https://dev-2j3m40ajwym1zzaq.eu.auth0.com/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"audience": "https://canton.network.global"
}'If successful, you'll get:
{
"access_token": "eyJhbGc...",
"token_type": "Bearer",
"expires_in": 86400
}Verify you can query the ledger:
# Set your token
TOKEN="your-auth0-token-from-step-5"
# Query parties
curl -X POST https://canton-ledger-api-http-dev1.01.chainsafe.dev/api/json-api/v2/query \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"templateId": "DA.Types:Tuple2",
"query": {}
}'cd /home/skynet/canton/canton-mcp-server
python -m canton_mcp_server.serverCheck logs for:
- ✅ OAuth2 token acquisition successful
- ✅ Canton ledger connection successful
- ✅ Party registration/verification successful
Use the facilitator to test a payment:
cd /home/skynet/canton/canton-x402-facilitator
# Update .env with devnet settings
npm run test:paymentOr use the MCP client:
cd /home/skynet/canton/canton-mcp-client
node dist/pay.js daml_automater "spin up canton network"- ❌ Check
CANTON_OAUTH_CLIENT_IDandCANTON_OAUTH_CLIENT_SECRET - ❌ Verify token URL is correct
- ❌ Check token hasn't expired (1 hour default)
- ❌ Ensure
CANTON_USER_IDmatches your Auth0 user
- ❌ Verify party exists on DevNet (not just localnet)
- ❌ Check party format:
name::1220<fingerprint> - ❌ Ensure party is registered on the correct participant
- ❌ Verify DAR is deployed to DevNet
- ❌ Check
BILLING_PACKAGE_IDmatches deployed package - ❌ Ensure package is vetted on your participant
- ❌ Auth0 tokens typically last 24 hours
- ❌ Implement token refresh logic in your client
- ❌ The MCP server should auto-refresh tokens
- ❌ Party creation on DevNet may require ChainSafe approval
- ❌ Use the Canton Wallet UI to create parties (easier)
- ❌ Contact ChainSafe support for participant access
These stay the same:
- ✅
JWT_SECRET- Keep your existing secret for MCP authentication - ✅
BILLING_API_KEY- Keep for billing portal authentication - ✅
MIN_BALANCE_THRESHOLD- Same billing logic - ✅
MCP_SERVER_URL- Still runs on localhost
Pros:
- Fast setup with Docker Compose
- Full control over all components
- Easy debugging (logs accessible)
- Can reset/restart anytime
- Free test tokens via faucet
Cons:
- Not persistent (data lost on restart)
- Not accessible to external users
- Manual party registration
- No production readiness
Pros:
- Persistent state
- Shared with other developers
- Production-like environment
- Professional infrastructure
- Real network conditions
Cons:
- Requires OAuth2 credentials
- Cannot reset state easily
- Party creation may need approval
- Rate limiting on APIs
- Costs for Canton Coin (if not using faucet)
- Test all payment flows - Ensure charges work end-to-end
- Monitor logs - Watch for OAuth2 token refresh, API errors
- Update billing portal - Point to DevNet if needed
- Document party IDs - Keep a record of your DevNet parties
- Setup monitoring - Track API usage, payment success rates
- Canton x402 SDK DevNet Config:
/home/skynet/canton/canton-x402-sdk/.env.example - Facilitator DevNet Template:
/home/skynet/canton/canton-x402-facilitator/env.production.template - Billing Portal DevNet Config:
/home/skynet/canton/canton-billing-portal/.env - ChainSafe DevNet Docs: Contact ChainSafe for official documentation
- Auth0 Docs: https://auth0.com/docs/api/authentication
If you encounter issues:
- Check the error messages in MCP server logs
- Verify all credentials are correct
- Test OAuth2 token acquisition separately
- Contact ChainSafe for DevNet-specific issues
- Open issue in canton-mcp-server repo for bugs