Overview
A Service Key is the serialized private key for a service-owned DID. It enables Nuwa services (e.g., MCP Server/Proxy, LLM Gateway) to authenticate/authorize, price requests, and settle revenue.Please use a dedicated service DID to generate your service key, not your client/user DID. It may lead to unexpected behavior if you use the same DID for both.
Prerequisites
- Access to https://test-id.nuwa.dev (cadop-web)
- A modern browser with Passkey or wallet support
Step 1 — Create a service-dedicated Agent DID
- Sign in at https://test-id.nuwa.dev.
- Follow the onboarding to create an Agent DID (the app will claim minimal RGas automatically).
- You will get an Agent DID like
did:rooch:....

Step 2 — Generate ServiceKey and write to DID Document
- Open the Agent detail page → click “Add Authentication Method”.
- Click “Generate Key Pair” to create a service key pair.
- Capabilities: select
authenticationandcapabilityInvocation. - Submit to write the verification method to your DID Document.
- Copy the generated Service Key immediately (it is shown only once) and store it securely.

Step 3 — Configure environment and start your service
Use the copied key asSERVICE_KEY:
- MCP Server: see the “Set environment variables and run” step in the MCP Server guide.
- MCP Proxy: set
serviceKey: "${SERVICE_KEY}"in yourconfig.yaml. - Other services (e.g., LLM Gateway): set
SERVICE_KEYaccording to that service’s configuration.
- Inject via env vars; never commit keys to source control.
- Rotate keys periodically and separate keys per environment (dev/test/prod).
Step 4 — Add your service to the DID (Service record)
- In the Agent detail page, open Services → “Add Service”.
- Enter your service endpoint (e.g.,
https://your.domain/mcp). - Ensure the well-known health check passes, then save.

Step 5 — Verify and see revenue
- Call your service using an appropriate client. For MCP-based services you can also use Cap Studio’s MCP Debug tool.
- When channel revenue reaches the claim threshold, the service auto-claims.
- View balances, withdraw funds, and audit history in the Revenue dashboard.
Troubleshooting
- Passkey/wallet not available: try another browser or re-register.
- Insufficient gas: wait for faucet claim or retry.
Best Practices
- Environment isolation (dev/test/prod).
- Secure backups of ServiceKey.

