New answers tagged


As of version 0.5.12, Solidity includes an assembly function chainid() that provides access to the new CHAINID opcode: function getChainID() external view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } To use it, ensure you set the compiler's EVM version to Istanbul with the --evm-version istanbul flag. ...

Top 50 recent answers are included