Blockchain: why do we trust it?

Mojtaba Khodami
3 min readAug 20, 2021

Blockchain is a young tech introduced by “Satoshi Nakamoto” as a decentralized, distributed and cryptographically hashed tamper-proof ledger! (Wait, what?)

Simply explained, it’s a new database architecture in which the data is cryptographically hashed and stored on various hosts also called “nodes” in the world of blockchain and cryptography. Blockchain stores data on entities called block; each block has a signature or hash which is unique and is an identicator specific to that block.

The data being a bitcoin transaction in our case is picked by the node (better say miner) and evaluated to see if data is consisted of valid transactions. Then if it’s valid, the miner will sign it (hash it) to be emitted to all other nodes present in network.

Hashes generated by bitcoin blockchain algorithm (SHA-256) are 64-digit hexadecimal numbers, highly randomized and unpredictable; meaning you can’t guess what will be the hash of a block going to be mined containing 2000 transactions, unless you calculate the hash. Neither you can’t guess the outcome of adding 1 more transaction or replacing 1 with other.

The hash generated for a specific data will always be the same and it can’t be reversed, meaning you wouldn’t know what the actual data was even if you have the hash. A phenomenon named “Avalanche effect” makes the hashes so unpredictable; meaning the hash for “hello, world” will be totally different from the hash for “Hello, world”.

sha-256 hash of “hello, world”: 09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b

sha-256 hash of “Hello, world” : 4ae7c3b6ac0beff671efa8cf57386151c06e58ca53a78d83f36107316cec125f

Try your self: https://tools.superdatascience.com/blockchain/hash/

In addition to transactions, there multiple other parameters involved in generating a hash; one them being the hash of previous block. Miner should pick a bunch of transactions and get the hash of previous mined block and begin generating as many hashes as possible until it finds a hash which is equal or less then a hexadecimal number indicated by the blockchain it self. This number is called “difficulty of network”, calculated by the blockchain based on the number of current miners (hashing power) active in the network.

Now imagine a dumb miner trying to manipulate a block in the blockchain mined 2 years ago by adding a fake transaction to the block. By doing so, the previous hash of block becomes invalid. No he mines a new hash for that block, but here comes the Avalanche effect; the hash of next block becomes invalid too, and in a chain reaction the hash of blocks mined after the manipulated block become invalid. Now let’s imagine our fool friend has mined new hash for every block, it’s now time to emit the blocks and their hashed to other nodes in the network. The blockchain has now to decide the healthy chain, and here comes the “Consensus protocol”, all other healthy nodes/miners reject the emitted chain and since the majority of nodes in the blockchain are going to reject the new manipulated chain, the process of manipulating the blockchain fails. The distribution and decentrality of blockchain avoids it to relay on one central copy of the whole network which demonstrates what is right and what is not. This is the tamper-proof nature of blockchain that gives us trust.

--

--

Mojtaba Khodami

Blockchain developer, smart-contracts engineer, React & WP developer, medical student =)