What are Lamport timestamps, and why does Fantom use them?

Fantom Foundation
Fantom Foundation
Published in
3 min readJan 10, 2019

In Lachesis, Lamport timestamps are used to achieve the topographical ordering of events blocks in the Opera chain.

But what are they?

To understand the solution, it’s necessary to first understand the problem. In a distributed system, we need a way to ensure events (e.g., sending and receiving messages) are sequentially ordered, as nodes are not perfectly synchronized. The crux of the problem and the heart of the solution is knowing what happened before what (whether event A came before event B, ad infinitum).

This is the purpose of Lamport timestamps: a method to measure time and causality (i.e., identifying which event leads to which subsequent events) by ordering events, so that it’s possible to determine consensus time.

With Lamport timestamps, each process or message carries a timestamp. Individual timestamps can be compared to determine the order of events (whether one happened before the other and/or which events led to which subsequent events). This is called the happened-before relationship, which is the relationship between nodes that have event blocks.

Timestamps are generated sequentially; each is generated from the previous. In the case of a sent message, both the process and sent message timestamps result from the previous process timestamp. Conversely, for a received message, the new process timestamp is produced by the previous process timestamp and the inbound message’s timestamp.

Conceptually, Lamport timestamps represent a virtual clock. Through timestamps, the ordering of events is captured numerically. The sequence of events is determined by the size of the timestamps — new timestamps are bigger than previous timestamps. Timestamps are immutable, which is necessary for our Opera Chain, or for any distributed system. Timestamps provide numerical ordering to asynchronous data ledgers and allow the system to retain a record of that ordering in perpetuity.

In simple terms, we determine the order of events by examining whether event A has a greater numerical value than event B (If B is greater than A, then A preceded B). This means B is reachable from A by following messages. Each step in the path from A to B increases the timestamp by at least one, providing a numerically mapped sequence of events.

Within Fantom and the Opera Chain, timestamps are used to ensure fairness, and provide a sequential record of events that are immutable and verifiable. Lamport timestamps are a key pillar in Fantom’s consensus algorithm.

A technical overview of our Lamport timestamps implementation is provided in our technical paper, and the code is available on Github.

To find out more about the Fantom project and its technology, visit us here or join us on our social media channels.

Official E-mail Address: contact@fantom.foundation

Official Website: https://www.fantom.foundation

Official Telegram English Chat: https://t.me/fantom_english

Official Telegram Chinese Chat: https://t.me/fantom_chinese

Official Fantom Reddit: https://www.reddit.com/r/FantomFoundation/

Official Fantom Twitter: https://twitter.com/FantomFDN

Official Github Page: https://github.com/Fantom-foundation

Official Youtube Channel: https://www.youtube.com/c/fantomfoundation

--

--