The first thing that comes to mind when you hear the word “hash” is probably one of two things. First would undoubtedly be hash browns. The glorious melding of potatoes, butter, and spices in a skillet to produce a crunchy, savory treat. Or, having a purposeful discussion with someone. Hashing out some problems. Although, did you know that there’s another prolific use for hashing as well called cryptographic hashing?

Bitcoin Hashing

Before we dive in, let’s quickly recap where we’ve been on our journey of investigating Bitcoin’s relationship with cryptography. We discussed a brief history of cryptography and laid out three fundamental branches: symmetric-key cryptography, asymmetric-key (or “public-key”) cryptography, and hashing. We discussed the role of keys, their importance in Bitcoin transactions, and where they fit into the overall scheme of the blockchain. In this post, we’re going to take a look at hashing, a branch of cryptography involving one-way functions, and why they are necessary in maintaining Bitcoin’s overall infrastructure from a logical perspective.

Hashing Properties

First off, what is cryptographic hashing in the first place? A robust hash has four properties:

  1. quick (or efficient) to compute.
  2. essentially impossible to find two different messages that produce the same output.
  3. It is practically impossible to find any identifying characteristics from the original message.
  4. The hash of an input looks like a completely random output.

We don’t need to spend much more time on these other than to say that each of these forms an important part of defining a secure hash. So we know a few things about hashes; what exactly is a hash? A hashing algorithm produces a fixed-length, random output (called a “hash”) from an arbitrary-length message. Not only that, but the output makes it essentially impossible to recompute the original message – this is why hashes are sometimes referred to as “one-way” functions.

Statistically irrelevant

(A quick aside: you might be wondering why we’re using the term “essentially impossible”. In the realm of computational cryptography, there are always ways to eventually get a key – it might take you a billion years, but the possibility exists. That’s why we’re talking about something that is right next to impossible but not quite 100% impossible. Alright, back to the action.)

Types of Hashes

One more thing to discuss – types of hashes. There are a large number of hash types available to use, but we’ll stick to the top two families of hashing algorithms – Message Digest (MDx) and Secure Hash Algorithms (SHA-x). The MD family of hashes began in the 1980’s and has been through several iterations (MD2, MD4, MD5, and MD6). These hashing algorithms are not trusted anymore due to their inherent weaknesses.

SHA algorithms began their development in the 1990’s. These are referred to as SHA-0, SHA-1, SHA-2, and SHA-3. Each of the algorithms got progressively stronger and used progressively longer key lengths. SHA algorithms are the gold standard in industry – most hashes that you will see in any cryptographic operation nowadays are going to use SHA. Bitcoin specifically uses the SHA-2 algorithm with a 256-bit hash length. This means that any output that comes from an operation involving hashing in Bitcoin will be 256 bits long (although you’ll typically see this as a hexadecimal number that’s 64 digits long. Hexadecimal numbers use the digits 0-9 and the letters A-F).

How Does Bitcoin use Hashing

Now that we’ve laid the groundwork, let’s talk specifics. Bitcoin uses cryptographic hashing in two different places: transactions and providing a proof-of-work. Let’s discuss transactions first.

Trying to explain this part of hashing is difficult without a diagram, so feast your eyes upon the figure below.

Cryptographic Hashing

Starting at transaction two, the current owner digitally signs a hash of transaction 1 plus the new owner’s public key. The first owner’s public key can be used to verify that the signature is valid – meaning that anyone can at any time validate the chain of transactions to ensure that everything is valid. By combining the previous transaction with the new owner’s public key, the resulting hash makes it essentially impossible to deny the new owner of his bitcoin. This aids in preventing fraud and ensures that malicious attackers can’t pilfer coins that rightfully belong to another owner by crafting hashes or public/private key pairs. When the new owner decides to spend this bitcoin, the process starts anew and continues in this deterministic and verifiable path.

Proof of Work Algorithm

