概述
Polygon(原 Matic)是以太坊的 Layer 2 扩容解决方案,提供更快的交易速度和更低的 Gas 费用。Polygon 生态包括 PoS 链、zkEVM、Miden 等多种扩容方案,是目前使用最广泛的以太坊 L2 之一。
EVM 兼容低 GaszkEVMPoS 链
Go 开发教程
连接 Polygon 网络
Polygon 完全兼容 EVM,使用相同的 go-ethereum 库即可连接。
go
1package main2 3import (4 "context"5 "fmt"6 "log"7 8 "github.com/ethereum/go-ethereum/ethclient"9)10 11func main() {12 // Polygon 主网 RPC13 client, err := ethclient.Dial("https://polygon-rpc.com")14 if err != nil {15 log.Fatal(err)16 }17 18 chainID, err := client.ChainID(context.Background())19 if err != nil {20 log.Fatal(err)21 }22 fmt.Println("Chain ID:", chainID) // 137 for Polygon mainnet23}探索更多区块链生态
查看所有链