What’s a digital signature?
When you want to send some bitcoins, your wallet creates a “transaction” and sends it to a node on the Bitcoin network which then broadcasts it to other nodes.
When you initiate a Bitcoin transaction, you must prove to every node in the Bitcoin network that you are authorized to spend those funds.
What is a Bitcoin transaction?
A transaction is just a message that contains information about the sender and recipient and the amount of BTC to be transferred (including a transaction fee).
So before sending out the message (the “transaction”), you’re required to “sign” it. All transactions need to be “signed” before they are submitted to the network.
To do so, your wallet software does some fancy math magic to the transaction message and then after that, does some more fancy math magic with something known as a “private key”.
The result of all this math magic is a special piece of information called the “digital signature”.
It is this “digital signature” that proves to the Bitcoin network that you are the true owner of the bitcoins that you wish to send.
When talking about the “signing” of transactions or “digital signatures”, mainstream financial media usually will usually stop right here.
But this explanation doesn’t really tell us much. What is all this vague “math magic” all about?!
What exactly does “signing” a transaction mean? What does one mean by “signatures” or “digital signatures”
Given that digital signatures are such a crucial component in cryptocurrencies, we need to learn what a digital signature actually is, why they’re needed, and how it actually works!
What is a digital signature?
Bitcoin uses public-key cryptography to create a “key pair” (a pair of keys) that controls access to bitcoins.
The key pair consists of a private key and a public key.
- The private key generates a public key.
- The two keys are mathematically linked and are actually just very large numbers.
- The public key then generates an address that is shared with others so you can receive bitcoin and is represented as a string of letters and numbers.
If you’re not familiar with the concepts of “private key” and “public key”, this means that you jumped too far ahead in the School of Crypto and didn’t complete the courses in order! You need to go back and read this lesson first! 😑
So when you say you “have some bitcoin”, what you’re really saying is that:
- There are bitcoins tied to a specific address.
- And this address and the amount of bitcoins it holds are recorded on Bitcoin’s ledger known as the blockchain.
- You have a private key that mathematically proves that you are the owner of this address.
- This means that any bitcoins that are held in this address are under your control.
- And only you can “move” or send these bitcoins to a different address.
If you don’t have the private key to the new address, then you are no longer in control of the bitcoins. You have sent them to a new owner (whoever has the private key linked to the new address.)
As you can see, ownership of bitcoins is tied to an address.
And the number of bitcoins tied to ALL addresses is recorded on Bitcoin’s blockchain.
So if you want to send bitcoins to a different address, you have to first prove that you are the actual owner of the CURRENT address holding the bitcoins.
So how is this done?
Remember that an address is just a modified representation of a public key.
And a public key is created from a specific private key.
This means that each address relates to a public key, which also relates to a private key.
The public key, which is represented in a more readable format known as the address, can be thought of as the “identity” of the owner.
This means that your public key (shown as an address) acts as your “identity” on Bitcoin’s blockchain.
And the private key can be thought of as a piece of information that allows the owner to prove their ownership of the public key.
So one simple way to prove that you’re the owner of an address (and public key) is to provide your private key as part of the transaction message.Then using fancy math magic, anyone could easily see that the private key created the public key which created the address.
But doing this is NOT safe! Once your private key is publicly known, anybody can now access the address where your bitcoins reside which means anybody can now steal your bitcoins!
By “stealing”, I mean anybody will be able to move the bitcoins from the current address to a different address of their choosing (like uh one of their own addresses).
So there has to be a better way!
How can you prove you are the actual owner of an address (and public key) without having to reveal the private key that’s connected to the address (and public key)?
This can be done by providing what’s called a “digital signature“.
A digital signature is something that can be attached to a message to prove that the sender of the message IS the actual sender.
In Bitcoin, a digital signature is used to show that you know the private key associated with an address WITHOUT having to show the actual private key to the Bitcoin network.
What is the purpose of a digital signature?
In order to spend bitcoins from a particular Bitcoin address, one must prove “ownership” (or knowledge) of the private key that’s paired with the public key associated with that address.
A digital signature is something you can use to prove that you know the private key that’s connected to a public key, WITHOUT having to reveal the actual private key.
The goal of a digital signature is to prove that you are the owner of an address.And in order to prove you are the owner of an address, you need to prove you are the owner of the private key that’s linked to the address.
Now that we have a general idea of what a digital signature is and what it’s used for, let’s actually learn how it all works!