Digital signatures play a central role in the security of cryptocurrencies. Here we explain their role in authentication and how cryptography shaped cryptocurrency.
What is a Digital Signature?
If somebody wants to prove that a message was created by him, he can create a digital signature on the message so that others can verify it.
Digital signature schemes typically use asymmetric cryptosystems (such as RSA or ECC) and hash functions. Check this article on cryptography if you want a low-down on these terms.
Digital signatures are widely used today in the business and financial industry, e.g. for authorising bank payments, exchanging signed electronic documents, signing transactions in the public blockchain systems, signing digital contracts, and in many other scenarios.
How Digital Signatures Work
Let’s use the underground love between Alice and Bob again – our favourite crypto couple featuring in many of our articles.
Alice finally wants to break up with Bob since she cannot tolerate their secret love anymore. She has written the message ‘Let’s break up’ (which translated into ‘9394’ in the ‘Nerd Planet’). She’s afraid that Bob may think that the message is not truly from her (maybe Bob’s wife discovered their relationship and stole Alice’s account to write the message). Therefore she would like to attach the message together with a digital signature and send it to Bob so that Bob would believe that the message is coming from her.
Using the example above, we hope the reader can understand what digital signatures are used for and why they can ensure a message is truly coming from the message sender. Digital signatures cleverly combine symmetric and asymmetric cryptography with hash functions, and the invention has enabled a wide range of applications that require secure communication and identity verification.
Cryptography Usage in Cryptocurrencies
Cryptocurrencies are called ‘crypto’ because they use cryptography. In this section, using bitcoin as an example, we look at how this works.
How do bitcoin transactions work?
We have a 101 on how bitcoin and its transactions work. Here we go further to see what happens inside of transactions to understand the cryptography usage in bitcoin.
Output in a transaction contains two fields:
1) a value field for the transferring amount of satoshis
2) a pubkey script for indicating what conditions must be fulfilled for those satoshis to be further spent
The figures below help illustrate Alice’s workflow to send Bob a transaction that Bob later uses to spend that transaction. Both Alice and Bob will use the most common form of the standard Pay-To-Public-Key-Hash (P2PKH) transaction type. P2PKH lets Alice spend satoshis to a typical Bitcoin address and then lets Bob further spend those satoshis using a simple cryptographic key pair.
Later, Bob decides to spend the UTXO from Alice:
Bitcoin mining and proof-of-work to verify transactions
Bitcoins are created through mining. When a transaction is created, it’s marked as ‘unconfirmed’. Miners collect a set of unconfirmed transactions and try to create a block that contains transactions. To create a block in the blockchain, the miner needs to solve a complex cryptographic problem of which the input is the block and the solution is a sequence of numbers inside the block, called the nonce. This process of finding the nonce is called bitcoin mining and is a competitive process involving many miners worldwide.
There are many fixed parameters for the block in bitcoin, such as the previous block hash, the characteristics of transactions in the current block, etc. There is only one parameter that can be changed, called the nonce. The miner’s job is to find the nonce that can make the candidate block satisfying the difficulty target. The only way to find the nonce is to try different possible values for the nonce, calculate the hash of the new block (last block hash id | block with transactions | nonce, where ‘|’ means concatenate), and check if the hash satisfies the difficulty target (get a string that has a certain number of zeros in front of it).
The task of the miner is as follows:
Bitcoin’s proof-of-work uses two successive SHA-256 hashes and originally required at least the first 32 of 256 hash bits to be zero. However, the bitcoin network periodically resets the difficulty level to keep the average rate of block creation at 10 minutes.
Putting the Crypto in Cryptocurrency
We hope that now you have a clear understanding of how digital signatures work as part of cryptography and, of course, why crypto is called ‘crypto’! From its deeply woven and carefully developed security systems to its ability to ensure that recipients can trust the system, cryptography is an incredibly fascinating, malleable – in use, not security – and futuristic system with so many possibilities for advancement. Bitcoin is just the beginning.
If you want to deep dive into the topic of cryptography, also give our article on that a read. There we take a look at the evolution of cryptography, how it works, its strong security systems, and touch on its potential uses.
1. Alrammahi, M & Kaur, H. (2014). Development of Advanced Encryption Standard (AES) Cryptography Algorithm for Wi-Fi Security Protocol. 10.13140/RG.2.2.20993.97124.
2. Symmetric ciphers (n.d.). Retrieved from http://www.crypto-it.net/eng/symmetric/index.html
3. Menezes, A. J., C., V. O. P., & Vanstone, S. A. (2001). Stream Ciphers. In Handbook of applied cryptography (pp.191- 216). Boca Raton: CRC Press.
4. Symmetric ciphers (n.d), Retrieved from http://www.crypto-it.net/eng/symmetric/index.html
5. Kessler G.C (Nov 2019), An Overview of Cryptography. Retrieved from https://www.garykessler.net/library/crypto.html#types
6. Lane Wagner (Jun 2018). (Very) Basic Elliptic Curve Cryptography. Retrieved from https://blog.goodaudience.com/very-basic-elliptic-curve-cryptography-16c4f6c349ed
7. Cryptography Hash functions (n.d.) Retrieved from https://www.tutorialspoint.com/cryptography/cryptography_hash_functions.htm