How Does a Blockchain Work?
Picture a spreadsheet that is duplicated thousands of times across a network of computers. Then imagine that this network is designed to regularly update this spreadsheet and you have a basic understanding of the blockchain.
Information held on a blockchain exists as a shared — and continually reconciled — database. This is a way of using the network that has obvious benefits. The blockchain database isn’t stored in any single location, meaning the records it keeps are truly public and easily verifiable. No centralized version of this information exists for a hacker to corrupt. Hosted by millions of computers simultaneously, its data is accessible to anyone on the internet.
To go in deeper with the Google spreadsheet analogy, I would like you to read this piece from a blockchain specialist.
“The traditional way of sharing documents with collaboration is to send a Microsoft Word document to another recipient and ask them to make revisions to it. The problem with that scenario is that you need to wait until receiving a return copy before you can see or make other changes because you are locked out of editing it until the other person is done with it. That’s how databases work today. Two owners can’t be messing with the same record at once. That’s how banks maintain money balances and transfers; they briefly lock access (or decrease the balance) while they make a transfer, then update the other side, then re-open access (or update again). With Google Docs (or Google Sheets), both parties have access to the same document at the same time, and the single version of that document is always visible to both of them. It is like a shared ledger, but it is a shared document. The distributed part comes into play when sharing involves a number of people.
Imagine the number of legal documents that should be used that way. Instead of passing them to each other, losing track of versions, and not being in sync with the other version, why can’t *all* business documents become shared instead of transferred back and forth? So many types of legal contracts would be ideal for that kind of workflow. You don’t need a blockchain to share documents, but the shared documents analogy is a powerful one.” – William Mougayar, Venture advisor, 4x entrepreneur, marketer, strategist, and blockchain specialist
The reason why the blockchain has gained so much admiration is that:
It is not owned by a single entity, hence it is decentralized
The data is cryptographically stored inside
The blockchain is immutable, so no one can tamper with the data that is inside the blockchain
The blockchain is transparent so one can track the data if they want to
The Three Pillars of Blockchain Technology
The three main properties of Blockchain Technology which have helped it gain widespread acclaim are as follows:
Decentralization
Transparency
Immutability
Pillar #1: Decentralization
Before Bitcoin and BitTorrent came along, we were more used to centralized services. The idea is very simple. You have a centralized entity that stored all the data and you’d have to interact solely with this entity to get whatever information you required.
Another example of a centralized system is the banks. They store all your money, and the only way that you can pay someone is by going through the bank.
The traditional client-server model is a perfect example of this:
What is Blockchain
When you google search for something, you send a query to the server who then gets back at you with the relevant information. That is a simple client-server.
Now, centralized systems have treated us well for many years, however, they have several vulnerabilities.
Firstly, because they are centralized, all the data is stored in one spot. This makes them easy target spots for potential hackers.
If the centralized system were to go through a software upgrade, it would halt the entire system
What if the centralized entity somehow shuts down for whatever reason? That way nobody will be able to access the information that it possesses
Worst case scenario, what if this entity gets corrupted and malicious? If that happens then all the data that is inside the blockchain will be compromised.
So, what happens if we just take this centralized entity away?
In a decentralized system, the information is not stored by one single entity. In fact, everyone in the network owns the information.
In a decentralized network, if you wanted to interact with your friend then you can do so directly without going through a third party. That was the main ideology behind Bitcoins. You and only you alone are in charge of your money. You can send your money to anyone you want without having to go through a bank.
Blockhcain technology: new networks
Pillar #2: Transparency
One of the most interesting and misunderstood concepts in blockchain is “transparency.” Some people say that blockchain gives you privacy while some say that it is transparent. Why do you think that happens?
Well… a person’s identity is hidden via complex cryptography and represented only by their public address. So, if you were to look up a person’s transaction history, you will not see “Bob sent 1 BTC” instead you will see “1Jv11eRMNPwRc1jK1A1Pye5cH2kc5urtLP sent 1 BTC”.
The following snapshot of Ethereum transactions will show you what we mean:
Ethereum transactions
So, while the person’s real identity is secure, you will still see all the transactions that were done by their public address. This level of transparency has never existed before within a financial system. It adds that extra, and much needed, level of accountability which is required by some of these biggest institutions.
Speaking purely from the point of view of cryptocurrency, if you know the public address of one of these big companies, you can simply pop it in an explorer and look at all the transactions that they have engaged in. This forces them to be honest, something that they have never had to deal with before.
However, that’s not the best use-case. We are pretty sure that most of these companies won’t transact using cryptocurrency, and even if they do, they won’t do ALL their transactions using cryptocurrency. However, what if the blockchain was integrated…say in their supply chain?
You can see why something like this can be very helpful for the finance industry right?
Pillar #3: Immutability
Immutability, in the context of the blockchain, means that once something has been entered into the blockchain, it cannot be tampered with.
Can you imagine how valuable this will be for financial institutes?
Imagine how many embezzlement cases can be nipped in the bud if people know that they can’t “work the books” and fiddle around with company accounts.
The reason why the blockchain gets this property is that of the cryptographic hash function.
In simple terms, hashing means taking an input string of any length and giving out an output of a fixed length. In the context of cryptocurrencies like bitcoin, the transactions are taken as input and run through a hashing algorithm (Bitcoin uses SHA-256) which gives an output of a fixed length.
Let’s see how the hashing process works. We are going to put in certain inputs. For this exercise, we are going to use the SHA-256 (Secure Hashing Algorithm 256).
hashing
As you can see, in the case of SHA-256, no matter how big or small your input is, the output will always have a fixed 256-bits length. This becomes critical when you are dealing with a huge amount of data and transactions. So basically, instead of remembering the input data which could be huge, you can just remember the hash and keep track.
A cryptographic hash function is a special class of hash functions that has various properties making it ideal for cryptography. There are certain properties that a cryptographic hash function needs to have in order to be considered secure. You can read about those in detail in our guide on hashing.
There is just one property that we want you to focus on today. It is called the “Avalanche Effect.”
What does that mean?
Even if you make a small change in your input, the changes that will be reflected in the hash will be huge. Let’s test it out using SHA-256:
blockchain hashing
Do you see that? Even though you just changed the case of the first alphabet of the input, look at how much that has affected the output hash. Now, let’s go back to our previous point when we were looking at blockchain architecture. What we said was:
The blockchain is a linked list that contains data and a hash pointer that points to its previous block, hence creating the chain. What is a hash pointer? A hash pointer is similar to a pointer, but instead of just containing the address of the previous block it also contains the hash of the data inside the previous block.
This one small tweak is what makes blockchains so amazingly reliable and trailblazing.
Imagine this for a second, a hacker attacks block 3 and tries to change the data. Because of the properties of hash functions, a slight change in data will change the hash drastically. This means that any slight changes made in block 3, will change the hash which is stored in block 2, now that in turn will change the data and the hash of block 2 which will result in changes in block 1 and so on and so forth. This will completely change the chain, which is impossible. This is exactly how blockchains attain immutability.
testnet bitcoin исходники bitcoin