Installation
CDP SDK is available for TypeScript, Python, Rust, and Go. Choose your preferred language and follow the installation instructions below.
TypeScript / JavaScript
Install the package
Install the CDP SDK using npm or your preferred package manager:npm install @coinbase/cdp-sdk
Verify installation
Create a simple test file to verify the installation:import { CdpClient } from "@coinbase/cdp-sdk";
console.log("CDP SDK installed successfully!");
Node.js Version Requirement: CDP SDK requires Node.js version 19 or higher. We recommend using fnm for managing your Node.js version.
TypeScript Configuration
If you encounter TypeScript compilation errors, update your tsconfig.json to use modern module resolution:
{
"compilerOptions": {
"moduleResolution": "node16", // or "nodenext"
// ... other options
}
}
The CDP SDK is built as an ESM package and requires moduleResolution: "node16" or "nodenext" for proper type resolution.
Python
Install the package
Install the CDP SDK using pip: Verify installation
Test the installation in a Python script:from cdp import CdpClient
import asyncio
async def main():
print("CDP SDK installed successfully!")
asyncio.run(main())
The Python SDK is fully async and uses asyncio. Make sure to use async/await patterns in your application.
Rust
Add dependency
Add the CDP SDK to your Cargo.toml:[dependencies]
cdp-sdk = { version = "^0.2.0" }
tokio = { version = "1.0", features = ["full"] }
Verify installation
Test the installation in your Rust code:use cdp_sdk::{auth::WalletAuth, Client, CDP_BASE_URL};
fn main() {
println!("CDP SDK installed successfully!");
}
The Rust SDK requires Tokio async runtime. Include it in your dependencies as shown above.
Install the module
Install the CDP SDK using Go modules:go get github.com/coinbase/cdp-sdk/go
Import in your code
Import and use the SDK in your Go application:package main
import (
"fmt"
cdp "github.com/coinbase/cdp-sdk/go"
)
func main() {
fmt.Println("CDP SDK installed successfully!")
}
Prerequisites
Before you can use the CDP SDK, you’ll need:
- CDP API Keys - Create API keys in the CDP Portal
- Wallet Secret - Generate a wallet secret for signing transactions
See the Authentication guide for detailed setup instructions.
Development vs Production
Development Setup
For development, you can use environment variables to store your credentials:
CDP_API_KEY_ID=your-api-key-id
CDP_API_KEY_SECRET=your-api-key-secret
CDP_WALLET_SECRET=your-wallet-secret
Never commit your .env file to version control. Add it to your .gitignore.
Production Setup
For production environments, use secure secret management:
- AWS Secrets Manager
- HashiCorp Vault
- Google Cloud Secret Manager
- Azure Key Vault
- Environment variables in your deployment platform
Optional Dependencies
Depending on your use case, you may want to install additional libraries:
# For EVM interactions
npm install viem
# For environment variables
npm install dotenv
# For EVM interactions
pip install web3
# For Solana
pip install solders solana
# For environment variables
pip install python-dotenv
[dependencies]
reqwest = { version = "0.11", features = ["json"] }
reqwest-middleware = "0.2"
Troubleshooting
Node.js Version Error
If you see an error about Node.js version:
Node.js version X.X.X is not supported. CDP SDK requires Node.js version 19 or higher.
Upgrade your Node.js version using fnm or nvm.
Jest Configuration Error
If you’re using Jest and encounter an error with jose:
- Create a
jest.setup.ts file:
jest.mock("jose", () => {});
- Update your
jest.config.js:
module.exports = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
};
ESM vs CommonJS
CDP SDK ships as ESM. Use Node v20.19.0 or higher for the best compatibility. If you need CommonJS support, use dynamic imports:
const { CdpClient } = await import("@coinbase/cdp-sdk");
Next Steps
Authentication
Set up your API keys and wallet secret
Quickstart
Build your first CDP application