Nonce-Order Enforcement

Bryan Pellegrino
LayerZero Official
Published in
4 min readSep 27, 2023

One of the most underlooked and critically important features within LayerZero is nonce-order enforcement. What this means is that every packet must be delivered sequentially, in exactly the order it was committed on source chain.

So why does this matter? To explore, let’s look at the negative repercussions of a messaging protocol with no fair ordering.

Scenario: The small (fictional) European country of Maltovania has moved its election voting on-chain such that its users can vote from multiple blockchains and the votes will be aggregated and counted on Arbitrum. When the smart contract expires at midnight on the 7th day the votes will be locked and the election is decided and the country (or DAO) has agreed to abide by the results of the smart contract who will issue a 4-year soulbound NFT to its new president.

As the votes tally in the election is extremely close, with the incumbent party at 49.7% of population vote and the challenging party at 49.6% of population vote. In a backroom deal the incumbent party bribes the existing validators to conveniently forget to deliver a few packets containing votes for the challenging party. Since there is nothing to prevent this, the vote concludes at midnight with the incumbent party remaining in power and is only discovered later that packets were dropped and chalked up to technical error that exists within the system.

Scenario: One of the largest incumbent HFT firms in traditional finance has found it harder and harder to compete. They used to make up almost 25% of the $10B+ annual profit that the HFT industry captures every year by being the fastest to frontrun retail and institutional order-flow to each other exchange as orders are being executed. It was about this time that they were really beginning to feel the effects of that increasingly competitive HFT landscape that they discovered the world of decentralized finance and blockchains.

As they were exploring this world they set to designing a system such that they would always have a monopoly over the industry of frontrunning and value extraction over all transaction execution. At first they came to the obvious conclusion, if we simply own the flow of messaging we can always insert ourselves first and frontrun each transaction upon submission without the need for any other competitive party to exist.

‘As long we can convince others to use our messaging protocol they thought, we will always have complete rights to all extractable value. What they didn’t realize until later is that this was just the tip of the iceberg, eventually they realized that without any sort of enforced ordering they could not only frontrun each individual message, but they could re-order the messages as well! By omitting forced ordering they now were able to hold back and delay specific transactions and re-order the entire in-flight psuedo mempool such that rather than extracting simply the maximum from each individual message they could extract the maximum across the entire surface of in-flight messages. Creating an entirely new segment of extractable value that didn’t exist before (and thus an additional tax on each end consumer).

LayerZero’s messaging guarantees that each and every packet will be delivered in the exact order it was received. This means that messages can never be re-ordered

And completely removes the ability to censor individual packets, where any attempt to drop a single packet would halt the entire pathway

When designing our system the core principle of Censorship Resistance underpinned every technical decision made. We knew we were building a system that needed to be able to be used at scale across use cases as diverse as running governmental elections to underlying the infrastructure of the entire financial system and in doing so if you build a system that can be exploited it will be exploited.

LayerZero’s messaging is immutable, censorship resistant, and entirely permissionless.

Come unlock immutable messaging within your application today https://layerzero.gitbook.io/docs/

--

--