Consensus algorithms are actually a necessity for blockchains to function properly and are at the heart of any implementation.
And did you know that there are actually quite a few of them? Let's take a look at some interesating ones!
🧵👇🏻
0️⃣ What Is A Consensus Algorithm?
Blockchains are decentralized. There is never a central entity that can decide what is true and what is not. Instead, in a blockchain network, a variety of nodes interact with each other.
As a blockchain usually stores data in a chain of blocks (hence the name), the network must decide what the actual truth is together, This is where consensus algorithms come in. Everyone can append a block. If two participants do it at the same time, the chain is forked.
Distributed consensus helps the network to decide which fork of the chain is actually the truth while ignoring or throwing away the wrong fork. It especially helps them to decide if a block that has been appended to the chain was so, rightfully.
1️⃣ Proof of Work (PoW)
This is the algorithm currently used by Bitcoin, Ethereum 1.x, and a few other blockchains.
Miners, the ones that append blocks to the chain, usually have to solve a moderately difficult to very difficult challenge to gain the right to append a block.
In case of Bitcoin, the network chooses a target hash that the miners must create. The miners take the hash of the previous block, the transactions that are to be included in the next block, and a so-called nonce, and then create a hash from all that data.
The nonce is simply an integer. It is the only thing that can be changed by the miners. The miners have to guess the right nonce so that it, together with the hash of the previous block and the new transactions, creates the target hash initially requested.
All other participants can easily check if the hash presented to them is indeed the correct one by simply hashing all the necessary data. If they get the hash they see, everything is alright. If not, they can throw away the block.
In case of Bitcoin, the difficulty of finding the right nonce can be adjusted by asking for a certain number of leading zeroes in the target hash. The more zeroes asked for, the more difficult the task becomes.
PoW is very energy-intensive.
2️⃣ Proof-Of-Stake (PoS)
This algorithm is the most common alternative to the energy-intensive PoW.
In PoS-based networks, miners are called validators. They lock away a certain amount of the network's coins and are randomly chosen by the network to validate the next block.
The choice is based on the amount of coins staked and other factors, like the stake's age. When a validator appends a new block, the stake's age is reset to zero to ensure that everyone gets their turn at some point.
Each individual blockchain implementation can decide which factors to take into account when choosing validators.
The algorithm is not energy-intensive at all but requires an investment upfront that sometimes isn't trivial.
If a validator tries to harm the network by appending fake blocks to the chain, it loses its stake on detection of the fraud. The investment upfront thus is to ensure that validators play by the rules.
3️⃣ Proof of Burn (PoB)
PoB is a controversial algorithm. Miners basically burn coins in order to gain the right to append a block to the chain. The higher the amount they burn, the higher the chance they are selected.
Burning coins in this case means sending coins to a special wallet address that is not accessible from the outside. The coins simply vanish out of circulation.
When miners gain the right to append a block, they are once again paid in coins and the cycle begins again.
You could say that this process actually means that miners take a short-term loss in anticipation of greater long-term gains.
The system, however, is not without critique. A miner that is able to burn more money will append more blocks.
Depending on the price of the coin to be burned, a takeover of the network becomes more likely, as the only thing to spend is a certain amount of money.
4️⃣ Proof of Capacity (PoC)
PoC asks validators to invest their disk space. Instead of staking/burning coins, or doing enegery-intensive calculations, validators simply provide capacity on their hard drives to the network.
The more disk space a validator provides, the larger its chances to get selected as the validtor to append the next block to the chain.
This algorithm makes a lot of sense in storage-oriented blockchains where distributed disk space is provided to users.
5️⃣ Proof of Elapsed Time (PoET)
This algorithm is actually one of the fairest consensus mechanisms. No coins are staked or burned, no computations are made, and no disk space is provided. Instead, everyone has to wait a random amount of time.
When it's time to append a new block to the chain, everyone can broadcast their suggestion, as well as a proof of their wait time since they appended the last block.
The network then decides, based on the proven wait time, which block to accept and the creator gets rewarded.
This algorithm usually comes with additional checks to ensure that the system still stays fair, as longer wait time doesn't necessarily mean that the chance should be higher.
6️⃣ Before You Leave
If you enjoyed this content, leave a like and retweet it for your own audience. It would be highly appreciated! 🙏🏻
In case you want more of this content, feel free to hit the follow button, would love you as a member of my community! ❤️
• • •
Missing some Tweet in this thread? You can try to
force a refresh
You don't know how to get into crypto or you simply don't want to spend any money? Do you still want a piece of the cake?
Here is a short 101 on how to get your hands on some crypto and even #BTC.
🧵👇🏻
1️⃣ Download Brave
The Brave browser is based on Chromium, and designed with privacy in mind. If you are unsure, Brendan Eich (yes, exactly, him) is the CEO of Brave Software Inc., the company creating the browser.
Brave blocks ads on websites by default but it comes with its own blockchain-based ad system. Instead of putting them everywhere on websites, however, they come in the form of system notifcations, sent by your browser.
Here are five tips that helped me to grow as a developer.
They aren't complicated and can be implemented directly. I'm sure there is something in it for you!
🧵🔽
1️⃣ Learn To Listen
Listening is more important than talking. If someone has something to say, listen to them. Don't interrupt them. If you have questions about certain aspects of what they say, write them down. Then ask those questions later and talk about it together.
2️⃣ Accept You Don't Know Everything
Software engineering is too broad and too deep as if anyone could really know everything.
You need to accept that and understand that your peers all have their own experiences. Use this to your advantage. If you're stuck, ask for help.
I can relate!
When I started, AWS already offered so much that I literally couldn't find an entry point.
If you still feel this way, let me give you a little guide.
🧵⏬
1️⃣ Foreword
Before we're going in, let me tell you this:
AWS is huge, and the chance that you'll ever be able to call yourself an expert in every product and service it offers is...well, low.
To be honest, I wouldn't even aim for that goal. It simply doesn't make sense. Better aim to become good at a few products and then at all the supporting ones that fit.
You'll specialize, gather deep knowledge about a few products, and be a valuable expert in that area.
Proof-Of-Work is the name of a cryptographic algorithm that is used for some blockchains when new blocks are to be appended to the chain.
Let's take a higher-level look at how this one works, shall we?
🧵🔽
1️⃣ The Basics
This algorithm creates a system in which one party (the prover) has to prove to one or multiple other parties (the verifiers) that they put in a certain amount of work for some purpose.
The work the prover has to put in is moderately hard to very hard, while the verifiers can pretty easily check whether the proof is correct. This creates an asymmetric system.
The original idea was to create protection against DDoS attacks and spam.
Svelte has topped the satisfaction rankings of "State of JS 2020" some time ago, and this justifies an introduction for everyone still not aware of it.
An introduction to Svelte 💛
🧵🔽
1️⃣ What is Svelte?
Svelte is a component-based frontend framework like React and Vue, that promises:
- Less code
- No virtual DOM
- True reactivity
and delivers on all of these pretty well.
It currently has 41.2k stars on GitHub and an active community, including 359 contributors.
The community is pretty active and unlike React, there is no huge corporation backing it.
But no need to worry, Svelte won't vanish anytime soon.