Blockchain | What is it? How does it work?

Blockchain | What is it? How does it work?

Team M.A.D



What is Blockchain?

As the name suggests, a blockchain is made of a linear chain of blocks and is responsible for keeping a permanent record of all confirmed transactions (and related data) - all secured by cryptography. Blockchain is basically an ever-growing list of records that are highly resistant to modification; these records are called blocks that are linked together using cryptography (codes). Each block contains a cryptographic hash of the previous block, a timestamp, and transaction data (generally represented as a Merkle tree). The timestamp proves that the transaction data existed when the block was published in order to get into its hash. As blocks each contain information about the block previous to it, they form a chain, with each additional block reinforcing the ones before it. Therefore, blockchains are resistant to modification of their data because once recorded, the data in any given block cannot be altered retroactively without altering all subsequent blocks.


Let us simplify this further:

Blockchain seems complicated, and it definitely can be, but its core concept is really quite simple. A blockchain is a type of database. To be able to understand blockchain, it is necessary to first understand what a database actually is. 

A database is a collection of information that is stored electronically on a computer system. Information, or data, in databases is typically structured in table format to allow for easier searching and filtering for specific information. 

A blockchain is a list of data records that works as a decentralized digital database/ledger. The data is organized into blocks, which are chronologically arranged and secured by cryptography. 

Cryptography (the making or solving of codes and algorithms) is the science of hiding information with the use of mathematical theories and computation to encrypt and decrypt data or to guarantee integrity and authenticity of the information which makes it nearly impossible to tamper even if sent over an unsecured network. In a basic process of text encryption, a plaintext (data that can be clearly understood) undergoes an encryption process that turns it into ciphertext (which is unreadable) but the type of security used on regular personal files (like contacts) is not the same as the one used on cryptocurrency networks.

A blockchain is a special type of database. You may also have heard the term Distributed Ledger Technology (or DLT) – in many cases, they're referring to the same thing. A blockchain has certain unique properties. There are rules about how data can be added, and once the data has been stored, it's virtually impossible to modify or delete it.

Data is added over time in structures called blocks. Each block is built on top of the last and includes a piece of information that links back to the previous one. By looking at the most up-to-date block, we can check that it has been created after the last. So, if we continue all the way down the "chain," we'll reach our very first block – known as the genesis block.

The genesis block is the first-ever block recorded on its respective blockchain network, also occasionally referred to as Block 0 or Block 1.

In simple terms, once you make a transaction, it does not get automatically processed. It is first added to a block, and when a block is filled with transactions to its maximum capacity, the block is approved and the transaction data gets permanently added to the blockchain (digital passbook/ledger), i.e. the transaction gets approved and is completed.


The core points are:

  • Blockchain is a specific type of database.
  • It differs from a typical database in the way it stores information; blockchains store data in blocks that are then chained together. 
  • As new data comes in it is entered into a fresh block. Once the block is filled with data it is chained onto the previous block, which makes the data chained together in chronological order.
  • Different types of information can be stored on a blockchain but the most common use so far has been as a ledger for transactions. 
  • In most cases, blockchain is used in a decentralized way so that no single person or group has control—rather, all users collectively retain control.
  • Decentralized blockchains are immutable, which means that the data entered is irreversible. For Bitcoin, this means that transactions are permanently recorded and viewable to anyone.



How does blockchain work?

In the context of cryptocurrencies, a blockchain consists of a stable chain of blocks, each one storing a list of previously confirmed transactions. Since the blockchain network is maintained by a myriad of computers spread around the world, it functions as a decentralized database (or ledger). This means that each participant (node) maintains a copy of the blockchain data, and they communicate with each other to ensure that they are all on the same page (or block).

Therefore, blockchain transactions occur within a peer-to-peer global network and this is what makes Bitcoin a decentralized digital currency that is borderless, censorship-resistant. In addition, most blockchain systems are considered trustless because they do not require any kind of trust. There is no single authority in control of Bitcoin.

A central part of almost every blockchain is the process of mining, which relies on hashing algorithms. Bitcoin uses the SHA-256 algorithm (Secure hash algorithm 256 bits). It takes an input of any length and generates an output that will always have the same length. The output produced is called a "hash" and, in this case, is always made of 64 characters (256bits).

