cft

Understand Blockchain with One-Liners

What is Blockchain, What is Bitcoin, Transaction, Hashing, Block, Chain of Blocks, Distributed Chain of blocks?


user

Himanshu Ramchandani

3 years ago | 5 min read

Let's define some terms and get a grip over the terms used in **blockchain technology**.


# What is Blockchain?

It's a Distributed Database, think of it as a large worldwide computer, where everyone can securely access data and execute transactional code.

All transactions are stored in blocks of data, these blocks are very hard to manipulate once they are stored on the blockchain.


It gives a trustworthy way to store data.


For example - you can store your medical information on it and only the people can access it those you allow it.


> Most data stored on the blockchain focus on transactions and states of objects rather than the actual objects themselves.



# What is Bitcoin?


Bitcoin is the first broadly used **cryptocurrency**.


Cryptocurrency is something that is only accessed as a digital currency. It also does not hold any underlying values, it's not something that you withdraw from the bank and hold in your hand.


>Bitcoin is only a unique string of letters and numbers.


In a bank, if you save your money then you expect from the bank that they maintain a secure ledger of all the transactions.


- With bitcoins there are no central systems, there are no banks.

- There is no way to revert transactions once they are done.

- All transactions are transparent and fully anonymous.


The underlying technology that enables this is called a blockchain.


>Bitcoin would not exist without having a blockchain. And bitcoins are really, blockchain's first broad use.


# Characteristics of Blockchain

- Global Singleton

We can think of blockchain objects as global singleton instances. Blockchain is natively object-oriented where code and data reside together. Objects are securely separated from each other.


- Unstoppable

There is no one in control over blockchain. It cannot be stopped and it cannot be a central failure. No government and corporation can censor it and it is very resistant to be hacked.


- Accessible - Everywhere there is internet you can access the blockchain. By using a broad number of clients and technology.


- Verifiable - Everyone that has access to the blockchain can verify every single transaction from the beginning of time.


# How it works

It begins with someone doing a single or a group of transactions. A transaction is typically sending data in the form of a contract. It can also involve cryptocurrency being sent from one account to another.


The transactions are sent to a peer-to-peer network of computers. These are generally distributed all over the world. Each computer is a node and they all have a copy of the existing data. Then the transactions are executed and validated on the basis of pre-shaped contracts and scripts.

This ensures that all nodes execute using the same set of rules. When the transaction is executed the result is added to the blockchain.


Since this is done to each node you would have to compromise every node in the chain in order to compromise the transaction.


# Transactions in the blockchain


All transactions are atomic, this means that the full operation runs or nothing at all.


Let's say you have a momentary transaction, you would want to ensure that both the functions that credit one account and a function that debits another are executed successfully. If one of them fails then the entire transaction fails. If not you might end up creating or destroying money.


Even in blockchain, there is nothing that prevents you from writing bad code so you still need to ensure that you execute transactions in the right order.


Transactions run independently, from each other. So no two operations can interact or interfere with each other.

- Inspectable

Every single method call that comes to blockchain comes with the actual average to the caller. This gives a unique possibility for securing and auditing solutions on a very very wide scale.

- Immortal

Blockchain objects are immortal, this means all data front objects are permanent. The code never is changed and you can never change it externally. The only way to remove an object from blockchain is if it is programmed to remove itself.



# Hashing

The core of blockchain resides in the concept of hashing. Hashing is basically executing a mathematical algorithm that creates a result with a given length, regardless of the input given.


The result of a hashing function is called a hash and you can think of them as a digital fingerprint.


Hashing is a one-way function, meaning that the function will always return the same results given the same input. But you can not regenerate the input based on the result of the hashing algorithm.


{Output = roundToTen(input X 2)}


input = 5 gives output = 10

input = 4 gives output = 10

input = 3 gives output = 10

input = 9 gives output = 20



In real life, much more advanced hashing is used. Generally well known and available to the public. The more advance your algorithms to be the more power it takes to execute.


A very common algorithm is used is SHA 256. It is one of several checksum hashing algorithms and it will produce a long text string as a result. It is used by American security agencies and makes available to the public.


> SHA is a family of hashing algorithms, 256 is the complexity of the equation.


### Common use of hashing


- Storing passwords to the databases.

- If you apply to hash on a Wikipedia page then you can easily identify if someone changes the content of the page, even a single (,) coma, results in different hash results. If the hash matches then it's good, if not then someone changes the values in the data.


> You don't need to store the entire data, all you need to store is the hash. When the need for consistency is high it is used.


# Block

A block consists of data and resulting hash if we go ahead and change any data in the block, the hash will be change and the block will be invalid.


It also includes nonce which is input to the hashing algorithm that will result in the first part of the hash being something predefined. Like a set of zeros.


It's not possible to predict the nonce so it cant be considered as proof of work by the machine creating the hash.


Let's say we create a hash with a leading number of 4 zeros, we will never change anything, we will need to re-run the hashing algorithm until we figure out which nonce to set. This is called **mining the block**.

### Chain of Blocks -

When we looking at the chain, the block also contains a block number, meaning which order it has in the blockchain.


A block also must contain a timestamp, most importantly, a block in the blockchain willing to contains the hash of the previous block.


This means if you change one of the blocks, you will break all of the blocks following in the chain. This is where the Merkle tree is used.

### Distributed chain of blocks -

In blockchain we distribute a chain of blocks to wast number of computers, this means the chain exists in multiple locations.


Depending upon the implementation of the blockchain we have millions of applications of blockchain, this means we can figure out something is changed if one of the chains is re-mined.


The resulting hashes would be different for one chain.


The altered chain will then be deducted by the blockchain and then be removed.



> If you find any doubt tweet about it or comment your questions below. I will answer all of them.


Follow for more content Here [Twitter](https://twitter.com/hemansnation)



Upvote


user
Created by

Himanshu Ramchandani

Sharing words on AI | Entrepreneurship | Product Management | Statistics | Data Science & Building Artificial Intelligence powered product at HemansAI


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles