Reconciling timestamps in Quorum-Raft

One tricky aspect to timestamps using the now variable in Ethereum is the use of different units, depending on environment type. Unlike vanilla Ethereum implementations, timestamps in an environment with a Quorum client and Raft consensus (Quorum-Raft) are represented in nanoseconds because the Raft consensus can produce more than one block per second. Contrastingly, Quorum-IBFTand Geth-PoA (Proof-of-Authority) environments use timestamps whose units are denoted in seconds. In all three environment types, the now keyword provides the timestamp of the most recent block in UNIX Epoch time format (time since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970).

NOTE: The difference in timestamp units can be the root-cause of out-of-gas errors if you transport the same timestamp-dependent require statements from smart contract code in one environment type to another.

Smart Contract Example

Here is a simple smart contract that returns the timestamp of the latest block via the keyword now.