How does Xiaobai understand the bitcoin network improvement protocol Erlay?

Foreword: Previously, the translator translated and introduced the bitcoin network improvement protocol Erlay proposed by Pieter Wuille and Gregory Maxwell, but it is difficult to understand because the article is aimed at technical readers. In response, Sam Wouters has written a more easy-to-understand science article to make more people aware of the positive impact of this improvement proposal on Bitcoin.

The following is a translation:

I wrote this non-technical explanation because I believe that Erlay will be one of Bitcoin's most important performance improvements.

Erlay will help the Bitcoin network remain decentralized by reducing unnecessary communication between network participants.


A guess about how Erlay will affect Bitcoin

Thanks to Gleb Naumenko, Pieter Wuille, Gregory Maxwell, Sasha Fedorova and Ivan Beschatnikh for this amazing improvement.

Regarding this technical solution, I first saw it on the Bitcoin Optech Newsletter (#49) (strongly recommended). Special thanks to the author for being able to access this technology to technical readers, and I hope that more people will understand it through this article.

Today, how does Bitcoin broadcast a transaction?

The person below is Bob.


Bob wants to send a bitcoin transaction (we don't think about his purpose, you can guess it yourself).

He obviously wants his trade to be included in the blockchain as soon as possible. To achieve this, it would be helpful if many participants in the Bitcoin network knew that Bob's wallet broadcasted his transaction. This will increase the chance that his trade will be included in the next created trading block (on average every 10 minutes).

Since Bob is interested in doing something, he doesn't have his own bitcoin node. Instead, he believes that Alice's node will broadcast the transactions received from his wallet.


Bob knows that Alice can't steal his money when using her node.

Alice's node first checks Bob's transaction to see if his wallet has signed the transaction.


Of course, Alice's node will also check if Bob has spent his bitcoin before, which is done by looking at the record of Bob's currently unused transactions (called UTXO). .

Explanation of "What is UTXO"


A bitcoin transaction has both an input (your bitcoin at the address you control) and an output (receiving address).

Each transaction output can be reversed as an input to the next transaction.

To ensure that you don't spend the same bitcoin twice, the node can check the history of hundreds of millions of transactions on the network to determine if the same transaction input was used before.

As you can imagine, the amount of work on a node is huge, and to be more efficient, the node will iterate through the entire history once to create a list of all transaction outputs that have not yet been used as transaction inputs.

This is called unspent transaction output, referred to as UTXO.

Today, there are approximately 56 million UTXOs in the Bitcoin network, occupying approximately 3GB of storage. On the other hand, the entire Bitcoin blockchain is approximately 220GB, containing more than 422 million transactions.

Each time a transaction is sent, the node deletes the old UTXO that has been spent and adds a new UTXO to keep the list up to date.

After checking all the content, Alice's node will tell Bob's trading information about the 8 nodes it is connected to.


Bob may blindly trust Alice's nodes, but its peers are not. They will perform the same checks on the Alice (Alice) node as they do with Bob.

As you can imagine, many nodes will learn about Bob's transactions multiple times after that because they all connect in different ways and don't know who receives the information.


Obviously, the message sent is much more than the information needed, although this gives Bitcoin users a high degree of confidence that all nodes in the world will know their transactions. But this brings unnecessary and heavy burden to the node.


These nodes send and receive more data than needed. To be precise, research shows that 44% of traffic between nodes is these unnecessary messages!

This puts a lot of pressure on the nodes, especially those nodes with poor network connectivity, or as bitcoin is used more and more, its owners can't always pay more and more for their network subscriptions.

And this problem is exactly what the Erlay protocol is going to solve.

How to broadcast a transaction using the Erlay protocol

When you are busy learning about UTXO and the extra traffic of nodes, Bob has learned how to set up his own bitcoin nodes through a tutorial.


Bob has made Alice one of his peers and broadcasts his deal to her, as well as seven other peers. After verifying his transaction, Bob's peers will also tell their 8 peers.


The peer nodes of Bob are connected by green lines, and the peer nodes of the peer nodes are connected by blue lines.

Once the transaction passed the network, not every node received a Bob deal. If you are not included in a team of 8 peers, you may be missing.

Don't worry, the node doesn't have to hear Bob's deal. Instead, it will periodically request a summary of all transactions that have been received by all peer nodes.

  1. Each peer sends a summary of all the transactions it receives, which is less than the data used to send each transaction.
  2. The node then generates a sketch of the transaction it received and compares the sketch to the transaction it received, which is like a "find" game.
  3. The node can then request the exact transaction missing from its own profile from its peer node.

A good metaphor for understanding the difference between a sketch and a missing transaction is a panoramic view of the landscape (all transactions) or a detailed close-up of a single flower or rock in the landscape (a transaction).


Advantages and disadvantages of the Erlay protocol

A way to find out the differences by comparing these sketches leads to a disadvantage. This makes it a little longer (2.6 seconds) for a transaction to be known by all nodes in the global Bitcoin network.

Since bitcoin produces a new block of data every 10 minutes on average, this deceleration seems worthwhile relative to alleviating the large burden on the node.

By doing this, nodes can do less work, so people can run their own nodes more easily, and the bitcoin network can remain decentralized .

We don't want to see only a few big data centers running Bitcoin's entire node, because we all must trust that they can handle our transactions honestly. If this happens, we will return to a world of centrally controlled financial institutions, which is something Bitcoin should avoid.

You can try to think about how the Erlay protocol failed, and the author of the paper also considered it!

Here, they describe the best parameters for comparing these sketches, and what steps a node can rely on when a node cannot find the difference between the sketches.

The authors also tested the performance of the protocol on a real-time network of 100 nodes consisting of an analog network of 100,000 nodes distributed around the world.

If a node increases its number of peer nodes from eight to 32, then their traffic typically increases by 300%, and with the Erlay protocol, the increased traffic costs are only 32%.

So, when can we see that the Erlay protocol will be included in the Bitcoin software?

Now, this research paper is seeking feedback on the status.

If other researchers, testers, and developers did not raise an objection, Gleb Naumenko plans to write a Bitcoin Improvement Proposal (BIP) and then include it in the most popular bitcoin node software: Bitcoin Core.

In addition, Erlay only requires 584 lines of code, it does not require any basic rule changes to Bitcoin, so it will not cause the new version of the software to be incompatible with the old version. In fact, activating this agreement is much easier than other Bitcoin improvement proposals.

I hope you like this explanation, which is a bit experimental for me. If you like it or have suggestions for other Bitcoin related themes, please let me know!