Getting started with Blockchain - Tutorial


Written by - Deepak Prasad

Introduction: What is blockchain?

  • In 2008, a person using the pseudonym "Satoshi Nakamoto" submitted a white paper titled "BitCoin: A peer-to-peer electronic cash system" which gave birth to blockchain technology.
  • A blockchain is a decentralized, peer-to-peer, distributed technology that keeps records of digital assets in a chain of blocks.
  • By its characteristic attributes, the data or information stored in a blockchain is encrypted and immutable.
  • In simple terms, a blockchain is a distributed ledger that is shared among computer network nodes.
  • For this reason, blockchain is also referred to as Distributed Ledger Technology (DLT).
  • In Layman's term: Blockchain is an ever-growing, secure, shared recordkeeping system in which each user of the data holds a copy of the records, which can only be updated if all parties involved in a transaction agree to update.
  • In Technical term: Blockchain is a peer-to-peer, distributed ledger that is cryptographically secure, append-only, immutable (extremely hard to change), and updateable only via consensus or agreement among peers.

 

Most used terms in Blockchain

  • Peer-to-peer: A distributed system that divides workloads across participants.
  • Decentralized: spread, not controlled by central authority
  • Distributed database: Shared out database
  • Digital assets: assets in digital format and with the right to be used
  • Encrypted: Encoded to prevent unauthorized access.
  • Nodes: are devices within the network used to exchange information.
  • Immutable: Can’t be modified
  • Ledger: A system that stores records of all the input and output processes
  • Consensus: To come to an agreement in relation to the current state of blockchain
  • Cryptography: A system that conceals secret information in such a way that its meaning is unreadable to an unauthorized person.

These are some of the most commonly used terms in blockchain technology. If we come across any new terminology, we will define it as needed.

 

What does a block contain?

As we know, a blockchain consists of a chain of blocks. But what does a "block" consist of?
Well, it consists of the following elements:
Getting started with blockchain - Tutorial

 

1. Timestamp

A block has its own timestamp. Timestamps are useful for keeping track of when data is stored in the block. The time is represented in seconds starting from the date January 1, 1970.

 

2. Hash of previous block

A hash is a function that satisfies the encryption requirements essential for a blockchain operation to be solved. A chain of blocks is, in some ways, the connection between the hash of the previous block and the hash of the next.The blocks of the blockchain are connected to each other because the hash of the previous block is contained in the hash of the new block. There would be no relationship between the blocks without this.

 

3. Root hash of Merkle tree

Getting started with blockchain - Tutorial
A Merkle tree is a binary tree with up to two children. It is a hash-based data structure.As seen in the above figure, a merkle tree can be used to verify information in a vast amount of data in an efficient and secure manner. All transactions in a block can be summed up in a hash, which is the Merkle tree's root hash.

 

4. Nonce

When a block is produced, a 32-bit whole integer is generated at random. This 32-bit whole integer is known as the nonce. It can only be used once in a cryptographic communication. It's used to make a hash of the block header. A nonce generates the cryptographic hash when creating the first block of a chain. The first block of a blockchain is called a genesis block, or Block 0. After that, in order to form the next block in the chain, miners decide the nonce by solving a cryptographic challenge.

 

How BlockChain works

We have now defined and described blockchain. Now, let's see how a blockchain actually works. Nodes are either miners who create new blocks and mint cryptocurrency (coins) or block signers who validate and digitally sign the transactions. This scheme is presented here to give you a general idea of how blocks are generated and what the relationship is between transactions and blocks:

  1. Transaction is initiated: A node starts a transaction by first creating it and then digitally signing it with its private key.
  2. Transaction is validated and broadcast: A transaction is propagated (broadcast) usually by using data-dissemination protocols, such as Gossip protocol, to other peers that validate the transaction based on preset validity criteria.
  3. Find new block: When the transaction is received and validated by special participants called miners on the blockchain network, it is included in a block, and the process of mining starts.
  4. New block found: Once a miner solves a mathematical puzzle (or fulfills the requirements of the consensus mechanism implemented in a blockchain), the block is considered "found" and finalized.
  5. Add new block to the blockchain: The newly created block is validated, transactions or smart contracts within it are executed, and it is propagated to other peers.

