A Primer on Digital Signatures in Cryptocurrency
Digital signatures play a central role in the security of cryptocurrencies. Here we explain their role in authentication and how cryptography has shaped cryptocurrency.
Key Takeaways:
- Digital signatures are widely used in the business and financial industries for authorising bank payments, exchanging signed electronic documents, and signing digital contracts, amongst other scenarios.
- These signatures cleverly combine symmetric and asymmetric cryptography with hash functions.
- The invention of digital signatures has enabled a wide range of applications that require secure communication and identity verification.
- With the use of cryptography, digital signatures are used to confirm that a message is truly coming from the message sender it indicates.
What Is a Digital Signature?
If someone wants to prove that a message is from them, they create a digital signature on the message so others can verify it.
Digital signature schemes typically involve asymmetric cryptosystems and hash functions. They are widely used today in the business and financial industries, such as for authorising bank payments, exchanging signed electronic documents, signing digital contracts and transactions in the public blockchain systems, and many other scenarios.
Read our article on cryptography for a lowdown on these terms and more.
How Digital Signatures Work
Digital signatures are used to confirm that a message is truly coming from the message sender it indicates. They cleverly combine symmetric and asymmetric cryptography with hash functions, an invention that has better enabled a wide range of applications that require secure communication and identity verification.
As an example, we’ll use Alice and Bob. Alice has written the message “Let’s catch up” to Bob (which, in this scenario, translates to ‘9394’). She’s afraid that Bob may not think the message is truly from her and would like to attach a digital signature so Bob can confirm the message is coming from her.
Step 1: Alice wrote the message ‘9394’.
Step 2: Alice hashed the message ‘9394’, which became ‘9’.
Step 3: Alice used the private key (11, 14) to encrypt the hash value ‘9’; the cipher = 11.
Step 4: Alice published the message together with the signature.
Step 5: Bob saw the message but wondered if it was truly from Alice and wanted to verify the digital signature.
Step 6: Bob decrypted the digital signature ’11’ using the public key (5, 14); the plaintext = 9.
Step 7: Bob hashed the message ‘9394’ using the same hash function that Alice used and got the same value ‘9’.
Step 8: Since both the decryption of the digital signature and the hash value of the message had the same value, Bob knew the message was from Alice.
Cryptography Usage in Cryptocurrencies
Cryptocurrencies are called ‘crypto’ because they use cryptography. In this section, we use Bitcoin as an example in our look at what this means and how it works. See our 101 on how Bitcoin transactions work.
Below, we go further to see what happens inside transactions to understand the cryptography usage in Bitcoin. Output in a transaction contains two fields:
1. A value field for transferring an amount of satoshis.
2. A pubkey script for indicating what conditions must be fulfilled for those satoshis to be further spent.
The steps below help illustrate Alice’s workflow to send Bob a transaction that he later uses to spend. Both Alice and Bob use the most common form of the standard pay-to-pubkey-hash (P2PKH) transaction type. P2PKH lets Alice send satoshis to a typical Bitcoin address, and then lets Bob further spend those satoshis using a simple cryptographic key pair.
Step 1: Bob must first generate a private/public key pair before Alice can create the first transaction. Bitcoin uses the Elliptic Curve Digital Signature Algorithm (ECDSA) to generate the public/private key pair.
Step 2: The public key (pubkey) is then cryptographically hashed using hash functions SHA-256 and RIPEMD-160.
Step 3: Bob provides the pubkey hash to Alice, which is usually sent encoded as a Bitcoin address (Base58-encoded strings containing an address version number, the hash, and an error-detection checksum to catch typos). The address can be transmitted through any medium and further encoded into another format, such as a QR code.
Step 4: Once Alice obtains Bob’s address and decodes it back into a standard hash, she can create the first transaction using a standard P2PKH transaction output containing instructions allowing anyone to spend that output if they can prove they control the private key corresponding to Bob’s hashed public key.
Step 5: Alice broadcasts the transaction and it is added to the blockchain. The network categorises it as an unspent transaction output (UTXO), and Bob’s wallet software displays it as a spendable balance.
Later, Bob decides to spend the UTXO from Alice:
Step 1: Bob must create an input referencing the transaction Alice created by its hash — a Transaction Identifier (TXID) — and the specific output she used by its index number (output index).
Step 2: Bob must then create a signature script (also called scriptSigs) — a collection of data parameters satisfying the conditions Alice placed in the previous output’s pubkey script. For a P2PKH-style output, Bob’s signature script will contain the following two pieces of data:
- His full (unhashed) public key so that the pubkey script can check that it hashes to the same value as the pubkey hash provided by Alice.
- A signature made by using an ECDSA cryptographic formula to combine certain transaction data with Bob’s private key. This lets the pubkey script verify that Bob owns the private key that created the public key.
Conclusion
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 and malleable futuristic system with so many possibilities for advancement. The invention of digital signatures has led to greater use in the business and financial industries, better enabling a wide range of applications that require secure communication and identity verification.
Digital signatures cleverly combine symmetric and asymmetric cryptography with hash functions, and with this use of cryptography, they have become relied upon to confirm that a message truly is coming from the message sender it indicates.
Read our deep dive into the topic of cryptography, where we take a look at its evolution and strong security systems, plus how it works and its potential uses.
Due Diligence and Do Your Own Research
All examples listed in this article are for informational purposes only. You should not construe any such information or other material as legal, tax, investment, financial, cybersecurity, or other advice. Nothing contained herein shall constitute a solicitation, recommendation, endorsement, or offer by Crypto.com to invest, buy, or sell any coins, tokens, or other crypto assets. Returns on the buying and selling of crypto assets may be subject to tax, including capital gains tax, in your jurisdiction.
Past performance is not a guarantee or predictor of future performance. The value of crypto assets can increase or decrease, and you could lose all or a substantial amount of your purchase price. When assessing a crypto asset, it’s essential for you to do your research and due diligence to make the best possible judgement, as any purchases shall be your sole responsibility.
Share with Friends
Ready to start your crypto journey?
Get your step-by-step guide to setting up
an account with Crypto.com
By clicking the Submit button you acknowledge having read the Privacy Notice of Crypto.com where we explain how we use and protect your personal data.