5 go-ethererm包networkID和chainID的区别?

代码中看到描述如下

// NetworkID returns the network ID (also known as the chain ID) for this chain.
func (ec *Client) NetworkID(ctx context.Context) (*big.Int, error) {
   version := new(big.Int)
   var ver string
   if err := ec.c.CallContext(ctx, &ver, "net_version"); err != nil {
      return nil, err
   }
   if _, ok := version.SetString(ver, 10); !ok {
      return nil, fmt.Errorf("invalid net_version result %q", ver)
   }
   return version, nil
}

但实际上client.NetworkIDclient.ChainID拿到的返回值不一样,有没有大佬解释一下?

包版本v1.10.18

请先 登录 后评论

最佳答案 2022-06-15 11:14

https://learnblockchain.cn/article/1791 这篇文章基本解释了chainID和networkID的区别

请先 登录 后评论

其它 2 个回答

gil
请先 登录 后评论
gil
请先 登录 后评论