This process can be visualized in the diagram as follows:

Getting started with blockchain
How a block is generated

 

Features of Blockchain

1. Public Distributed Ledger

A public distributed ledger is a collection of digital data that is synchronized globally and can be accessed by anybody on the network. When everyone in the network has a copy of the ledger, no one can change the data on their own. As, the network ledger is verified by all other users on the system, a better outcome is ensured.
As a result, it is regarded as one of the most important features of the blockchain.

 

2. Consensus

Consensus is a fault-tolerant strategy used in blockchain systems to obtain the necessary agreement on a single data value or a single network state among dispersed activities or multi-agent systems, such as cryptocurrencies. It's a decision-making mechanism for a collection of nodes that needs to reach an agreement rapidly and be active on the network to keep the system running smoothly. It's similar to a voting system in which the majority wins and the minority has no other options.

 

3. Decentralized

The blockchain network is decentralized, which means it doesn't have a single governing force or person in charge of it. Instead, a set of nodes maintains the network, making it democratic and putting us, the users, on the front line. The movement of control and decision-making from a centralized body to a distributed network is referred to as decentralization.

 

4. Immutability

Immutability refers to something that cannot be modified or altered, and it is one of the key characteristics of blockchain that ensures it remains a permanent and unalterable network.Each validated transaction in a blockchain stores a timestamp in the block, which is cryptographically protected by a hashing process based on the attributes of the preceding block's hash, and joins the chain as the next sequential update.

 

5. Transparency and trust

As blockchains are shared and everyone can see what is on the blockchain, this allows the system to be transparent. As a result, trust is established. This is more relevant in scenarios such as the disbursement of funds or benefits where personal discretion in relation to selecting beneficiaries needs to be restricted.

 

6. High availability

As the system is based on thousands of nodes in a peer-to-peer network, and the data is replicated and updated on every node, the system becomes highly available. Even if some nodes leave the network or become inaccessible, the network as a whole continues to work, thus making it highly available. This redundancy results in high availability.

 

7. Highly secure

All transactions on a blockchain are cryptographically secured and thus provide network integrity. Any transactions posted from the nodes on the blockchain are verified based on a predetermined set of rules. Only valid transactions are selected for inclusion in a block. The blockchain is based on proven cryptographic technology that ensures the integrity and availability of data.

 

8. Cost-saving

As no trusted third party or clearing house is required in the blockchain model, this can massively eliminate overhead costs in the form of the fees, which are paid to such parties.

 

Some problems with BlockChain

As with any technology, some challenges need to be addressed in order to make a system more robust, useful, and accessible. Blockchain technology is no exception. The most sensitive blockchain problems are as follows:

  • Scalability: Currently, blockchain networks are not as scalable as, for example, current financial networks. This is a known area of concern and a very ripe area for research.
  • Adoption: Often, blockchain is seen as a nascent technology. Even though this perspective is rapidly changing, there is still a long way to go before the mass adoption of this technology.
  • Regulation: Due to its decentralized nature, regulation is almost impossible on blockchain.
  • Privacy and confidentiality: Privacy is a concern on public blockchains such as Bitcoin where everyone can see every single transaction.

 

Summary

Blockchain is a decentralized, peer to peer, distributed technology that keeps records of digital assets in a chain of blocks. It’s main features are immutability, decentralization, consensus, and publicly distributed ledger. The first block of a blockchain is called a genesis block, or Block 0.A block consists of  timestamp,  hash from the previous block,  merkle tree root hash, and nonce. To summarize, this blog post introduced us to the world of blockchain.

 

Further Reading

Blockchain Learn
Whitepaper - BitCoin: A peer-to-peer electronic cash system
Bitcoin Development

 

Deepak Prasad

He is the founder of GoLinuxCloud and brings over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels in various domains, from development to DevOps, Networking, and Security, ensuring robust and efficient solutions for diverse projects. You can reach out to him on his LinkedIn profile or join on Facebook page.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

Leave a Comment

X