alchemy-web3 by 0xgizmolab/alchemy-web3-skill
npx skills add https://github.com/0xgizmolab/alchemy-web3-skill --skill alchemy-web3使用 Alchemy 的生产级 API 查询区块链数据、NFT、代币和转账。支持以太坊、Polygon、Arbitrum、Base、Solana 以及 80 多个其他链。
由 GizmoLab 构建 — 专注于 dApp、智能合约和区块链基础设施的 Web3 开发机构。
💡 刚接触 Web3 开发?GizmoLab 提供全栈区块链开发服务。
# 添加到 ~/.openclaw/.env
ALCHEMY_API_KEY=your_api_key_here
# 可选:设置默认链(默认为 eth-mainnet)
ALCHEMY_CHAIN=eth-mainnet
| 链 | 端点前缀 |
|---|---|
| Ethereum | eth-mainnet, eth-sepolia |
| Polygon | polygon-mainnet, polygon-amoy |
| Arbitrum | arb-mainnet, arb-sepolia |
| Optimism | opt-mainnet, opt-sepolia |
# 首先设置您的 API 密钥
export ALCHEMY_API_KEY="your_key"
# 使用 CLI
~/.openclaw/workspace/skills/alchemy-web3/scripts/alchemy.sh <命令> [选项]
./alchemy.sh balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# 返回:1234.56 ETH
./alchemy.sh tokens 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# 返回:地址持有的所有 ERC-20 代币
./alchemy.sh nfts 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# 返回:地址拥有的所有 NFT
./alchemy.sh nft-metadata 0x5180db8F5c931aaE63c74266b211F580155ecac8 1590
# 返回:特定 NFT 的元数据
./alchemy.sh transfers 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# 返回:交易历史记录(转入/转出)
./alchemy.sh block latest
./alchemy.sh block 12345678
./alchemy.sh tx 0x123...abc
./alchemy.sh ens vitalik.eth
# 返回:0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
./alchemy.sh --chain polygon-mainnet balance 0x...
./alchemy.sh --chain arb-mainnet nfts 0x...
# 获取 ETH 余额
curl -X POST "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "latest"],
"id": 1
}'
# 获取所有者持有的 NFT
curl "https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY_API_KEY/getNFTsForOwner?owner=vitalik.eth&pageSize=10"
# 获取 NFT 元数据
curl "https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY_API_KEY/getNFTMetadata?contractAddress=0x5180db8F5c931aaE63c74266b211F580155ecac8&tokenId=1590"
# 获取集合中的 NFT
curl "https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY_API_KEY/getNFTsForContract?contractAddress=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&limit=10"
# 获取代币余额
curl -X POST "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-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_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "alchemy_getTokenMetadata",
"params": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"],
"id": 1
}'
# 获取资产转账记录(交易历史)
curl -X POST "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-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
}'
const apiKey = process.env.ALCHEMY_API_KEY;
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();
}
npm install alchemy-sdk
import { Alchemy, Network } from 'alchemy-sdk';
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET
});
// 获取 NFT
const nfts = await alchemy.nft.getNftsForOwner('vitalik.eth');
console.log(nfts.ownedNfts);
// 获取代币余额
const balances = await alchemy.core.getTokenBalances('vitalik.eth');
console.log(balances);
// 获取交易历史
const transfers = await alchemy.core.getAssetTransfers({
toAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
category: ['external', 'erc20']
});
当链上事件发生时接收 HTTP POST 请求。
| 类型 | 使用场景 |
|---|---|
| 地址活动 | 跟踪特定地址的转入/转出 |
| NFT 活动 | 跟踪 NFT 销售、转账、铸造 |
| 已挖出交易 | 跟踪您的交易何时被挖出 |
| 已丢弃交易 | 如果交易被丢弃则收到通知 |
| Gas 价格 | 在 Gas 价格达到阈值时提醒 |
{
"webhookId": "wh_abc123",
"id": "evt_xyz789",
"createdAt": "2024-01-15T12:00:00.000Z",
"type": "ADDRESS_ACTIVITY",
"event": {
"network": "ETH_MAINNET",
"activity": [{
"fromAddress": "0x123...",
"toAddress": "0x456...",
"value": 1.5,
"asset": "ETH"
}]
}
}
# 获取钱包的所有资产
./alchemy.sh balance 0x... # ETH 余额
./alchemy.sh tokens 0x... # ERC-20 代币
./alchemy.sh nfts 0x... # NFT
# 获取地址的完整交易历史
./alchemy.sh transfers 0x... --category external,erc20,erc721
# 获取集合中的所有 NFT
./alchemy.sh collection 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
# 跨链检查同一地址
for chain in eth-mainnet polygon-mainnet arb-mainnet base-mainnet; do
echo "=== $chain ==="
./alchemy.sh --chain $chain balance 0x...
done
| 套餐 | 计算单元/秒 | 月度计算单元 |
|---|---|---|
| 免费 | 330 | 300M |
| 增长 | 660 | 无限制 |
| 规模 | 自定义 | 自定义 |
大多数端点消耗 1-50 个计算单元。详情请查看 alchemy.com/docs/rate-limits。
// 超出速率限制
{"error": {"code": 429, "message": "Too Many Requests"}}
// 无效的 API 密钥
{"error": {"code": 401, "message": "Invalid API Key"}}
// 无效的参数
{"error": {"code": -32602, "message": "Invalid params"}}
由 GizmoLab 构建 🔧
GizmoLab 是一家 Web3 开发机构,致力于构建 dApp、智能合约和区块链工具。
需要定制区块链开发?联系我们
此技能专为人类开发者和 AI 智能体设计。完整示例请参见 references/agent-workflows.md:
查询 → 存储 → 分析 → 决策 → 行动 → 重复
智能体的示例定时任务:
# 每小时检查一次巨鲸活动,如果移动超过 100 ETH 则发出警报
0 * * * * ~/.openclaw/workspace/skills/alchemy-web3/scripts/whale-tracker.sh
references/nft-api.md - 完整的 NFT API 参考references/token-api.md - 完整的 Token API 参考references/node-api.md - 完整的 Node API 参考references/chains.md - 所有支持的链references/agent-workflows.md - AI 智能体自动化示例每周安装量
11
仓库
首次出现
2026年2月15日
安全审计
Gen Agent Trust HubFailSocketPassSnykWarn
安装于
cursor11
opencode11
gemini-cli9
amp9
claude-code9
github-copilot9
Query blockchain data, NFTs, tokens, and transfers using Alchemy's production-grade APIs. Supports Ethereum, Polygon, Arbitrum, Base, Solana, and 80+ other chains.
Built byGizmoLab — Web3 development agency specializing in dApps, smart contracts, and blockchain infrastructure.
💡 New to Web3 development? GizmoLab offers full-stack blockchain development services.
# Add to ~/.openclaw/.env
ALCHEMY_API_KEY=your_api_key_here
# Optional: Set default chain (defaults to eth-mainnet)
ALCHEMY_CHAIN=eth-mainnet
| Chain | Endpoint Prefix |
|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| Base | base-mainnet, base-sepolia |
| Solana | solana-mainnet, solana-devnet |
| zkSync | zksync-mainnet |
| Linea | linea-mainnet |
| Scroll | scroll-mainnet |
| Blast | blast-mainnet |
| Ethereum | 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 |
Full list: alchemy.com/docs/chains
# Set your API key first
export ALCHEMY_API_KEY="your_key"
# Use the CLI
~/.openclaw/workspace/skills/alchemy-web3/scripts/alchemy.sh <command> [options]
./alchemy.sh balance 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# Returns: 1234.56 ETH
./alchemy.sh tokens 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# Returns: All ERC-20 tokens held by address
./alchemy.sh nfts 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# Returns: All NFTs owned by address
./alchemy.sh nft-metadata 0x5180db8F5c931aaE63c74266b211F580155ecac8 1590
# Returns: Metadata for specific NFT
./alchemy.sh transfers 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
# Returns: Transaction history (in/out)
./alchemy.sh block latest
./alchemy.sh block 12345678
./alchemy.sh tx 0x123...abc
./alchemy.sh ens vitalik.eth
# Returns: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
./alchemy.sh --chain polygon-mainnet balance 0x...
./alchemy.sh --chain arb-mainnet nfts 0x...
# Get ETH balance
curl -X POST "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "latest"],
"id": 1
}'
# Get NFTs for owner
curl "https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY_API_KEY/getNFTsForOwner?owner=vitalik.eth&pageSize=10"
# Get NFT metadata
curl "https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY_API_KEY/getNFTMetadata?contractAddress=0x5180db8F5c931aaE63c74266b211F580155ecac8&tokenId=1590"
# Get NFTs for collection
curl "https://eth-mainnet.g.alchemy.com/nft/v3/$ALCHEMY_API_KEY/getNFTsForContract?contractAddress=0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D&limit=10"
# Get token balances
curl -X POST "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "alchemy_getTokenBalances",
"params": ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"],
"id": 1
}'
# Get token metadata
curl -X POST "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "alchemy_getTokenMetadata",
"params": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"],
"id": 1
}'
# Get asset transfers (transaction history)
curl -X POST "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-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
}'
const apiKey = process.env.ALCHEMY_API_KEY;
const baseURL = `https://eth-mainnet.g.alchemy.com/v2/${apiKey}`;
// Get ETH Balance
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; // Convert to ETH
}
// Get NFTs
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();
}
npm install alchemy-sdk
import { Alchemy, Network } from 'alchemy-sdk';
const alchemy = new Alchemy({
apiKey: process.env.ALCHEMY_API_KEY,
network: Network.ETH_MAINNET
});
// Get NFTs
const nfts = await alchemy.nft.getNftsForOwner('vitalik.eth');
console.log(nfts.ownedNfts);
// Get token balances
const balances = await alchemy.core.getTokenBalances('vitalik.eth');
console.log(balances);
// Get transaction history
const transfers = await alchemy.core.getAssetTransfers({
toAddress: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
category: ['external', 'erc20']
});
Receive HTTP POST requests when onchain events happen.
| 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 |
{
"webhookId": "wh_abc123",
"id": "evt_xyz789",
"createdAt": "2024-01-15T12:00:00.000Z",
"type": "ADDRESS_ACTIVITY",
"event": {
"network": "ETH_MAINNET",
"activity": [{
"fromAddress": "0x123...",
"toAddress": "0x456...",
"value": 1.5,
"asset": "ETH"
}]
}
}
# Get all assets for a wallet
./alchemy.sh balance 0x... # ETH balance
./alchemy.sh tokens 0x... # ERC-20 tokens
./alchemy.sh nfts 0x... # NFTs
# Get full tx history for address
./alchemy.sh transfers 0x... --category external,erc20,erc721
# Get all NFTs in a collection
./alchemy.sh collection 0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D
# Check same address across chains
for chain in eth-mainnet polygon-mainnet arb-mainnet base-mainnet; do
echo "=== $chain ==="
./alchemy.sh --chain $chain balance 0x...
done
| 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.
// Rate limited
{"error": {"code": 429, "message": "Too Many Requests"}}
// Invalid API key
{"error": {"code": 401, "message": "Invalid API Key"}}
// Invalid params
{"error": {"code": -32602, "message": "Invalid params"}}
Built byGizmoLab 🔧
GizmoLab is a Web3 development agency building dApps, smart contracts, and blockchain tools.
Need custom blockchain development? Get in touch
The skill is designed for both human developers AND AI agents. See references/agent-workflows.md for complete examples:
QUERY → STORE → ANALYZE → DECIDE → ACT → REPEAT
Example cron job for an agent:
# Every hour, check whale activity and alert if >100 ETH moved
0 * * * * ~/.openclaw/workspace/skills/alchemy-web3/scripts/whale-tracker.sh
references/nft-api.md - Full NFT API referencereferences/token-api.md - Full Token API referencereferences/node-api.md - Full Node API referencereferences/chains.md - All supported chainsreferences/agent-workflows.md - AI agent automation examplesWeekly Installs
11
Repository
First Seen
Feb 15, 2026
Security Audits
Installed on
cursor11
opencode11
gemini-cli9
amp9
claude-code9
github-copilot9
React Router 框架模式指南:全栈开发、文件路由、数据加载与渲染策略
1,200 周安装