Skip to content

VIP: Add support for Chain ID Opcode #1652

@fubuloubu

Description

@fubuloubu

Simple Summary

Add support for the chain ID opcode through a new environment variable

Motivation

Being able to know what chain a contract is located on is valuable for many different kinds of signature verification operations because it is often used as a domain separator for message signing. Creating an environment variable that queries this value means there will be no human error involved in maintaining this value within contracts, so that contracts developed on testnets don't allow replay attacks when they are deployed on the mainnet.

Specification

The feature is described in full via EIP-1344. In vyper, this should appear as the chain.id env var, as it is derived from the chain context of the Ethereum client that executes this call (through it's Genesis config). It should have a type of uint256 and a gas cost of G_base.

Backwards Compatibility

No backwards incompatibilities

Dependencies

No dependencies

Copyright

Copyright and related rights waived via CC0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Easy PickingsUsed to denote issues that should be easy to implementVIP: ApprovedVIP Approved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions