Prerequisites – Introduction to Blockchain
Blockchain is a distributed ledger where data can be stored securely such that any alteration in the data is not possible. In other words, we can also define it as a decentralized computation and information sharing platform that enables multiple authoritative domains, who coordinate in a rational decision-making process. Here, decentralized/ distributed term means that all nodes have equal priority, and they share their resources among themselves.
As per the name ‘Blockchain‘, it itself suggests that information (i.e transactions) will be stored in the form of blocks. Every node can see the block, but they can’t tamper with them. If a block value is tampered the hash value associated with that block changes and that block will be disconnected from the network. On an average of 12.6 seconds, every node in the blockchain network gets the most updated blockchain. The technology behind Bitcoins is the Blockchain Network. Following are the components of a Blockchain network –
1. Node –
It is of two types – Full Node and Partial Node.
- Full Node –
It maintains a full copy of all the transactions. It has the capacity to validate, accept and reject the transactions.
- Partial Node –
It is also called a Lightweight Node because it doesn’t maintain the whole copy of the blockchain ledger. It maintains only the hash value of the transaction. The whole transaction is accessed using this hash value only. These nodes have low storage and low computational power.
2. Ledger –
It is a digital database of information. Here, we have used the term ‘digital’ because the currency exchanged between different nodes is digital i.e cryptocurrency. There are three types of ledger. They are –
- Public Ledger –
It is open and transparent to all. Anyone in the blockchain network can read or write something.
- Distributed Ledger –
In this ledger, all nodes have a local copy of the database. Here, a group of nodes collectively execute the job i.e verify transactions, add blocks in the blockchain.
- Decentralized Ledger –
In this ledger, no one node or group of nodes has a central control. Every node participates in the execution of the job.
3. Wallet –
It is a digital wallet that allows user to store their cryptocurrency. Every node in the blockchain network has a Wallet. Privacy of a wallet in a blockchain network is maintained using public and private key pairs. In a wallet, there is no need for currency conversion as the currency in the wallet is universally acceptable. Cryptocurrency wallets are mainly of two types –
- Hot Wallet –
These wallets are used for online day-to-day transactions connected to the internet. Hackers can attack this wallet as it is connected to the internet. Hot wallets are further classified into two types –
a. Online/ Web wallets –
These wallets run on the cloud platform. Examples – MyEther Wallet, MetaMask Wallet.
b. Software wallets –
It consists of desktop wallets and mobile wallets. Desktop wallets can be downloaded on a desktop and the user has full control of the wallet. An example of a desktop wallet is Electrum.
c. Mobile wallets –
They are designed to operate on smartphone devices. Example – mycelium.
- Cold Wallet –
These wallets are not connected to the internet. It is very safe and hackers cannot attack it. These wallets are purchased by the user. Example – Paper wallet, hardware wallet.
a. Paper wallet –
They are offline wallets in which a piece of paper is used that contains the crypto address. The private key is printed in QR code format. QR code is scanned for cryptocurrency transactions.
b. Hardware wallet –
It is a physical electronic device that uses a random number generator that is associated with the wallet.
The focus of wallets is on these three things –
- Transactions should be secure
- Easy to use
Privacy of a wallet is maintained using public and private key pairs. Transactions are made secure as a private key is used both to send fund and to open the encrypted message.
4. Nonce –
A nonce is an abbreviation for “number only used once,” which is a number added to a hashed or encrypted block in a blockchain. It is the 32-bit number generated randomly only one time that assists to create a new block or validate a transaction. It is used to make the transaction more secure.
It is hard to select the number which can be used as the nonce. It requires a vital amount of trial-and-error. First, a miner guesses a nonce. Then, it appends the guessed nonce to the hash of the current header. After that, it rehashes the value and compares this to the target hash. Now it checks that whether the resulting hash value meets the requirements or not. If all the conditions are met, it means that the miner has created an answer and is granted the block.
5. Hash –
The data is mapped to a fixed size using hashing. It plays a very important role in cryptography. In a blockchain network hash value of one transaction is the input of another transaction. Properties of the hash function are as follows –
- Collision resistant
- Puzzle friendliness
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!