Learn About Blockchain Hashing

Hashing plays an important role behind the technology of blockchain systems

0 228

Blockchain technology in an innovative system that had a big influence in the last years and it will also impact the years to come. It’s essential to know a few things about it.

What is blockchain hashing?

we need to know first one of the core principles of blockchain creation, in order to understand how blockchain hashing works,

With simple words, hashing refers to taking an input string of any length and always giving out an output of a fixed length. In the context of Bitcoin and other digital currencies, an input is often a transaction that runs through a hashing algorithm (SHA-256 for Bitcoin) and results in an output of a fixed length.

Below it’s a simple example:

hashing

We can see that no matter the length of the input, the output will always be a fixed length (256-bits).

Of course, this plays an important role when a system is dealing with huge amounts of transactions and data. This way, instead of tracking the input data which could be huge, a system only has to remember the hash.

It’s also important to understand the cryptographic hash functions and how they get involved in the blockchain.

What is a cryptographic hash function?

A cryptographic hash function is a class of hash functions which has special properties that make it ideal for cryptography. In addition, a hash function should have some certain properties to be able to consider secure. Let’s take a quick look at them:

Properties

1: Deterministic

2: Quick Computation

3: Pre-Image Resistance

4: Small Changes In The Input Changes the Hash

5: Collision Resistant

6: Puzzle Friendly

 

Cryptographic hash functions examples

  • Keccak-256: 256-bit hash (now used by Ethereum)
  • SHA 1: 160-bit hash. It brakes collision resistance after ~2^61 hashes.
  • MD 5: 128-bit hash.  It brakes collision resistance after ~2^21 hashes
  • SHA 256: 256-bit hash. (currently being used by Bitcoin)

 

The mining process of Bitcoin

mining

Every time Bitcoin mining software is willing to add a new block to the blockchain, the following the procedure takes place. When a new block arrives, all the contents of the blocks are first hashed. In the case the hash is lesser than the difficulty target, it is added to the blockchain. After, everyone in the community can acknowledge the new block.

Although, it isn’t as simple as it sounds. If someone gets a new block like that, he has to be extremely lucky. This is exactly where the ‘nonce’ comes in.

What is the ‘nonce’?

The hash of the block has an arbitrary string which is concatenated with it. This string is called nonce. After that this concatenated string is hashed again and compared to the difficulty level. If it is not less than the difficulty level, then the nonce is changed and this keeps on repeating even a million times until the requirements are met. Only when this happens, the block is added to the blockchain.

 

Summing up:

  • The hash of the contents of the new block is taken.
  • A nonce (random string) is appended to the hash.
  • The new string is hashed again.
  • The final hash is then compared to the difficulty level and seen if it’s actually less than that or not.
  • If it isn’t, then the nonce is changed and the process repeats again.
  • If it is, then the block is added to the chain and the public ledger is updated and alerted to the addition.
  • Bitcoins are awarded to the miners who are responsible for this.

 

Meaning of hash rate

Hash rate is the speed that hashing operations are taking place during mining. A high hash rate equals to more software machines and people are taking part in the mining process. As an outcome, the system is running smoothly. The difficulty level is increased, in the case, the hash rate is too fast. Also, a slow hash rate means the difficulty level is decreased.

Anyone willing to understand what blockchain is, he should first understand the meaning of hashing, as it is the fundamental block in the creation of blockchain technology.

To learn more about blockchain technology, check previous posts on cryptona.

You might also like
Comments
Loading...