Read: 1. Why blockchain?
2. What is blockchain?
3. What is money?
If we take away all the noise and technical jargon around cryptocurrencies, and reduce it to a simple definition, it is just a set of limited entries in a database no one can change without fulfilling specific conditions. The blockchain system is designed in such a way that no trust is needed, security and reliability are obtained via special mathematical functions and code.
This principle also applies to money lying in your bank account. Let’s suppose you retrieve some money in the form of notes and coins. These are nothing but limited entries in a public database that can be changed only if you physically own the coins and notes.
How does the database of cryptocurrencies work?
Every cryptocurrency has a network of peers. Every peer has a record of the entire history of every single transaction and thus the balance at any given time.
What is a transaction in the cryptocurrency field?
If you give me X amount of currency and you sign, it is called a transaction which is basically, a public key cryptography. And this transaction will be broadcasted to the entire network through what is called a peer to peer technology.
What is a ledger?
A digital file that keeps track of all crypto transactions.
How is the ledger file maintained and updated?
The ledger file is not stored in a central entity server, like a bank, or in a single data center. It is distributed across the globe via a network of computers that are both storing data and executing computations. Each of these computers represents a “node” of the blockchain network and has a copy of the ledger file. If you want to send me, say 10 Bitcoins. You broadcast a message to the entire network stating the number of Bitcoins in your account should go down by 10 BTC, and the amount in my account should go up by the same quantity. Each node in the network will receive the message and apply the requested transaction to their copy of the ledger, thus updating the account balances. In other words, blockchain is a system that allows a group of connected computers to maintain a single updated and secure ledger. You ‘can’t’ alter this later.
What is an exchange?
A digital platform that allows you to exchange, in other words, trade cryptocurrencies. Eg: Binance, Coinbase, Coindelta, Cryptopia etc.
What is a wallet?
A program that allows you to store cryptocurrencies. A digital version of a physical wallet to store digital currencies. Each wallet is protected by a special cryptographic method that uses a unique pair of different but connected keys: a private and a public key.
A quick flashback to what these keys are:
Two keys — One public key and one private key. You’ll hold the private key to both locks (encrypt) and unlock(decrypt) your safe to access your valuable item(data). You could give the public key to me or anyone but this will allow me to only either lock(encrypt) or unlock(decrypt) the safe and not both. For example, if I unlock(decrypt) to drop a document/another valuable item(data), only you will be able to lock it(encrypt) and vice versa. You’ll also know that I, and nobody else, put the document/valuable item in your safe. This is called a digital signature. A digital signature is used by blockchain nodes to double check the source and the authenticity of the transaction. A digital signature is specific to a particular transaction and can’t be used again
When you want to send Bitcoins to me, you’d broadcast a message encrypted with the private key(you won’t have to reveal it) of your wallet, so that only you can spend the Bitcoins you own as only you have your own private key necessary to unlock your wallet. Each node in the network can cross-check that the transaction request is coming from you by decrypting the transaction request message with the public key of your wallet.
Security and Verifications:
Since all transactions are maintained on the ledger, nodes in the network will verify each time that the total amount of the transactions, i.e the current balance is correlated with the previous transactions. It is due to this security check, it is not possible to double-spend received Bitcoins.
Transactions are passed from node to node within the network, so the order in which 2 transactions reach each node can be different. You could send bitcoins through a transaction, wait for me to ship a product and then send a reverse transaction back to your own account. In this case, it is possible that some nodes receive the second transaction before the first one and therefore consider the first payment transaction invalid as the node believes that the bitcoins are already spent. Therefore, there is no way to tell if a transaction happened before another, and this opens up the potential for fraudulent attacks or a hacker to steal bitcoins.
To solve the above case, blockchain uses node agreements to order transactions. And this is done by grouping transactions into a block.
What is a block?
A block contains a definite number of transactions and a link to the previous block, putting one block after the other in time. Blocks are therefore organized into a time-related chain and hence the term for the network ‘BLOCKCHAIN. All the transactions in a particular block are said to have happened at the same time. For a new block to be added to blockchain by a node, it needs to provide the block with the answer to a complex mathematical problem created using an irreversible cryptographic hash function. In other words, this is called Proof of Work. Anybody who provides their computing power to act as a node in the network is called a miner.
The only way to solve such a mathematical problem is to guess random numbers that combined with the previous block content generate a defined result (usually a number below a certain value). This consumes a lot of computation power.
Proof of Work(PoW)
An algorithm used to confirm transactions on the blockchain and this is done by competing nodes/miners trying to solve the complex mathematical problems (energy, time and GPU/CPU consuming) to earn a reward.
Proof of Work has the following challenges:
1. High energy consuming method — more computational resources required and hence very expensive
2. The computations made or the mathematical puzzles solved have no useful application by themselves
3. 51% attack
51% attack refers to an attack on a blockchain by miner(s) controlling more than 50% of the network’s computing resources with the ability to prevent new transactions from gaining confirmations, allowing them to halt payments between users. They would also be able to reverse transactions that were completed while in control of the network, meaning they could double-spend coins. This is the major drawback of PoW.
Proof of Stake(PoS)
There are no miners who are rewarded in PoS as in the case of PoW. Instead, a block creator is chosen in a deterministic manner depending on the wealth or the number of crypto coins he or she holds(stake). And these creators are called forgers. This way, instead of utilizing energy to answer PoW puzzles, a PoS forger is limited to mining a percentage of transactions that is reflective of his or her ownership stake.
Proof of Stake, Proof of Work along with Proof of Algorithm, Proof of Burn, Proof of Capacity, Proof of Assignment are called consensus algorithms.
Consensus algorithms are algorithms designed to achieve reliability in a network involving multiple unreliable nodes.
5. What are the challenges with blockchain?
ImageCredits: GeoSpatial World, CNBC, Techbullion, Medium
4.How Blockchain Works? was originally published in Data Driven Investor on Medium, where people are continuing the conversation by highlighting and responding to this story.