Hashing Approaches Described In Original Bitcoin Paper
Since basic details and functions of Bitcoin were proposed in 2009, the network is constantly evolving with the help of crypto enthusiasts and developers. Many different system improvements have been proposed over the past several years. Some of them were taken as they were, others were amended and applied in proper time, yet others are still at the planning stage or rejected.
Regardless of the technological variety used in the Bitcoin project, there are many parts of original protocol kept unchanged. One of them is hashing approaches used in different parts of the protocol. Let’s have a look on them.
Hashing In Bitcoin
As it was stated in Satoshi Nakamoto’s article of 2009, hashing is used for several reasons. First of all, it is reliable and secure. Indeed, due to hashing internal properties it is impossible (or close to impossible) to reverse hashing data and convert it to initial input data. Second, it is space-saving. Since the block size is stable at 1 Mb level, each bit matters. Such a requirement demands data compression or pruning. The last point is about uniqueness. A hash value is unique enough to support many addresses needed to transfer crypto funds. All these properties together support the required level of reliability.
Let’s consider all proposed hashing described in the original Bitcoin paper.
Hashing is used for addressing a transaction as it is mentioned in the “Transaction” section. Transaction has a complex structure with many components that might be presented in different ways. After hashing all those data, we get 256 bits of hash used as an address. In fact, transaction data is hashed twice for security reasons. This hash result is also referred as TxID (transaction identifier). To use transferred funds, we have to know the TxID and be able to unlock it.
In the “Timestamp Server” section, hashing is described as a tool used to unite blocks in the chain. According to the paper, this system allows tracing data and proving its existence. Each new block has its own calculated hash which gets added to the next new block as a standard component. This means that all blocks contain hashes of previous blocks. This approach is simple yet efficient because nobody can change a block content without changing its hash. These actions are clearly traceable.
Proof Of Work
A consensus approach called Proof-of-Work is also based on hashing. It is legacy consensus method proposed by Nakamoto. It directly refers to Adam Back's Hashcash method used for e-mail protection and DoS attacks prevention. PoW requires participants to calculate hashes of the blocks they want to add to the network. If a calculated hash has a necessary number of leading zeros, the block is considered as valid and must be accepted by all other participants. Since hashing is deterministic, the same input gives the same output. Still, it is unpredictable enough to be recalculated with a single bit change and a completely changed result. A special counter named “nonce” is used here.
This process of searching for a correct hash is called mining.
The last but not the least hashing technology used in Bitcoin is called the Merkle Tree. This is a structure of hashes that looks like a pyramid. A single hash is received as TxID. All TxIDs are taken in pairs. Each pair of hashes gets its own calculated hash. After that, all results pair up again, and the process repeats. If a hash has no pair, it is taken twice.
This approach is used for the SPV (simple payment verification) method. Some nodes wouldn’t like to store the whole blockchain. They download block headers with the Merkle Tree inside. Then, in order to verify a transaction, all they need is to check hashes. Thus, the work of lightweight nodes gets much simpler.
The original Satoshi Nakamoto’s article devoted to Bitcoin contains all main hashing details that are used to this very day. This underlines the beauty of the initial proposal as a technical solution. Many other crypto projects use hashing as well, and some of them have their own developments. We will talk about them later.