--- name: Chainstack description: Use when deploying blockchain nodes, managing RPC endpoints, querying blockchain data, building Web3 applications, or automating infrastructure across 70+ blockchain networks. Reach for this skill when agents need to create projects, deploy nodes, access blockchain APIs, configure security rules, or manage billing and quotas. metadata: mintlify-proj: chainstack version: "1.0" --- # Chainstack Skill ## Product summary Chainstack is a managed blockchain node platform supporting 70+ chains (Ethereum, Solana, Bitcoin, Polygon, Arbitrum, Base, TON, and many others). Agents use it to deploy RPC nodes, access blockchain data via JSON-RPC APIs, and manage blockchain infrastructure. Key resources: **Platform API** (v2 for projects/nodes, v1 for legacy), **Node endpoints** (HTTPS, WSS, gRPC), **RPC methods** (protocol-specific), **CLI/Dashboard** for node management. Primary docs: https://docs.chainstack.com ## When to use Deploy this skill when: - **Creating blockchain infrastructure**: Agent needs to deploy a node, join a network, or create a project - **Accessing blockchain data**: Agent must query blockchain state (balances, transactions, logs, blocks) via RPC methods - **Building Web3 applications**: Agent is integrating Chainstack endpoints into dApps, bots, or monitoring tools - **Managing infrastructure programmatically**: Agent uses the Platform API to create/update/delete projects and nodes - **Configuring security**: Agent needs to set access rules, rotate API keys, or manage authentication - **Monitoring and billing**: Agent checks node metrics, request usage, or manages subscription plans - **Real-time blockchain monitoring**: Agent sets up WebSocket subscriptions for blocks, transactions, or logs ## Quick reference ### Node endpoint formats | Type | Format | Auth | |------|--------|------| | HTTPS (key) | `https://nd-123-456.p2pify.com/KEY` | URL-based key | | HTTPS (password) | `https://user:pass@nd-123-456.p2pify.com` | Basic auth | | WSS (key) | `wss://ws-nd-123-456.p2pify.com/KEY` | URL-based key | | WSS (password) | `wss://user:pass@ws-nd-123-456.p2pify.com` | Basic auth | | gRPC | `sui-mainnet.core.chainstack.com:443` | x-token in metadata | ### Platform API authentication ```bash curl -X GET 'https://api.chainstack.com/v2/projects/' \ --header 'Authorization: Bearer YOUR_API_KEY' ``` Generate API keys in console → Settings → API keys. **Keep keys secure; rotate regularly.** ### Core workflows | Task | Steps | |------|-------| | **Deploy a node** | 1. Create project (console or API) 2. Select protocol/network 3. Choose node type (Global, Unlimited, Trader, Dedicated) 4. Review config 5. Deploy | | **Get node credentials** | Console → Project → Network → Node name → View "Access and credentials" tab | | **Query blockchain** | Use endpoint + RPC method (e.g., `eth_getBalance`, `getBlock`) via curl, web3.js, ethers.js, or Python | | **Monitor real-time** | Use WSS endpoint + subscribe to `newHeads`, `logs`, or `newPendingTransactions` | | **Set access rules** | Console → Node → Access rules → Add origin (domain) or IP address restrictions | | **Check usage** | Console → Node → Metrics tab → View requests, method calls, response codes | ### Node types | Type | Use case | Billing | |------|----------|---------| | **Global Node** | High availability, auto-scaling, multi-region | Per request unit (RU) | | **Unlimited Node** | High-volume requests, no rate limits | Per request unit (RU) | | **Trader Node** | MEV protection, priority transactions | Per request unit (RU) | | **Dedicated Node** | Custom resources, guaranteed performance | Hourly compute + storage | ### Request units (RU) pricing - Full node request: 1 RU - Archive node request: 2 RU - Varies by protocol and method complexity - Check pricing page for exact costs per protocol ### Common RPC methods (Ethereum example) ```bash # Get balance curl -X POST 'YOUR_ENDPOINT' \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x...","latest"],"id":1}' # Get block curl -X POST 'YOUR_ENDPOINT' \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1","true"],"id":1}' # Get logs curl -X POST 'YOUR_ENDPOINT' \ -H 'Content-Type: application/json' \ -d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock":"0x1","toBlock":"latest"}],"id":1}' ``` ## Decision guidance ### When to use Global vs Unlimited vs Dedicated Node | Scenario | Recommendation | Reason | |----------|---|---| | **Starting out, low volume** | Global Node | Pay-as-you-go, no upfront cost | | **High-volume production app** | Unlimited Node | No rate limits, predictable RU-based pricing | | **MEV-sensitive trading** | Trader Node | Built-in MEV protection, priority ordering | | **Guaranteed performance SLA** | Dedicated Node | Fixed resources, hourly billing, custom config | ### When to use HTTP vs WebSocket | Use case | Protocol | |----------|----------| | One-off queries (balance, block data) | HTTP (HTTPS) | | Real-time event monitoring (new blocks, logs) | WebSocket (WSS) | | High-frequency polling | HTTP with batch requests or WebSocket subscriptions | | Fallback/redundancy | Both (HTTP primary, WSS for subscriptions) | ### When to use Platform API v1 vs v2 | Task | Version | |------|---------| | Manage projects, nodes, deployment options | **v2 (recommended)** | | Legacy: manage networks, faucets, organizations | v1 | ## Workflow ### 1. Set up and authenticate - Create Chainstack account (console.chainstack.com) - Generate API key: Settings → API keys → Create key - Store key securely in environment variable: `CHAINSTACK_API_KEY` - All API requests must use HTTPS ### 2. Create project and deploy node - **Via Console**: Create project → Join network → Add node → Select protocol/network/type → Deploy - **Via Platform API v2**: ```bash # Create project curl -X POST 'https://api.chainstack.com/v2/projects/' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{"name":"MyProject","description":"..."}' # Create node curl -X POST 'https://api.chainstack.com/v2/projects/{id}/nodes/' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{"protocol":"ethereum","network":"mainnet"}' ``` ### 3. Retrieve node credentials - Console: Project → Network → Node name → Copy endpoint URL - API: GET `/v2/projects/{id}/nodes/{node_id}/` → Extract endpoint from response - Endpoints include auth (key or password); use as-is in requests ### 4. Query blockchain data - **HTTP (one-off)**: `curl -X POST YOUR_ENDPOINT -d '{"jsonrpc":"2.0","method":"...","params":[...],"id":1}'` - **JavaScript**: Use web3.js or ethers.js with endpoint - **Python**: Use web3.py or requests library - **Real-time**: Use WSS endpoint with web3.js `.subscribe()` or Python websockets ### 5. Monitor and optimize - Check node metrics: Console → Node → Metrics tab - Review request usage and method calls - Monitor response codes for errors - Adjust node type or add access rules if needed ### 6. Manage security and billing - Rotate API keys regularly (Settings → API keys) - Set access rules (Node → Access rules) to restrict by origin or IP - Monitor quota usage (Billing tab) - Upgrade plan if approaching limits ## Common gotchas - **API key leaked**: Immediately delete the key in console; create a new one. Old key becomes invalid. - **Node not responding**: Check node status (Pending → Running). Verify endpoint URL and auth credentials. Test with `curl` before integrating. - **Rate limit hit**: Chainstack doesn't impose hard limits, but requests exceeding 3,000 RPS may fail. Use batch requests or upgrade to Unlimited Node. - **WebSocket connection drops**: Implement auto-reconnect logic with exponential backoff. Chainstack may close idle connections after ~5 minutes. - **Archive node requests cost 2x**: Full node = 1 RU, archive = 2 RU. Verify node type before querying historical data. - **Endpoint auth in logs**: Never log full endpoint URLs with credentials. Mask or use environment variables. - **Wrong protocol/network**: Verify node protocol and network match your dApp. Ethereum mainnet node won't work for Solana queries. - **gRPC requires x-token in metadata**: Don't append token to URL like HTTP. Pass in request metadata headers. - **Project deletion requires node deletion first**: Delete all nodes before deleting project; otherwise deletion fails silently. - **Access rules only on Global Nodes**: Dedicated/Unlimited nodes don't support origin/IP filtering; use firewall rules instead. ## Verification checklist Before submitting work with Chainstack: - [ ] API key is stored in environment variable, not hardcoded - [ ] Node endpoint is correct (protocol, network, auth method match) - [ ] RPC method is supported by the node type (e.g., debug/trace methods need paid plans) - [ ] WebSocket subscriptions use WSS endpoint, not HTTPS - [ ] Error handling includes retry logic for transient failures - [ ] Access rules are configured if endpoint is public-facing - [ ] Billing quota is sufficient for expected request volume - [ ] Node status is "Running" before making requests - [ ] Test with curl or Postman before integrating into application - [ ] Credentials are not logged or exposed in error messages ## Resources - **Comprehensive navigation**: https://docs.chainstack.com/llms.txt (page-by-page listing for agent reference) - **Platform API reference**: https://docs.chainstack.com/reference/platform-api-getting-started - **Blockchain RPC methods**: https://docs.chainstack.com/reference/blockchain-apis (protocol-specific methods) - **Best practices**: https://docs.chainstack.com/docs/chainstack-web3-development-best-practices --- > For additional documentation and navigation, see: https://docs.chainstack.com/llms.txt