An image showing the diverse nature of crypto and all we can handle with it.

Cryptographic & Consensus Algorithms

The blockchain technology and advancements of cryptocurrencies and its implementation are in the technical spotlight nowadays and attract a lot of attention. With that attention, however, comes a lot of buzzwords – decentralization, peer to peer, mining, algorithms, distributed ledgers, cryptography and so many more. In this article we will try to shed light on one of those buzzwords – algorithms. 

What is a Cryptographic Algorithm?

Cryptographic algorithms are what brings the crypto into cryptocurrency. Those algorithms are used when encrypting and decrypting your private address to a public address. An important aspect of those algorithms is its non-reversibility. Having your private address as input by applying the cryptographic algorithm you can easily get your public address as output, but doing the calculation in the reverse order, having the public address and applying the algorithm to get to the private address is an impossible task that will take many years to compute. Cryptographic algorithms are also what controls the difficulty of the blockchain by making it harder or easier to reach a consensus on the network. Cryptographic algorithms are made up of one, two or more hashing functions. Let’s now look at what a hashing function is.

How to sign into a Cryptocurrency Exchange?

In the simplest terms, an algorithm is a set of rules or steps to be followed when approaching a problem-solving task. It is important to clear out from the beginning, there are two types of algorithms – both simply referred to as algorithms where the confusion comes from – cryptographic algorithms and consensus algorithms. Both types serve a crucial function in the blockchain, but both are two very different things.

Two info graphics showing the ability to use either the same of different keys to encrypt data.

What are Consensus Algorithms?

Consensus algorithms are in the core of cryptocurrencies and allow the network to remain decentralized but at the same time continue to be fair. There are several consensus algorithms out there, all serving different purposes and most importantly having different criteria by which they decide how to reach a consensus. The two most common and widely used ones in crypto are proof of work (the algorithm used in bitcoin network where it all started) which reaches an agreement based on who has done the most “work” – meaning solved a mathematical problem the quickest; and proof of stake which reaches an agreement based on who has the most in stake in the blockchain. By now, you might be asking yourself, but why do we need algorithms at all. The two following paragraphs will answer that question.

Comparison of Consensus Algorithms

Ironically enough, there still isn’t consensus on which is the best algorithm to reach a consensus in a blockchain. With so many ways to go about it from PoW, DPoS, Proof of Weight, Proof of Authority, Directed Acyclic Graphs there seems to be so many algorithms to reach an agreement in a decentralized network, we should ask the question good for what, or bad for what. It seems depending on the goal, stakeholders and roadmap of a network the terms good or bad are interchangeable and what was not good enough 6 months ago, is now the best option for this blockchain and situation.

Algorithm Developed by Consensus PoW coins ASIC AMD GPU NVIDIA GPU INTEL CPU AMD CPU
Sha – 256 National Security Agency POW BTC, BCH ASIC miner 8 Nano Pro  N/A N/A N/A N/A
Ethash Vitalik Buterin PoA, PoSpac, PoS, PoW ETH,ETC Innosilicon
A10 ETHMaster
RX VEGA 64 RTX 2080 Ti Can’t load DAG Can’t load DAG
Scrypt Colin Percival POW LTC,NLG Innosilicon A6 LTCMaster N/A N/A N/A N/A
CryotoNight v8 Monero team POW XMR Asic – resistant RX VEGA 64 RTX 2080 Ti Xeon E7-8870 v3 Threadripper 2990WX
x11 Evan Duffield POW DASH Spondoolies SPx36 N/A N/A N/A N/A
Equihash Alex Biryukov & Dmitry Khovratovic POW Zcash Spondoolies SPx36 RX VEGA 64
(515 Sol/s)
RTX 2080 Ti N/A N/A
Blacke256 R14 J-P Aumasson & Luca Henzen & Willi Meier POW Decred MicroBT Whatsminer D1 N/A N/A N/A N/A
Blake2b NebulousINC POW SIA StrongU STU-U2 N/A N/A N/A N/A

FAQ

  • What is hashing function?

    An info graphic explaining what a hashing function is and how does it work.

    Hashing functions are mathematical functions that take any type of data for input value, regardless what it is – letters, numbers, files and from that input derives and returns a specific output. For example, the hashing function md5 will return a 32-character output, regardless of what the input is. If you write up md5 (“hello user”) the function will return a 32-character output. In cryptocurrency, hashing functions are combined into a cryptographic algorithm. Two good example here are Bitcoin’s SHA-256 cryptographic algorithms which is only comprised of one hashing function SHA-256, giving the name of the algorithm and DASH’s X11 cryptographic algorithm, which is comprised of … you guessed it … 11 cryptographic hashing functions, with blake, bmw, groestl, keccak being some of those 11 functions.

  • What is The Byzantine Fault Tolerance (BFT) and The Byzantine Generals’ Problem?

    A common problem in blockchain and decentralized networks is something people refer to as The Byzantine Generals’ Problem. Imagine a situation where we have a group of byzantine generals standing in front of a city, deciding whether to attack it or not. Each general commands an army battalion and the generals must reach a consensus on what the action plan is going to be – all attack or all retreat by communicating through messengers. Things are complicated even more, when we introduce the notion some generals are treasonous and want to sabotage the consensus and some messengers – intentionally or unintentionally – also may sabotage the consensus. To solve this problem and pertain consensus at least two-thirds + 1 of the generals should be loyal to keep the consensus amongst everyone. Back to blockchain world – to say a system possesses The Byzantine Fault Tolerance means a system can function properly in the event of failure or disparity of information and remain in consensus.

  • What is a double-spent problem?

    If we look at the times, where gold was used as a form of currency, if you wanted more gold you needed to go and mine it from the mountains, and even if you did, it might not result in finding gold – a good natural way to control currency circulation and worth in the economy. Fast forward several hundred years in the digital world, where even currencies are digital. The problem here is, there is no mechanism to control currency circulation, meaning, unlike with gold where you couldn’t go to your friend and copy his gold, with digital currency you absolutely could just copy a file, folder or anything digital in a matter of seconds, hence resulting in a double-spent problem. This is where the algorithms described in the previous section come to the rescue, to help us artificially control the currency circulation and allows us to have a unified way of reaching an agreement. On proof of work networks for example, the complexity of the mathematical problem is adjusted every X number of blocks, to make sure there is an artificial control over the money supply and participants in the network aren’t simply copy and pasting new money into circulation.

.