Contract clock

An interface for exposing a contract's clock value and details
ReviewStandards Track: ERC
Created: 2023-01-25
Hadrien Croubois (@Amxx), Francisco Giordano (@frangio)
DiscussionsOriginal linkEdit
1 min read

ERC-6372 proposes the addition of a contract clock to the Ethereum blockchain. The contract clock would allow for the scheduling of contract executions at specific times or intervals, similar to a cron job in traditional computing. This would enable developers to create time-based smart contracts, such as recurring payments or time-based auctions, without the need for external services or manual intervention. The proposal includes details on the implementation of the contract clock, including the use of a timestamp oracle and the ability to cancel scheduled executions. The proposal is still in draft form as of January 2023.

Anyone may contribute to propose contents.
Go propose


Many contracts rely on some clock for enforcing delays and storing historical data. While some contracts rely on block numbers, others use timestamps. There is currently no easy way to discover which time-tracking function a contract internally uses. This EIP proposes to standardize an interface for contracts to expose their internal clock and thus improve composability and interoperability.


Many contracts check or store time-related information. For example, timelock contracts enforce a delay before an operation can be executed. Similarly, DAOs enforce a voting period during which stakeholders can approve or reject a proposal. Last but not least, voting tokens often store the history of voting power using timed snapshots.

Some contracts do time tracking using timestamps while others use block numbers. In some cases, more exotic functions might be used to track time.

There is currently no interface for an external observer to detect which clock a contract uses. This seriously limits interoperability and forces devs to make risky assumptions.


The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

Compliant contracts MUST implement the clock and CLOCK_MODE functions as specified below.

interface IERC6372 { function clock() external view returns (uint48); function CLOCK_MODE() external view returns (string); }



This function returns the current timepoint according to the mode the contract is operating on. It MUST be a non-decreasing function of the chain, such as block.timestamp or block.number.

- name: clock type: function stateMutability: view inputs: [] outputs: - name: timepoint type: uint48


This function returns a machine-readable string description of the clock the contract is operating on.

This string MUST be formatted like a URL query string (a.k.a. application/x-www-form-urlencoded), decodable in standard JavaScript with new URLSearchParams(CLOCK_MODE).

  • If operating using block number:
    • If the block number is that of the NUMBER opcode (0x43), then this function MUST return mode=blocknumber&from=default.
    • If it is any other block number, then this function MUST return mode=blocknumber&from=<CAIP-2-ID>, where <CAIP-2-ID> is a CAIP-2 Blockchain ID such as eip155:1.
  • If operating using timestamp, then this function MUST return mode=timestamp.
  • If operating using any other mode, then this function SHOULD return a unique identifier for the encoded mode field.
- name: CLOCK_MODE type: function stateMutability: view inputs: [] outputs: - name: descriptor type: string

Expected properties

  • The clock() function MUST be non-decreasing.


clock returns uint48 as it is largely sufficient for storing realistic values. In timestamp mode, uint48 will be enough until the year 8921556. Even in block number mode, with 10,000 blocks per second, it would be enough until the year 2861. Using a type smaller than uint256 allows storage packing of timepoints with other associated values, greatly reducing the cost of writing and reading from storage.

Depending on the evolution of the blockchain (particularly layer twos), using a smaller type, such as uint32 might cause issues fairly quickly. On the other hand, anything bigger than uint48 appears wasteful.

In addition to timestamps, it is sometimes necessary to define durations or delays, which are a difference between timestamps. In the general case, we would expect these values to be represented with the same type than timepoints (uint48). However, we believe that in most cases uint32 is a good alternative, as it represents over 136 years if the clock operates using seconds. In most cases, we recommend using uint48 for storing timepoints and using uint32 for storing durations. That recommendation applies to "reasonable" durations (delay for a timelock, voting or vesting duration, ...) when operating with timestamps or block numbers that are more than 1 second apart.

Security Considerations

No known security issues.

Copyright and related rights waived via CC0.

Further reading
Anyone may contribute to propose contents.
Go propose
Adopted by projects
Anyone may contribute to propose contents.
Go propose

Not miss a beat of EIPs' update?

Subscribe EIPs Fun to receive the latest updates of EIPs Good for Buidlers to follow up.

View all
Serve Ethereum Builders, Scale the Community.
Supported by