It is common knowledge that Blockchain and Distributed Ledger Technologies (DLT) are secured by cryptography.
However, what does this mean? How does this work?
In this article, I introduce the core cryptographic concepts integrated into blockchain technologies.
Firstly, what is cryptography?
Cryptography is part of daily routines, whether you are aware of it or not. It is used to secure information that is exchanged on a network of computers or connected devices. For example, every time that you log into your Gmail account. Or send a WhatsApp message, your communication is secured and kept private between you and your correspondent using cryptographic schemes.
In distributed systems, where there is no one central authority controlling the flow of information, cryptography becomes all the more important as it allows good users to transact information securely and prevents bad actors manipulating or cheating the system.
Over the course of these articles we will discuss several different types of cryptographic primitives, namely:
- Hashing functions
- Elliptic Curve Cryptography (ECC)
- Zero-knowledge proofs
Hashing algorithms are one-way functions, meaning that they are straightforward to perform in one direction but impossible to compute in reverse. They have many uses within blockchain and DLT technologies, including linking of blocks and forming compressed data structures.
The linking of each block in the blockchain through the use of a hashing function output (hash) allows the formation of an immutable series of events, allowing the traceability of the movements of assets from one block to the next while knowing the chronological order in which they occurred.
Because there is a significant amount of data transacted on DLTs and there is no central datacentre to hold this information, compressed structures of this data are necessary otherwise to run a node on the network would require an extraordinarily large amount of storage space.
Thereby, hashing functions can be used to generate compressed data structures like Merkle trees to store information within the block.
They are also utilised in the Proof of Work algorithm, which is for a majority of blockchains the network management engine, i.e. how nodes on the network gain consensus for the state for a given set of processed transactions.
When an object is hashed a digest or output is returned that is of fixed length. No matter the size of the input, you will always get the same size output.
Furthermore, when hashing the same input, the same digest will be returned with the same hashing mechanism. Hashing functions are also collision-resistant meaning that there is no discernible pattern between two different digests of two different inputs.
Elliptic Curve Cryptography
Elliptic curves are used to create encryption schemes. They are defined over a special field and are >non-continuous curves: they are formed of a finite set of points. Elliptic curve cryptography forms the basis of the decentralised trust when sending and receiving transactions. Indeed, it is used to generate transaction signatures which similarly to physical signatures can prove a user’s authority to participate in a transaction.
Within a decentralised environment where there is no central authority to control and ensure transaction validity every transaction broadcast to the network must contain a valid signature.
These signatures must be able to prove that a user and only that user has declared the transaction. Such signature relies on qasymmetric encryption where a user has one or multiple public/private key pairs.
Signature schemes are formed of a problem that is trivially calculated only if the user has both the public and private key pairing but can be verified to be a fair signature by any other user with access to the public key.
Through the use of Elliptic curve-based signature schemes, a user can verifiably prove that they, in fact, own the funds that they are declaring a transaction for. This allows the sending and receiving of transactions without the requirement for a central authority. Elliptic curves are chosen over other signature schemes like RSA due to the small key sizes; this is done to reduce the size of information that is held on the network.
Many blockchain technologies only support public transactions; this means that the amount that is transacted is visible to all and a user’s identity is only secured through pseudonymisation.
While this is not a point of failure it can be seen as a weakness as the user’s anonymity is not fully protected.
Through the use of techniques like chain analysis complete transaction histories for users can be created.
More recently, different techniques for obfuscation of transaction amounts have been discussed and implemented into blockchains.
Zero-knowledge proof protocols include commitment schemes and range proofs that allow a user to hide any transacted amount on the blockchain and thereby obfuscating their account balance.
They allow a user to demonstrate proof that they hold information or prove a fact about the information without the need to reveal said information.
An example of which is that they can prove that two values are equal to each other without the need to reveal that amount. Their integration into DLT’s allows cryptographically secured anonymity for transactions that are broadcast.