2

在solidity7.0以上版本中怎样获取链的id

 2 years ago
source link: https://learnblockchain.cn/question/2102
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

在solidity7.0以上版本中怎样获取链的id

6.0版本的可以获取,7.0以上的怎么获取

最佳答案 34分钟前

0.8 及版本以上使用: block.chainid

0.8以下:

uint chainId;
        assembly {
            chainId := chainid()
        }
Tiny熊 - 布道者
擅长:智能合约,以太坊 | 采纳率 41% | 回答于 34分钟前

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK