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.
If someone sending a request to a service would have to put in a lot of work to get an answer, it would be very costly to send a multitude of requests or require a disproportionate amount of hardware resources.
2️⃣ Variants
Two variants of Proof-Of-Work algorithms exist:
1. Challenge-response 2. Solution-verification
1. Challenge-response
This variant can be used when there is a direct link between the prover and the verifier. When the prover sends a request, the verifier chooses a problem to solve and asks the prover to do so.
The prover then has to spend computing power to solve the problem and provide its answer to the verifier. If the verification is successful, the prover gets access to the service. If not, access is denied or whatever was sent is not accepted.
2. Solution-verification
This variant doesn't assume a direct link between the prover and the verifier. There is no request and the prover wants to prove that some work they have done is valid. This variant is actually the one used by Bitcoin.
The prover solves a problem that can be self-imposed. It means that the prover has the choice of the problem. The verifier must then verify both the problem and the solution before accepting the overall solution.
3️⃣ Usage In Bitcoin
Bitcoin uses a Proof-Of-Work algorithm when new blocks are appended to the chain. It actually makes up a huge portion of Bitcoin's security. To be precise, Bitcoin uses a solution-verification mechanism as the blockchain is a decentralized system.
The algorithm Bitcoin uses is called Hashcash. It's not the original Hashcash algorithm but an adjusted version.
The general idea, however, is actually relatively simple. Every block contains an irreversible cryptographic hash that takes into account the hash of all ...
... transactions within the current block, the previous block's hash, and a so-called nonce in the new block. This is a positive integer that can be chosen by the miners. It is the only thing the miners can adjust to try and create a hash that fulfills the current ...
... difficulty requirements of the network. You could say it's a number guessing game. The nonce is set to a value, a hash is created and checked for validity. If it doesn't meet the requirements, the nonce is incremented, a new hash is created, and so on.
Bitcoin adjusts the original Hashcash algorithm by using two continuous SHA-256 hashes instead of an SHA-1 one. This leads to Bitcoin being able to freely adjust the difficulty so that not more than 6 blocks are ever created per hour on the blockchain.
Clients never have to guess the nonce. They can simply verify that the leading zeroes within the hash actually represent the difficulty of the network and only then that the data presented to them creates the hash they see.
3️⃣ Critique
The guessing game associated with mining Bitcoins actually leads to a lot of energy consumption. As many miners compete with each other, many of them do the same work before one of them finds a fitting solution to the problem.
Proof-Of-Work algorithms are, by design, meant to take a lot of time, and the increased energy consumption is a by-product of this. There are alternatives that don't consume that much energy and that currently look like a better alternative.
4️⃣ The End
That's it for this thread. I hope you like this general overview of Proof-Of-Work algorithms and how one such application within Bitcoin generally works.
Feel free to leave your feedback, as usual!
• • •
Missing some Tweet in this thread? You can try to
force a refresh
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.
the architectural approach that makes your websites faster, safer, cheaper, and all that with a better developer experience.
🧵🔽
1️⃣ What Is It?
The Jamstack is an architectural approach.
The letters "J A M" are an acronym and actually stand for:
▶️ JavaScript
▶️ APIs
▶️ Markup
🟢 JavaScript
JavaScript is the universal runtime of the web. Every browser can handle JavaScript and it's the language that brings interactivity to every modern-day browser.
JavaScript can either be written directly or act as a compile target.
Here are _some_ of the most essential git operations you will need when working as a developer.
🧵🔽
1️⃣ Create A New Repository
This is the most basic command you'll need. When you start a repository locally, your start with git init.
2️⃣ Clone A Repository
You can clone a remote repository to get a local copy of it. Your local repository is connected to the remote one so you can pull in changes and push yours to the remote.
You hear some people talking about it, you might have a basic idea, but let's take a closer look because, in the end, it's not as difficult as it might seem from the outside!
🧵⏬
1️⃣ What Is It?
Test-driven development (short: TDD) is a software development technique.
Instead of writing all your code first and only then writing your tests, you start with tests, then code a little, then test again, and so on.
It is one specific form of the test-first approach and aims at making software development faster, more reliable, and safer to do. And it especially forces developers into a user role.
By writing tests first, you become a user. You are the first one to ...
They are both deeply immutable, so you no longer need to Object .freeze() your objects or use libraries like Immutable .js to gain unchangeable objects, and do you know what's even more awesome?
You can compare them with the strict equality comparison (===), ...