chainId property

int chainId

The chain ID for transaction. This is used as part of EIP-155 to prevent replay attacks on different networks.

For example, if a transaction was made on ropsten with an account also used on homestead, it would be possible for a transaction signed on ropsten to be executed on homestead, which is likely unintended.

There are situations where replay may be desired, however these are very rare and it is almost always recommended to specify the chain ID.

Implementation

external int get chainId;