1

Smart contracts in Ethereum must be deterministic so that nodes can achieve consensus.

There are implementations of smart contract based auctions where there is a fixed auction time.

But how do nodes achieve consensus when there is no shared clock, if the block is mined near the end of an auction: some nodes may process the block before the end of the auction, and others after the end of the auction?

1

There is an approximate consensus on shared time: Each block includes a timestamp, a block cannot be timestamped earlier than an earlier block it builds on, and miners will reject a block timestamped too far in the future.

A transaction is mined only in a single block (plus orphaned blocks, which are ignored for most practical purposes) so when a transaction reads a timestamp as part of its execution the network will form a consensus around the result of the transaction as executed using the time as stated in that block.

The upshot is that the auction contract can specify a time to close and be reasonably confident that if somebody sends a transaction to close it it will close at about the right time. Just how precise this can be depends on your assumptions about how much of the network will conspire against you to lie about what time it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.