Avalanche 区块链技能:C-Chain、子网与跨链桥 - Openclaw Skills

作者:互联网

2026-03-27

AI教程

什么是 Avalanche 技能?

Avalanche 技能赋予 AI 智能体导航 Avalanche 网络复杂三链架构的能力。通过将此技能集成到 Openclaw Skills 中,开发者可以自动执行 X-Chain(转账)、P-Chain(质押)和兼容 EVM 的 C-Chain 之间的交互。它为 Gas 管理、网络架构和跨链资产移动提供关键技术背景,确保智能体能以高精度和快速确认执行 DeFi 操作或子网管理。

下载入口:https://github.com/openclaw/skills/tree/main/skills/ivangdavila/avalanche

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install avalanche

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 avalanche。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Avalanche 技能 应用场景

  • 使用兼容 EVM 的工具在 C-Chain 上执行智能合约交易和 DeFi 交易。
  • 编排 X、P 和 C 链之间的跨链转账以进行资产管理。
  • 使用官方桥将以太坊等外部网络的资产桥接到 Avalanche。
  • 部署并监控使用自定义 Gas 代币的特定应用子网。
  • 管理 AVAX 质押委托以及 sAVAX 或 ggAVAX 等流动性质押头寸。
Avalanche 技能 工作原理
  1. AI 智能体根据用户的具体交易意图识别所需的链(C、X 或 P)。
  2. 通过主 C-Chain RPC 端点建立连接,用于标准智能合约操作。
  3. 该技能验证 Gas 需求,确保工作流涉及的具体链上有足够的 AVAX。
  4. 交易执行具有亚 2 秒的最终性,随后通过 snowtrace.io 等区块浏览器进行自动验证。

Avalanche 技能 配置指南

要将此功能集成到您的工作流中,请使用以下网络参数配置您的 Openclaw Skills 提供程序:

# Avalanche C-Chain 集成的网络配置
NETWORK_NAME="Avalanche C-Chain"
CHAIN_ID=43114
RPC_URL="https://api.avax.network/ext/bc/C/rpc"
EXPLORER_URL="https://snowtrace.io"

请确保您的智能体可以访问支持多链架构的钱包,以便进行跨链资产导出。

Avalanche 技能 数据架构与分类体系

网络组件 规格
C-Chain ID 43114
RPC 端点 https://api.avax.network/ext/bc/C/rpc
X-Chain 地址格式 以 "X-" 开头
原生 Gas 代币 AVAX
官方桥 bridge.avax.network

该技能通过将 EVM 交易日志与跨链导出/导入元数据分离来构建数据,以实现精确跟踪。

name: Avalanche
description: Assist with Avalanche C-Chain transactions, AVAX transfers, subnets, and cross-chain bridges.
metadata: {"clawdbot":{"emoji":"??","os":["linux","darwin","win32"]}}

Network Architecture (Critical)

  • Avalanche has three chains: X-Chain, P-Chain, C-Chain — each serves different purpose
  • C-Chain is EVM compatible — where most DeFi and tokens live, uses AVAX for gas
  • X-Chain for fast transfers — native AVAX transfers, not EVM compatible
  • P-Chain for staking — validators and subnet management
  • Same AVAX token across all chains — but must transfer between chains to use

C-Chain (Most Common)

  • EVM compatible — MetaMask, same tools as Ethereum
  • Uses AVAX for gas — need AVAX to transact
  • Chain ID: 43114 — RPC: https://api.avax.network/ext/bc/C/rpc
  • Block explorer: snowtrace.io — transaction verification
  • Most tokens and DeFi here — Trader Joe, Aave, GMX

Cross-Chain Transfers

  • Moving AVAX between chains uses Avalanche Wallet — not regular transfers
  • C-Chain ? X-Chain transfer takes seconds — but requires correct process
  • Export from one chain, import to another — two-step process
  • Use official Core wallet or Avalanche Wallet — supports all three chains
  • MetaMask only sees C-Chain — can't transfer to X or P chains directly

Bridging from Other Networks

  • Avalanche Bridge official — bridge.avax.network, from Ethereum
  • Bridged tokens are wrapped — ETH becomes WETH.e on Avalanche
  • LayerZero, Stargate for multi-chain — faster alternatives with fees
  • Bridge fees plus gas on both chains — budget for both
  • Withdrawal to Ethereum can take time — depends on bridge used

Gas and Fees

  • Gas model same as Ethereum post-EIP-1559 — base fee + priority fee
  • Cheaper than Ethereum, more than some L2s — typically $0.01-0.10 per transaction
  • Gas paid in AVAX only — no token payments for gas
  • Fast finality (under 2 seconds) — no waiting for confirmations
  • Failed transactions cost gas — same as Ethereum

Tokens and DeFi

  • AVAX is native gas token — also tradeable like ETH
  • WAVAX is wrapped AVAX — needed for some DeFi protocols
  • Major DEXs: Trader Joe, Pangolin — similar to Uniswap
  • Lending: Aave, Benqi — borrow and lend
  • Verify token addresses — scam tokens exist, check snowtrace.io

Subnets

  • Subnets are custom blockchains on Avalanche — like app-specific chains
  • DFK Chain (DeFi Kingdoms), Dexalot — examples of subnets
  • Each subnet can have own token for gas — not always AVAX
  • Bridging to subnets through official bridges — subnet-specific
  • Subnets have independent validators — different security assumptions

Staking

  • Minimum 25 AVAX to delegate — stake with validators
  • Minimum 2 weeks lock — staking period required
  • Rewards vary by validator — check uptime and commission
  • No slashing — underperforming validators just earn less
  • Liquid staking: sAVAX, ggAVAX — maintain liquidity while staking

Wallet Options

  • Core Wallet (official) — supports all three chains, subnets
  • MetaMask for C-Chain only — familiar interface, limited to C-Chain
  • Ledger supported — via Core or MetaMask
  • Mobile wallets available — Core has mobile app

Common Issues

  • "Insufficient funds" — need AVAX for gas on C-Chain
  • Tokens on wrong chain — bridged to X-Chain instead of C-Chain
  • Can't find tokens — wrong chain or need to add custom token
  • Slow bridge — some bridges take 10-30 minutes, be patient
  • Subnet tokens not showing — need to add subnet network to wallet

Security

  • Standard EVM security on C-Chain — same best practices as Ethereum
  • Private key controls all three chains — one seed, all chains
  • Verify addresses on all chains — X-Chain addresses start with "X-"
  • Revoke unused approvals — snowtrace.io token approval checker
  • Official bridges safest — third-party bridges add risk