What You’ll Find
Our examples cover the full range of CDP SDK functionality:- Account Management - Create, import, export, and manage EVM and Solana accounts
- Transactions - Sign and send transactions, handle user operations
- Smart Accounts - Work with EIP-4337 smart accounts and user operations
- Token Operations - Check balances, transfer tokens, swap assets
- Policies - Create and manage spending limits and access controls
- End User Management - Handle end user accounts and authentication
- Network Integration - Work with multiple blockchain networks
Repository Structure
All examples are located in the CDP SDK repository underexamples/:
Getting Started
Prerequisites
Before running any examples, you’ll need:- CDP API Credentials - Get your API key and wallet secret from the CDP Portal
- Language Runtime - Install the appropriate runtime for your language:
- TypeScript: Node.js 18+ and pnpm
- Python: Python 3.9+ and uv
- Rust: Rust 1.70+
- Go: Go 1.21+
Configuration
All examples use environment variables for configuration:.env
.env.example file. Copy it to .env and fill in your credentials:
Never commit your
.env file to version control. It contains sensitive credentials.Quick Start by Language
TypeScript
Modern async/await patterns with full TypeScript support
Python
Pythonic async examples with type hints
Rust
Type-safe examples with async/await
Go
Idiomatic Go examples with goroutines
Common Patterns
Client Initialization
All examples start by initializing the CDP client with your credentials:Account Creation
Creating accounts follows a consistent pattern:Example Categories
EVM Examples
Work with Ethereum and EVM-compatible chains:- Account creation and management
- Transaction signing and sending
- Smart contract interactions
- Token transfers and swaps
- Smart accounts (EIP-4337)
Solana Examples
Build on Solana:- Solana account management
- Transaction and message signing
- SPL token operations
- Program interactions
Policy Examples
Implement access controls:- Spending limits
- Allowlist/blocklist policies
- Time-based restrictions
- Custom policy rules
Integration Examples
Integrate with popular tools:- Viem integration (TypeScript)
- Web3.py integration (Python)
- Custom RPC providers
Testing with Testnets
Most examples are designed to work with testnets:- Base Sepolia - Primary testnet for EVM examples
- Solana Devnet - Primary testnet for Solana examples
Testnet tokens have no real value. Use testnets for development and testing before moving to mainnet.
Running Examples
Each language has its own execution pattern:- TypeScript
- Python
- Rust
- Go
Next Steps
Explore examples for your preferred language:TypeScript Examples
Browse 100+ TypeScript examples
Python Examples
Explore Python SDK examples
Rust Examples
View Rust implementation examples
Go Examples
Check out Go SDK examples
Need Help?
If you encounter issues with the examples:- Check the SDK documentation for API details
- Review the README in each language directory
- Open an issue on GitHub
- Join our Discord community