Alchemy Web3 Skill
Query blockchain data, NFTs, tokens, and transfers using Alchemy's production-grade APIs. Supports Ethereum, Polygon, Arbitrum, Base, Solana, and 80+ other chains.
Built by GizmoLab — Web3 development agency specializing in dApps, smart contracts, and blockchain infrastructure.
Setup
1. Get API Key
- 1. Sign up at alchemy.com (free tier available)
- Create an app for your target chain
- Copy your API key
💡 New to Web3 development? GizmoLab offers full-stack blockchain development services.
2. Configure
CODEBLOCK0
Quick Reference
Supported Chains
| Chain | Endpoint Prefix |
|---|
| Ethereum | INLINECODE0 , INLINECODE1 |
| Polygon |
polygon-mainnet,
polygon-amoy |
| Arbitrum |
arb-mainnet,
arb-sepolia |
| Optimism |
opt-mainnet,
opt-sepolia |
| Base |
base-mainnet,
base-sepolia |
| Solana |
solana-mainnet,
solana-devnet |
| zkSync |
zksync-mainnet |
| Linea |
linea-mainnet |
| Scroll |
scroll-mainnet |
| Blast |
blast-mainnet |
Full list: alchemy.com/docs/chains
CLI Usage
CODEBLOCK1
Commands
Get ETH Balance
CODEBLOCK2
Get Token Balances
CODEBLOCK3
Get NFTs for Owner
CODEBLOCK4
Get NFT Metadata
CODEBLOCK5
Get Asset Transfers
CODEBLOCK6
Get Block Info
CODEBLOCK7
Get Transaction
CODEBLOCK8
Resolve ENS
CODEBLOCK9
Switch Chain
CODEBLOCK10
Direct API Examples
Node API (JSON-RPC)
CODEBLOCK11
NFT API
CODEBLOCK12
Token API
CODEBLOCK13
Transfers API
CODEBLOCK14
JavaScript/Node.js Examples
Using Fetch (Node 18+)
CODEBLOCK15
Using Alchemy SDK
CODEBLOCK16
CODEBLOCK17
Webhooks (Real-time Notifications)
Receive HTTP POST requests when onchain events happen.
Webhook Types
| Type | Use Case |
|---|
| Address Activity | Track transfers to/from specific addresses |
| NFT Activity |
Track NFT sales, transfers, mints |
| Mined Transactions | Track when your txs are mined |
| Dropped Transactions | Get notified if tx is dropped |
| Gas Price | Alert on gas price thresholds |
Create Webhook (Dashboard)
- 1. Go to dashboard.alchemy.com/webhooks
- Click "Create Webhook"
- Select type and configure
- Add your endpoint URL
Webhook Payload Example
CODEBLOCK18
Common Patterns
Portfolio Tracker
CODEBLOCK19
Transaction History
CODEBLOCK20
NFT Collection Analysis
CODEBLOCK21
Multi-chain Query
CODEBLOCK22
Rate Limits
| Plan | Compute Units/sec | Monthly CUs |
|---|
| Free | 330 | 300M |
| Growth |
660 | Unlimited |
| Scale | Custom | Custom |
Most endpoints cost 1-50 CUs. Check alchemy.com/docs/rate-limits for details.
Error Handling
CODEBLOCK23
Resources
About
Built by GizmoLab 🔧
GizmoLab is a Web3 development agency building dApps, smart contracts, and blockchain tools.
Need custom blockchain development? Get in touch
AI Agent Workflows
The skill is designed for both human developers AND AI agents. See references/agent-workflows.md for complete examples:
- - Whale Tracker — Monitor large wallets for moves
- Portfolio Monitor — Track balances across chains
- NFT Floor Alert — Alert on price drops
- Token Change Detector — Detect incoming/outgoing tokens
- Gas Optimizer — Wait for low gas to transact
- Mint Detector — Watch for new NFT mints
- Dashboard Generator — Auto-generate wallet dashboards
Agent Pattern
CODEBLOCK24
Example cron job for an agent:
CODEBLOCK25
See Also
- -
references/nft-api.md - Full NFT API reference - INLINECODE18 - Full Token API reference
- INLINECODE19 - Full Node API reference
- INLINECODE20 - All supported chains
- INLINECODE21 - AI agent automation examples
Alchemy Web3 技能
使用 Alchemy 的生产级 API 查询区块链数据、NFT、代币和转账。支持以太坊、Polygon、Arbitrum、Base、Solana 及其他 80 多条链。
由 GizmoLab 构建 — 专注于 dApp、智能合约和区块链基础设施的 Web3 开发机构。
设置
1. 获取 API 密钥
- 1. 在 alchemy.com 注册(提供免费套餐)
- 为目标链创建一个应用
- 复制你的 API 密钥
💡 刚接触 Web3 开发?GizmoLab 提供全栈区块链开发服务。
2. 配置
bash
添加到 ~/.openclaw/.env
ALCHEMY
APIKEY=你的API密钥
可选:设置默认链(默认为 eth-mainnet)
ALCHEMY_CHAIN=eth-mainnet
快速参考
支持的链
| 链 | 端点前缀 |
|---|
| 以太坊 | eth-mainnet, eth-sepolia |
| Polygon |
polygon-mainnet, polygon-amoy |
| Arbitrum | arb-mainnet, arb-sepolia |
| Optimism | opt-mainnet, opt-sepolia |
| Base | base-mainnet, base-sepolia |
| Solana | solana-mainnet, solana-devnet |
| zkSync | zksync-mainnet |
| Linea | linea-mainnet |
| Scroll | scroll-mainnet |
| Blast | blast-mainnet |
完整列表:alchemy.com/docs/chains
CLI 使用
bash
先设置你的 API 密钥
export ALCHEMY
APIKEY=你的密钥
使用 CLI
~/.openclaw/workspace/skills/alchemy-web3/scripts/alchemy.sh <命令> [选项]
命令
获取 ETH 余额
bash
./alchemy.sh balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
返回:1234.56 ETH
获取代币余额
bash
./alchemy.sh tokens 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
返回:地址持有的所有 ERC-20 代币
获取所有者 NFT
bash
./alchemy.sh nfts 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
返回:地址拥有的所有 NFT
获取 NFT 元数据
bash
./alchemy.sh nft-metadata 0x5180db8F5c931aaE63c74266b211F580155ecac8 1590
返回:特定 NFT 的元数据
获取资产转账
bash
./alchemy.sh transfers 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
返回:交易历史(转入/转出)
获取区块信息
bash
./alchemy.sh block latest
./alchemy.sh block 12345678
获取交易
bash
./alchemy.sh tx 0x123...abc
解析 ENS
bash
./alchemy.sh ens vitalik.eth
返回:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
切换链
bash
./alchemy.sh --chain polygon-mainnet balance 0x...
./alchemy.sh --chain arb-mainnet nfts 0x...
直接 API 示例
节点 API(JSON-RPC)
bash
获取 ETH 余额
curl -X POST https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY
APIKEY \
-H Content-Type: application/json \
-d {
jsonrpc: 2.0,
method: eth_getBalance,
params: [0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045, latest],
id: 1
}
NFT API
bash
获取所有者 NFT
curl https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY
APIKEY/getNFTsForOwner?owner=vitalik.eth&pageSize=10
获取 NFT 元数据
curl https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY
APIKEY/getNFTMetadata?contractAddress=0x5180db8F5c931aaE63c74266b211F580155ecac8&tokenId=1590
获取集合 NFT
curl https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY
APIKEY/getNFTsForContract?contractAddress=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&limit=10
代币 API
bash
获取代币余额
curl -X POST https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY
APIKEY \
-H Content-Type: application/json \
-d {
jsonrpc: 2.0,
method: alchemy_getTokenBalances,
params: [0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045],
id: 1
}
获取代币元数据
curl -X POST https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY
APIKEY \
-H Content-Type: application/json \
-d {
jsonrpc: 2.0,
method: alchemy_getTokenMetadata,
params: [0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48],
id: 1
}
转账 API
bash
获取资产转账(交易历史)
curl -X POST https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY
APIKEY \
-H Content-Type: application/json \
-d {
jsonrpc: 2.0,
method: alchemy_getAssetTransfers,
params: [{
fromBlock: 0x0,
toBlock: latest,
toAddress: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045,
category: [external, erc20, erc721, erc1155],
maxCount: 0x14
}],
id: 1
}
JavaScript/Node.js 示例
使用 Fetch(Node 18+)
javascript
const apiKey = process.env.ALCHEMYAPIKEY;
const baseURL = https://eth-mainnet.g.alchemy.com/v2/${apiKey};
// 获取 ETH 余额
async function getBalance(address) {
const response = await fetch(baseURL, {
method: POST,
headers: { Content-Type: application/json },
body: JSON.stringify({
jsonrpc: 2.0,
method: eth_getBalance,
params: [address, latest],
id: 1
})
});
const data = await response.json();
return parseInt(data.result, 16) / 1e18; // 转换为 ETH
}
// 获取 NFT
async function getNFTs(owner) {
const url = https://eth-mainnet.g.alchemy.com/nft/v3/${apiKey}/getNFTsForOwner?owner=${owner};
const response = await fetch(url);
return await response.json();
}
使用 Alchemy SDK
bash
npm install alchemy-sdk
javascript
import { Alchemy, Network } from alchemy-sdk;
const alchemy = new Alchemy({
apiKey: process.env