Polygon: PoS 和 zkEVM 交易管理 - Openclaw Skills

作者:互联网

2026-03-29

AI教程

什么是 Polygon?

此技能为 AI 代理与 Polygon 生态系统的交互提供了一个全面的框架。它解决了 Polygon PoS 与 zkEVM Rollup 之间的关键区别,确保代理不会因网络混淆而损失资金。通过在 Openclaw Skills 中使用此技能,用户可以获取有关 MATIC 到 POL 品牌重塑、Gas 代币要求以及各种跨链桥协议特定安全模型的技术知识。

该技能充当了技术保障,提供必要的 RPC 配置、链 ID(Chain ID)和交易生命周期步骤。它简化了以太坊兼容侧链和 Rollup 的复杂性,使其成为任何在 Openclaw Skills 上构建去中心化金融或 NFT 管理应用的开发者的必备组件。

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

安装与下载

1. ClawHub CLI

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

npx clawhub@latest install polygon

2. 手动安装

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

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

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

3. 提示词安装

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

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

Polygon 应用场景

  • 区分 Polygon PoS(使用 MATIC 作为 Gas)和 Polygon zkEVM(使用 ETH 作为 Gas),防止交易失败。
  • 使用官方桥进行安全的资产转移,或选择第三方桥以实现更快的提现。
  • 管理从 MATIC 代币到新 POL 标准的迁移过程。
  • 在 NFT 铸造或热门 DeFi 项目上线等高流量期间优化 Gas 策略。
  • 使用经过验证的 RPC 数据,为 MetaMask 和其他 Web3 提供商自动化钱包配置。
Polygon 工作原理
  1. 代理识别请求操作所需的特定 Polygon 子网络(PoS 或 zkEVM)。
  2. 在发起交易前验证是否存在正确的原生 Gas 代币(PoS 为 MATIC,zkEVM 为跨链 ETH)。
  3. 对于跨链移动,该技能会确定最佳桥接路径,并考虑到官方检查点 7 天的提现期。
  4. 交易参数根据 EIP-1559 模型进行格式化,确保包含适当的优先费用以被打包。
  5. 执行后,该技能利用 Polygonscan 等区块浏览器监控交易最终性和合约交互。

Polygon 配置指南

要将此功能集成到您的代理环境中,请按照以下步骤配置您的工作空间:

# 在 Openclaw Skills 中初始化 Polygon 环境
openclaw add polygon-network

# 配置 Polygon PoS 的默认 RPC
export POLYGON_RPC_URL="https://polygon-rpc.com"

# 设置 zkEVM 操作的链 ID
export ZKEVM_CHAIN_ID=1101

Polygon 数据架构与分类体系

该技能组织网络和代币元数据,以确保所有操作的精确性:

属性 Polygon PoS 详情 Polygon zkEVM 详情
链 ID 137 1101
Gas 代币 MATIC(更名为 POL) ETH
跨链逻辑 Plasma / PoS 桥 ZK-Rollup 桥
提现时间 ~3 小时至 7 天 分钟至小时(取决于 ZK 证明)
区块浏览器 polygonscan.com zkevm.polygonscan.com
name: Polygon
description: Assist with Polygon PoS and zkEVM transactions, bridging, gas tokens, and ecosystem navigation.
metadata: {"clawdbot":{"emoji":"??","os":["linux","darwin","win32"]}}

Network Confusion (Critical)

  • Polygon PoS is the main chain — EVM compatible, uses MATIC for gas
  • Polygon zkEVM is separate — different RPC, same MATIC token but bridged separately
  • MATIC is rebranding to POL — transition in progress, wallets will update
  • Polygon Mainnet ≠ Ethereum Mainnet — same address format, different networks
  • Sending to wrong network loses funds — always verify network before sending

MATIC/POL Token

  • MATIC used for gas on Polygon PoS — required for all transactions
  • MATIC exists on Ethereum as ERC-20 — must bridge to use on Polygon
  • POL replacing MATIC — same value, automatic migration for most users
  • Native MATIC on Polygon vs ERC-20 MATIC on Ethereum — different networks

Bridging

  • Official Polygon Bridge: bridge.polygon.technology — safe but slow (30+ minutes to Polygon, 7 days back)
  • Withdrawals to Ethereum take 7 days — checkpoint mechanism for security
  • Third-party bridges faster but have smart contract risk — Hop, Across, Stargate
  • Bridge MATIC before bridging tokens — need gas on destination chain
  • Always have MATIC for gas after bridging — tokens without gas are stuck

Gas and Fees

  • Gas prices in gwei like Ethereum — but much cheaper (typically 30-100 gwei)
  • Transactions cost fractions of a cent — major advantage over Ethereum
  • Gas spikes during high activity — NFT mints, popular drops
  • Failed transactions still cost gas — same as Ethereum behavior
  • Priority fee for faster inclusion — same EIP-1559 model

Tokens and DeFi

  • Same token standards as Ethereum — ERC-20, ERC-721, ERC-1155 all work
  • Many Ethereum tokens have Polygon versions — verify contract addresses
  • Wrapped tokens need unwrapping — bridged ETH is not native ETH
  • QuickSwap, Uniswap, Aave all on Polygon — same interfaces as Ethereum
  • Lower liquidity than Ethereum mainnet — higher slippage on large trades

Wallet Setup

  • MetaMask supports Polygon natively — add network from chainlist.org
  • Chain ID: 137 — RPC: https://polygon-rpc.com
  • Block explorer: polygonscan.com — verify transactions and contracts
  • Same address as Ethereum — but balances are network-specific

Common Issues

  • "Insufficient MATIC for gas" — need MATIC, not just tokens
  • Transaction stuck pending — gas price too low, speed up or wait
  • Tokens not showing in wallet — add custom token with contract address
  • Bridge transaction pending — checkpoints take time, don't panic
  • "Network not supported" — dApp may not support Polygon, check docs

zkEVM Specifics

  • Separate network from PoS — different RPC and chain ID (1101)
  • Uses ETH for gas, not MATIC — bridge ETH from Ethereum
  • Faster finality than optimistic rollups — ZK proofs instead of fraud proofs
  • Some opcodes behave differently — minor contract compatibility issues
  • Growing ecosystem — fewer dApps than PoS currently

Staking

  • MATIC staking on Ethereum mainnet — validators secure both networks
  • Delegate to validators — no minimum, rewards vary by validator
  • Unbonding takes 80 checkpoints (~3-4 days) — funds locked during unbonding
  • Liquid staking available — stMATIC, MaticX for liquidity while staking

Security

  • Same security model as Ethereum — private key controls all
  • Approve tokens carefully — revoke unused approvals at polygonscan.com
  • Verify contract addresses — scam tokens use similar names
  • Official bridge is safest — third-party bridges have additional risk
  • Keep some MATIC for emergencies — stuck tokens without gas is common

相关推荐