We mentioned that Bitcoin also uses hashing in delivering proof-of-work. Bitcoin uses an algorithm known as “hashcash” to present a proof-of-work to other nodes on the network. Essentially, a “block” in the block chain is a collection of transactions that needs to be verified as legitimate. Each transaction isn’t verified in this process, only the block is, so block verification will take the same amount of time regardless of the total number of transactions in the block. Any node attempting to verify a block receives a “target” number. All Bitcoin nodes share this target number and attempt to provide a SHA-256 hash of a block’s header that is less than or equal to the current target number. Over time, the target decreases, increasing the difficulty of generating a new block.

Remember how we mentioned that a hash produces a random output number? This means that any node attempting to provide a hash less than the target number has to attempt millions and millions of hashes before stumbling upon a hash that is less than the target. The first one to verify a block and publish it to the network wins!

Hashing Information

In this post, we were only able to briefly touch on the uses of cryptographic hashing in Bitcoin, but hopefully it was informative and useful for you. Want to do some more reading? Check out these links:

  • It all comes back to the original Bitcoin whitepaper
  • Here’s some more details related to hashes in a Bitcoin context
  • An interesting chart showing the Bitcoin network’s hashing rate
  • This article breaks down hashing in a very understandable format

Anyone who has not been living under a rock for the past three years is familiar with the word “Bitcoin” or “Ethereum”. However, not many people know how Bitcoin works. Why is Cryptocurrency Important? In short, currencies like Bitcoin and Ethereum are decentralized currencies aimed at facilitating global online transactions propelling the world into the 21st century.

Why Do We Need Decentralized Currencies?

To put it simply, there are multiple problems with fiat currency that make crypto a viable option. Two reasons are online fraud and centralized agendas. Online fraud is a huge issue and crypto can add clarity and resolve to the online payment system. While the centralized agenda of governments and banks tend to always turn out bad for the general population. Over time, the printing of money and over leveraging of assets can be disastrous. This needs to be fixed in order to avoid another economic collapse. Let’s dig into each topic more.

Online Fraud

Traditional centralized currencies are seeming more outdated as executing online transactions is difficult and costly with them. In addition, all traditional online methods are reversible due to the centralized nature of banking. With the buyer’s bank acting as a mediator between the buyer and seller, a buyer can dispute the payment and get the money they paid back into their account without the seller’s approval.

Though this is a feature aimed to increase buying security, malicious parties can use this practice to commit fraud. A fraudulent buyer can pay for your services online, but once you provide the services, dispute the payment and get their bank to reverse the payment. This complicates online transactions by breaking trust between buyers and sellers. This is especially difficult since online buyers are almost always anonymous. To ensure secure transactions today, a merchant needs to hassle their potential customers for more personal information.

Centralized Agenda

Although, the real problem lies not in the buyers, but in the banks enabling this. Additionally, the ability to control someone’s wealth leaves the banks with a lot of responsibility. Over time, the general population has learned that banks do not always control customer’s wealth as fiduciaries. For instance, in 2008 the entire global economy collapsed due to banks over leveraging their assets. Couple this with the excessive printing of money to bail the banks out by the government, the entire financial system is set for failure.

To counter these problems, an anonymous person (or group of persons) with the pseudonym of Satoshi Nakamoto pioneered decentralized cryptocurrencies. These currencies base their payment system on cryptographic proofs, instead of trust. With no third party serving as a mediator, transactions made through crypto-currencies are permanent and irreversible. When you click the ‘pay’ button in your crypto wallet, the money is permanently gone from your metaphorical account.

How Decentralized Currencies Work

Entirely removing the third party (Banks) in online transactions is not as simple as it seems. As there is no one to witness the exchange of currency, no one can know who still should have the money and who should not. Look at it this way; if you make multiple copies of your currency file and use them to pay different people, you could spend the same amount of money multiple times. This practice is known as double-spending and it inflates the currency enormously and makes it unfeasible for use.

To make decentralized currencies work, there needed to exist a secure public record to ensure that no one could execute the problem of double-spending.