So the same input will result in the same output, no matter how many times the process is repeated. But if a small change is made to the input, the output will change completely. As such, hash functions are deterministic, and in the cryptocurrency world, most of them are designed as a one-way hash function.

Being a one-way function means that it is almost impossible to calculate what was the input from the output. One can only guess what the input was, but the odds of guessing it right are extremely low. This is one of the reasons why blockchain is secure.


Example:
Now that we know what the algorithm does, let's demonstrate how a blockchain works with a simple example of a transaction.

Imagine that we have Alice and Bob along with their Bitcoin balance. Let's say Alice owes Bob 2 Bitcoins.
For Alice to send Bob that 2 bitcoin, Alice broadcasts a message with the transaction that she wants to make to all the miners in the network.

In that transaction, Alice gives the miners Bob's address and the amount of Bitcoins she would like to send, along with a digital signature and her public key. The signature is made with Alice's private key and the miners can validate that Alice, in fact, is the owner of those coins.

Once the miners are sure that the transaction is valid they can put it in a block along with many other transactions and attempt to mine the block. This is done by putting the block through the SHA-256 algorithm.

Once the block is mined the miner broadcasts that newly mined block to all the other miners. They then check to make sure that the block is valid so that they can add it to their copy of the blockchain and the transaction is complete. But in the block, the miners also need to include the output hash from the previous block so that all blocks are tied together, hence the name blockchain. This is an important part because of the way trust works in the system.


Every miner has their own copy of the blockchain on their computer and everyone trusts whichever blockchain that has the most computational work put into it, the longest blockchain. If a miner changes a transaction in a previous block, the output hash for that block will change which leads to all the hashes after it changing as well due to the blocks being liked with hashes. The miner would have to redo all of the work in order to make anyone accept his blockchain as the right one.


Storage Structure:

One key difference between a typical database and a blockchain is the way the data is structured. A blockchain collects information together in groups, also known as blocks, that hold sets of information. Blocks have certain storage capacities and, when filled, are chained onto the previously filled block, forming a chain of data known as the “blockchain.” All new information that follows that freshly added block is compiled into a newly formed block that will then also be added to the chain once filled.

A database structures its data into tables whereas a blockchain, like its name implies, structures its data into chunks (blocks) that are chained together. This makes it so that all blockchains are databases but not all databases are blockchains. This system also inherently makes an irreversible timeline of data when implemented in a decentralized nature. When a block is filled it is set in stone and becomes a part of this timeline. Each block in the chain is given an exact timestamp when it is added to the chain.


Types of consensus algorithms on which blockchain works:

The model of making computers work in order to produce blocks is called Proof-of-Work (PoW) there are also other models like Proof-of-Stake (PoS) which does not require as much computing power and is meant to require less electricity while being able to scale to more users.



Security with Blockchain.

Blockchain technology accounts for the issues of security and trust in several ways. First, new blocks are always stored linearly and chronologically. That is, they are always added to the “end” of the blockchain. If you take a look at Bitcoin’s blockchain, you’ll see that each block has a position on the chain, called a “height.” As of November 2020, the block’s height had reached 656,197 blocks so far. 

After a block has been added to the end of the blockchain, it is very difficult to go back and alter the contents of the block unless the majority reached a consensus (agreement) to do so. That’s because each block contains its own hash, along with the hash of the block before it, as well as the previously mentioned time stamp. Hash codes are created by a math function that turns digital information into a string of numbers and letters. If that information is edited in any way, the hash code changes as well.

Here’s why that’s important to security. Let’s say a hacker wants to alter the blockchain and steal Bitcoin from everyone else. If they were to alter their own single copy, it would no longer align with everyone else's copy. When everyone else cross-references their copies against each other, they would see this one copy stand out and that hacker's version of the chain would be cast away as illegitimate.



Cryptocurrency-Blockchain Mechanism.

Every cryptocurrency works on top of a blockchain, a blockchain works according to a predefined set of rules (i.e. an underlying protocol). The protocol is what defines how the blockchain and the cryptocurrency system should operate.





References:

Report Page