ClawRouter
ClawRouter copied to clipboard
feat: add CDP (Coinbase Developer Platform) MPC wallet support
CDP Wallet Support for ClawRouter
Adds Coinbase Developer Platform (CDP) MPC wallets as an alternative to raw private keys for x402 payments.
Why?
- MPC-based — no single private key to leak or lose
- Enterprise-grade — Coinbase-managed backup and recovery
- Agent-native — programmatic wallet creation via API
- Fully backward compatible — raw private key still works exactly as before
Changes
New files
src/wallet-signer.ts—WalletSignerinterface (abstract signing layer)src/wallet-cdp.ts— CDP MPC wallet implementation using@coinbase/coinbase-sdksrc/wallet-pk.ts— Raw private key wrapper (satisfiesWalletSigner)docs/cdp-wallet.md— Full setup documentation
Updated files
src/x402.ts—createPaymentFetch()now acceptsWalletSigner |0x${string}``src/proxy.ts—ProxyOptionsaccepts optionalwalletSignersrc/index.ts— Auto-detects CDP env vars at startup, falls back to raw keysrc/auth.ts— NewcdpWalletAuth(wizard) +cdpEnvAuth(env vars) methods
Usage
# Set CDP credentials
export BLOCKRUN_CDP_API_KEY_NAME="organizations/xxx/apiKeys/yyy"
export BLOCKRUN_CDP_PRIVATE_KEY="-----BEGIN EC PRIVATE KEY-----\n..."
# ClawRouter auto-detects and uses CDP wallet on startup
openclaw gateway restart
Build
- ESM ✅
- DTS ✅
- Zero breaking changes
Thanks for this, and apologies it sat. Closing as not-rebasable rather than not-wanted: it rewrites src/x402.ts and changes createPaymentFetch()'s signature — both of which no longer exist. Main now builds its pay-fetch from x402Client (@x402/fetch) + createPayFetchWithPreAuth, and toClientEvmSigner from @x402/evm is the signer abstraction now. So the seam you wanted exists; it just landed differently.
Two things worth flagging if you or anyone revisits CDP support:
createAndPersistWalletcallswallet.export()and writes the seed in plaintext to~/.openclaw/blockrun/cdp/wallet.json— which defeats the stated premise of "no single private key to leak".- The EIP-712 path hashes with viem then calls
defaultAddress.signHash(hash); there's no test proving a CDP-signed authorization actually settles with the facilitator (v normalization / format).
A fresh PR against @x402/evm's signer interface would be welcome.