This is exactly what Satoshi Nakamoto did when he invented blockchain technology for the world’s first crypto-currency, Bitcoin. Bitcoin’s blockchain technology stored information regarding Bitcoins in circulation and all past transactions in a publicly distributed ledger. Everyone with a crypto wallet has an accurate and encrypted copy of this ledger. Whenever someone attempts to make a Bitcoin transaction, the process ensures the legitimacy of the transactions by checking all copies of the ledger online. If the majority of the ledger copies give the go-ahead, the transaction goes through. All of the online ledgers copy records of this transaction in an encrypted format to prevent double-spending.

The Benefits of Decentralized Crypto-currencies

Apart from permanent and non-reversible payments,

By cutting out the banks serving as middlemen, decentralized crypto-currencies offer a host of benefits to its vastly increasing user base:

  • Online Anonymity: Anyone with a crypto-wallet can exchange crypto-currencies online easily and anonymously.
  • Freedom from national monetary policies: These policies do not apply to decentralized cryptocurrencies, which means you can use them as a stabilized currency if your country’s currency is destabilized.
  • Instantaneous and cheap international payments: When using traditional banking, you have to wait for a period of time before the money shows up in your account. Or you can pay extra for quicker delivery when transferring money internationally. Cryptocurrencies offers a viable alternative to traditional banking for cheap and instantaneous international payments.
  • Freedom from strict bank policies and exorbitant banking fees: With no central body regulating the payment methods, you do not have to adhere to strict bank policies or pay exorbitant fees for banking services.
  • Protection against bank failures and collapses: With no bank behind cryptocurrency technology, you do not have to worry about bank failures making you lose all your money.
  • Immunity from inflation or deflation: The blockchain technology controls the amount of currency in rotation, so it does not experience inflation or deflation.

A New Era of Crypto-currencies

By pioneering blockchain technology, Mr. Satoshi Nakamoto was able to circumvent the need for a trusted third party to verify online transactions and bring about a revolution. Bitcoin lead the world into creating a entirely new industry by enabling solutions to a multitude of problems.

Soon after Bitcoin proved its worth, many other crypto-currencies sprang up, following the same blockchain method for decentralized and encrypted payment methods. One of the first crypt-currencies to follow in Bitcoin’s footsteps was Ethereum.

Ethereum

Although Ethereum utilizes the same blockchain technology used for Bitcoin, the two are quite different. Ethereum’s coin value, called “Ether,” utilizes blockchain in both the payment method and in the form of “smart contracts” that companies can use to automate tasks, whereas Bitcoin only uses blockchain for the former and leaves out the latter.

What’s exciting about this is that there is heavy support backing Ethereum’s advanced blockchain technology, in the form of The Enterprise Ethereum Alliance. This is a group of Fortune 500 companies using Ethereum’s technology to power smart contracts between themselves to automate immensely complex applications. Some companies are leveraging Ethereum’s blockchain technology to create decentralized apps (dapps) that run without any downtime, fraud, or control from a third party. Some have even gone as far as to develop smart tags for luxury goods that guarantee their authenticity!

There are further technical differences between Ether and Bitcoin. For example, you might find executable code in the transactions of Ethereum ledgers, while you can only find data affixed to Bitcoin transactions as personal notes.

Other differences are in the block time – the amount of time it takes each service to confirm transactions. While you can expect to wait minutes for your transactions to register in the Bitcoin ledgers, this is a matter of mere seconds when it comes to Ether.

Another major difference lies in the different algorithms that each of them run on. Ethereum uses ethash, while Bitcoin uses the more dominant SHA-256 for encryption.

Main Differences Between Bitcoin and Ethereum

Most importantly, however, is the difference in the aim behind these two technologies. As this article aptly summed up, “Where Bitcoin is disrupting currency, Ethereum is disrupting equity.” Furthermore, Ethereum is leading the industry to solving new and complex problems that Bitcoin neglected to address at all. Specifically, Ethereum aims to provide an application solutions for smart contracts as mentioned above.

In addition, Ethereum is hoping to enable staking which will reward miners long-term even past the final Bitcoin is mined. In summary, Ethereum is an entirely new age of crypto ever though it came out only a few years after Bitcoin’s first transaction.