Solidity REPL
Context & forks

Chain ID condition

Try logic that changes based on the selected chain ID.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern when the answer depends on transaction fields, block data, chain identity, payable value, or live RPC state. The entry isolates chain id condition so its input, result, and state changes stay easy to compare.

Solidity to run

bool isMainnet = block.chainid == 1
block.chainid
isMainnet

What to expect

With chain ID 1 selected, block.chainid returns 1 and the mainnet condition evaluates to true.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about execution controls Deployed contract investigation