Erlay: a non-technical explanation

GB Erlay aims to realize an optimization for all data traffic that is exchanged between bitcoin nodes. It should put less load on the nodes, which lowers the requirements for running a node. But what exactly does Erlay do?

Broadcasting right now

This is Bob.

Bob wants to send a bitcoin transaction. The reason is irrelevant, although you may be able to guess.

Of course, he wants his transaction to be included in the bitcoin blockchain as soon as possible. To achieve this, it is important that as many nodes in the network as possible are aware of the transaction that Bob has sent with his wallet. This spreading of the transaction is done from node to node, which is very important for a well-functioning network. After all, this increases the chance that his transaction will be noticed by a miner, after which it can be included in the next block.

Since Bob prefers to spend his money on other things, he does not have his own node in the bitcoin network. Instead, it relies on Alice’s node to forward its transaction to all other nodes.

Bob knows his bitcoins cannot be stolen by Alice if he only uses her node to propagate the transaction.

Alice’s node takes a good look at Bob’s transaction first, to verify the validity of the transaction.

In addition, Alice’s node also checks whether Bob has secretly spent the sent bitcoins before. It does this by looking at the list of unspent transaction outputs (UTXOs) ????? bitcoins that have arrived at an address, but not yet spent ????? the balance of that address.

When everything is checked, Alice’s node will approve the transaction and forward it to eight other nodes.

Bob may blindly trust Alice’s node, but the nodes receiving Bob’s transaction through Alice do not. They too will perform the checks Alice did; the validity of the transaction and whether the bitcoins can still be spent.

As you can imagine now, more and more nodes will receive and forward Bob’s transaction. However, nodes do not know who has already received the transaction. So it is randomly forwarded. As a result, nodes will receive the same transaction ????? that from Bob ????? multiple times.

So a lot of messages are exchanged between the nodes. This of course gives greater certainty that all nodes will receive the transaction. However, the nodes must bear the burden of all additional data received.

This means that the nodes receive much more data than is necessary. The research of the Erlay inventors shows that 44% of all traffic between nodes is unnecessary. That’s a lot of wasted data! This puts unnecessary pressure on nodes, especially those where the internet is not too good or where you even have to pay per MB.

So this problem is addressed with Erlay.

Broadcasting with Erlay

While we slowly became familiar with the world of UTXOs and the unnecessary data that is exchanged between nodes, Bob set up his own node.

Bob also immediately made a connection with Alice’s node. The transaction he sends is now sent via his node to Alice and seven other peers . As explained earlier, these eight receivers, after checking and verifying, forward the transaction to other participants in the network.

Bob’s peers in green, and their peers in blue.

After the transaction has gone through the network, it turns out that not every node has received the transaction. This is due to not flooding all nodes with the same transactions.

At first glance this may seem like a problem, but it is not. The nodes don’t have to worry about missing a transaction and not being able to function properly. Once in a while the node requests a so-called sketch . This sketch contains all transactions received by all peers themselves. This goes as follows:

  1. Each peer sends a draft of all transactions in their possession. Such a sketch is smaller than if each transaction had to be distributed separately.
  2. The node then creates a sketch of its own transactions and compares it with the sketches received. Do these differ? Then something is missing! A kind of spot the difference .
  3. The node can then request the missing transaction from its peers based on the sketch, after which the transaction collection is complete again.

A good metaphor to make the difference between the sketch and the transaction is a panoramic view of a landscape (all transactions) or a close up of a specific flower or rock in that landscape (one specific transaction).

Advantages and disadvantages

There is a downside when you are comparing the sketches, looking for the difference. It takes about 2.6 seconds longer for your transaction to be known to the entire bitcoin network. A bit slower than when all transactions are shot at random.

Since Bitcoin records new transactions in the blockchain every 10 minutes on average, this small delay seems manageable. On the other hand, the nodes have to process a lot less data. This could encourage more people to run their own node; something that makes or breaks the decentralization of Bitcoin.

When can I upgrade?

At the moment, feedback is still being collected based on the research document.

If no objections come to light from other researchers, developers or the community, the proposal will be formally published for inclusion in the bitcoin software.

Erlay is not an extremely heavy upgrade; it takes ‘only’ 548 lines of code, with none of Bitcoin’s core rules needing to be modified. This means that older versions of the software will continue to work when Erlay is added. We now have to wait until the proposal has been properly analyzed and the first concrete plans will be presented in a BIP.

This article is based on the article by Sam Wouters. Sam speaks about Bitcoin and blockchain related topics, with the aim of making these complex topics as easy to understand as possible.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

© 2024 Cryptocoin Budisma.net