INTRO:
Blockchain is a decentralized, digital ledger that records transactions across a network of computers. It is designed to be secure and transparent, as the data stored in a blockchain is protected by cryptography and can be seen by anyone on the network. The most well-known application of blockchain technology is the digital currency, Bitcoin, but it has potential uses in many other industries, such as finance, supply chain management, and voting systems.
One of the key features of blockchain is that it allows for secure and transparent transactions without the need for intermediaries such as banks. The transactions are verified by network nodes and are recorded on the blockchain in a permanent and unalterable manner. This makes blockchain a trustworthy and secure way to store and transfer data and assets.
In summary, blockchain is a decentralized and secure technology for recording transactions and storing data in a transparent and tamper-proof manner.
Key elements of a blockchain:
Distributed ledger technology :
All network participants have access to the distributed ledger and its immutable record of transactions. With this shared ledger, transactions are recorded only once, eliminating the duplication of effort that’s typical of traditional business networks.
Immutable records :
No participant can change or tamper with a transaction after it’s been recorded to the shared ledger. If a transaction record includes an error, a new transaction must be added to reverse the error, and both transactions are then visible.
Smart contracts :
To speed transactions, a set of rules — called a smart contract — is stored on the blockchain and executed automatically. A smart contract can define conditions for corporate bond transfers, include terms for travel insurance to be paid and much more.
TYPES OF BLOCKCHAIN NETWORKS
There are several ways to build a blockchain network. They can be public, private, permissioned or built by a consortium.
Public blockchain networks
A public blockchain is one that anyone can join and participate in, such as Bitcoin. Drawbacks might include substantial computational power required, little or no privacy for transactions, and weak security. These are important considerations for enterprise use cases of blockchain.
Private blockchain networks
A private blockchain network, similar to a public blockchain network, is a decentralized peer-to-peer network. However, one organization governs the network, controlling who is allowed to participate, executing a consensus protocol and maintaining the shared ledger. Depending on the use case, this can significantly boost trust and confidence between participants. A private blockchain can be run behind a corporate firewall and even be hosted on-premises.
Permissioned blockchain networks
Businesses that set up a private blockchain will generally set up a permissioned blockchain network. It is important to note that public blockchain networks can also be permissioned. This places restrictions on who is allowed to participate in the network and what transactions. Participants need to obtain an invitation or permission to join.
Consortium blockchains
Multiple organizations can share the responsibilities of maintaining a blockchain. These pre-selected organizations determine who may submit transactions or access the data. A consortium blockchain is ideal for business when all participants need to be permission and have a shared responsibility for the blockchain.
Blockchain Programming Fundamentals
In order to understand Blockchain deeply, let us first talk about the concept of a Digital Signature or a Hash.
Digital Signature is basically a function that takes a string as input and returns a fixed-size alphanumeric string. The output string is known as the Digital Signature or the Hash of the input message. The important point to note here is that the function via which we obtain the Digital Signature is “irreversible” in that given an input string, it can compute the Hash. However, given the Hash, it is virtually impossible to compute the input string. Further, it is also virtually impossible to find 2 values that have the same, Hash.
hash1 = Hash(input1)
hash2 = Hash(input2)
Here, what we are essentially trying to say is the following:
It is easy to compute hash1 from input1 and hash2 from input2.
It is virtually impossible to compute input1 given the value of hash1. Similarly for input2 and hash2.
It is virtually impossible to find distinct input1 and input2 such that hash1 = hash2.
Such Hashing functions are carefully designed by cryptographers after years of research. Most programming languages have a built-in library function to compute the Hash of a particular input string.