Bitcoin Basics: Keys, Signatures, Addresses and Seed-Phrases — Hug a nerd today!
Private Keys, Public Keys, seed phrases, public addresses, signatures, verification’s……what does it all mean? The inner working of the bitcoin blockchain can be complex enough to scare even the bravest tech nerd. Having a basic understanding of these concepts are important for every bitcoiner to understand. Having a good understanding of the mechanisms behind the systems that protect your bitcoin and protect your wealth, builds upon the conviction within the system itself.
We need to build this impenetrable, defensible wall of conviction for when the big boys come and try their market shakeouts as we experienced in the first half of 2021. When you know what this tech can do, a fast market draw-down means little, in fact you get excited because it means you can stack more. But you have to do the work, you have to read the boring stuff as well as the number-go-up pump posts, it is your defense against the constant onslaught of FUD (fear uncertainty and doubt).
This article builds upon the framework outlined in the first 2 articles in this series. Please revisit them if you need to, particularly the article about blockchain.
Bitcoin Basics: Blockchain, hashing & mining….oh my!
Bitcoin Basics: Bitcoin is better than Gold. The Difficulty-Adjustment
To briefly recap on the Blockchain article, we finish up with an understanding how a set of transactional data between parties is organised into a block, the block is hashed and the hash function output of that block is used the chain this block onto the next block, building the blockchain. Figure 1. gives a graphical representation of where we left off with a distributed ledger, containing a series of blocks detailing the transactional data between the names of a few parties.
The nature of a distributed ledger means that anyone with a copy of that ledger, or anyone with access to a block explorer program that reviews the ledger on their behalf, can see each and every transaction that occurs on the network. Each transaction that has ever occurred in the history of its existence. This is not very private, being able to see the wealth and transactional history of everyone who interacts with the open-source monetary network is not very enticing for people to use. We also have the issue of ownership of the digital bearer asset, i.e how do we know who owns the assets within the coinbase, and who has the right to spend those coins?
This is where we start to see the need for addressing and keys. The bitcoin network replaces the names we see in the above blockchain example with addresses. Addresses are akin to thinking about your bank account number. Anyone can know your account number, but that doesn’t mean they can withdrawal from your account. Bitcoin is very similar.
Let us start to expand on this thinking with getting an understanding of keys.
In the above paragraphs we highlight that knowing someones address (which we will explain more later) does not give someone the right to spend the coins allocated to that address. For this, you need to possess the keys to that address.
Within the bitcoin protocol we have Private Keys and Public Keys. Think of a private key as the password to your bitcoin. If anyone possesses your private key, they can (and most certainly will) spend your bitcoin.
A Public Key, is an alphanumeric derivation of the Private key. The protocol uses very complex math called Elliptical Curve mathematics for this derivation. Like we have seen in previous articles with zero-knowledge-proofs, if we have a Public Key, we can easily verify it is a derivation of a Private Key, without actually knowing what the Private Key is. In other words, we can freely post a Public Key out into the real world, without ever revealing our Private Key. Comparing to a bank, we can broadcast our account number without giving anyone our password.
Figure 2, shows an example of a Private Key and Public Key generator. We can use the random number generator to generate a Private Key which is simply a long and random series of numbers, the Public Key is then derived from this public key using our elliptical curve math (done in the background of the program).
In our example the Private Key is: 109061840007561069406299523225143024672133256023909632335480704541347002650417
This number would be the key that we keep extremely private and secure.
The Public Key, which is a derivation of that Private Key is:
The Public Key is one we could give out and post online without any fear. It is impossible to derive the Private Key from the Public Key, but very easy to do the other way around. That is the beauty of cryptography and math. Go and hug an math-nerd today.
That’s all good Daz, but now what do we do with them?
Signatures are where the true beauty comes from Private and Public Key pairs. Say I wanted to send a message to somebody, and I really wanted the integrity of that message to be maintained, but I really really wanted my friend on the receiving end to know that that message had not been intercepted, interfered with or changed. We can use cryptography to achieve this. Without getting into the inner-workings of the cryptographic algorithms (it’s well above my pay-grade), we will just stick to the high level concept. By using a cryptography algorithm, I can cryptographically sign a message (for now I will use an arbitrary piece of data) using my Private Key. When I sign this message, the algorithm signs this message using my Private Key and provides me with a message signature. Figure 3.
My Message is:
I really hope this message gets to you.
I really really really like beer. Ssshhhh don’t tell anyone
I sign it with my Private Key from the previous examples and I am provided with the message signature:
I can send this message along with the message signature to my friend. I also gave a copy of my Public Key (derived from my secret Private Key). My friend can easily confirm that my message is true and correct by using this program to check the validity of the message by checking the message signature against the Public Key and the message itself. Using the Public Key, the verifier can tell that whoever signed the message was the owner of the Private Key pair to which that Public Key belongs, it is also checking that the message signature was derived from the combination of the message and that Private Key.
My friend puts in all the data, hits verify and the program confirms the message. It turns green and it’s happy (Figure 4).
Remember our nefarious actor from our previous article? He’s back. He intercepts my message before it gets to my friend. The bad actor was not aware that we have cryptographically signed the message, he thinks he can just change the contents of the message. My friend receives the message, uses the signature and Public Key I sent to him separately and he knows straight away that something is up (Figure 5).
He calls me to confirm if I really really really like wearing fluffy tutu’s which I vehemently deny. I resend the correct message and he is able to confirm that I meant I like beer all along.
Now that we have a good grasp of signatures and the use of Private Key and Public Key pairs, let’s see how we can use them in respect to our blockchain examples.
To understand how we can use Private Key and Public Key pairs in the context of transactions, it can be as simple as just replacing the message in our previous example with a transactional record, with a slight twist.
Remember back to our blockchain example where we knew that Rick sent coins to Sam. What if we substituted the names with Public Keys? We could use the public keys and private key pairings to now start recording ownership of coins within the coinbase. The Public keys will provide Rick and Sam with some anonymity as well as providing us with a system of ownership.
We can programmatically structure, using cryptography, this transactional record by verifying that only the person holding the private key, can spend the coins of the balance assigned to that Public Key on the blockchain. This is done by “signing” the transaction with the private key as we saw in our previous example. That was a bit of mouthful so let’s step through it with an example.
Figure 6 shows a transaction record showing a message that contains an amount of coins were sent from one public key to another public key.
I sign this transaction record with my Private key to obtain the Message Signature.
The transaction is sent to other party who uses the message signature to verify that it was signed by the owner of the Private Key pairing of the Public Key contained in the “From” Field (Figure 7). This has verified the ownership of the public key associated in the origin of the transaction.
If our nefarious actor strikes again and tries to change even the smallest detail of our record, whether it is to change the amount by 1/2 a cent (Figure 8), or changes the “to” address to try and intercept the transaction, this is easily verifiable using the message signature.
As we can see this is a very secure way of using cryptography and Public Key and Private Key pairings to introduce anonymity and a secure method of recording transactional information. Lets bring it together within the blockchain.
Tying it all together
Using what we learned from the previous article on blockchain, distributed ledgers, nonce’s and mining, we can now add our new knowledge to the blockchain transaction records.
In Figure 9 we can see we can see Peer A’s version of the blockchain. We have replaced the names withing our transactional record with Public Keys. There is also now a “Seq” field and a “Sig” field. The signature field is added so that each transaction can be verified as true and correct. The “Seq” field will increment for an identical transaction (i.e if there is the same amount between the same 2 parties, the seq will give the transaction a unique identify so that the signature will be different for both transactions). You can see this as an example in the first transaction listed in block 4 and block 5.
Everything we touched on in the previous blockchain article remains true, now the network will confirm transactions, confirm the balances of those key holders and also confirm the validity of the key-holder through the message signature and public key. Transactions are validated and added to the block once a miner has solved the nonce for the current block.
The network of nodes is constantly checking each other and reaching consensus on the validity of the blockchain, its transactional history and enforcing the rules of the program.
Public Addresses and Seed-phrases.
As we can see from our examples above that the Public Keys are quite long. It is very easy to make a mistake if manually typing in a public key if you were to try and complete a transaction. There are many ways developers have tackled this complexity with things such as QR codes, the use of other hash functions checksum operations, and extended public keys.
To simplify and shorten a public key, we can hash a public key, not too dissimilar to how we hashed data in the blockchain article.
By hashing the public key we can reduce the amount of characters needed to represent the same information. This is known as a Public Address. If your eyes are starting to roll back toward your brain by now, fear not. This can be all quite confusing. We don’t really need to understand how things are working in the background, just a broad understanding of the fundamentals. An an overview
A public address is derived from a public key, and a public key is derived from a private key.
But wait…..there’s more. In our next article we are going to tackle wallets. In simple terms, a wallet is a device or piece of software designed to take all the confusion out of the above concepts and manage all these keys and addresses for you. Chances are, if you have been in the space for a little while, you may have already interacted with a wallet.
If you have downloaded a software wallet or purchased a hardware wallet before, the first thing you are often asked to do is copy down your seed-phrase. Your seed-phrase is a series of words (often 12 or 24 words, depending on the standard that particular device/software uses). It is these 24words that are a mnemonic representation of your private key. Developers introduced this method of generating private keys as a way to take the complexity out of backing up and storing your private keys. It is very easy to copy down a long number without patterns such as 109061840007561069406299523225143024672133256023909632335480704541347002650417. The slightest error mistaking a 1 for a 7 can mean complete loss of your coins.
There are a number of different standards for seed-phrase key generation, BIP39 is one used by many bitcoin wallets. BIP39 uses a random selection of 12–24 words from a specific set of 2048 words. Each word is chosen as it represents a unique binary number equivalent. When randomised and strung together, these words and their binary equivalent representation, forms your unique random Private Key. Our new flow of seed-phrases, keys and addresses is illustrated in Figure 10.
You must secure your seed-phrase as tightly as you would the Private Key itself, they are one and the same. Should you lose the device storing your software wallet, or lose your hardware wallet, you can use your seed-phrase in a new device and get access to your bitcoin. Likewise, it is the seed-phrase that empowers you to cross borders with your entire wealth in your head. If you are anything like me, I highly recommend you don’t rely on your monkey brain to carry your wealth, but it is nice to know it’s possible.
Seed-phrases should be kept safe, secure and separate from your wallets. Many people inscribe them onto steel and lock them away in private vaults as an example, if they are securing a large amount of wealth.
We will dig into wallets more in the next article, for now, simply understand that your wallet manages all of the complexities for you with what we have talked about today. When you open a wallet it gives you a seed-phrase, you write it down, back it up and secure it like your life depends on it. When you hit “receive” in your wallet you get a public address to freely share with the world, everything else is sitting in the background. Now go and hug a computer nerd.
This article wraps up most of the technicalities we will go through in the series. To reiterate what has been mentioned previously, I believe that having a fundamental understanding of the blockchain, keys and addressing is essential in your conviction in holding bitcoin as a bearer asset. When these market shake-downs happen, as we recently experience, I like to revisit these core principles and rediscover the marvel behind the tech, the nuance and the specifics that make this a global monetary phenomenon. It is my strong belief that bitcoin has been too well-thought-out to be one player, but rather a conglomerate of cypher-punks with a deep understanding of economics, macro-economics, computer science, cryptography, philosophy and game-theory. But that is pure speculation, it could very well be that this Satoshi Nakamoto had a deep understanding of all these subjects, I guess we will never know, in fact I hope we don’t.
I recognise bitcoin for what it is, and the further I go down this rabbit-hole, the more conviction I build. The more conviction I have the greater slice of this scarce pie 21,000,000 bitcoin that I want to hold.
Remember to dollar-cost-average into bitcoin in order to iron out the volatility. Get some early exposure, once you have some skin-in-the-game it will incentivise you to learn more. Don’t be scared of the rabbit-hole, its fun down here and you will meet some incredible people in the process.
Just keep stacking. Thanks for reading.
P.S Again I have used the incredible demo on blockchain and keys from Anders Brownworth. Go visit and have a play with his tools as well as find some video demonstrations. Incredible Resource
Blockchain Demo: Public / Private Keys & Signing
Public / private key pair demo in a browser.
Medium: Daz Bea
Support this content
If you are in Australia, consider using the following code to sign up for Coinspot Crypto Exchange. Disclaimer: I do receive affiliate benefits from Coinspot by using this link, however I would never recommend a product that I didn’t rate highly or that I didn’t use myself.
With industry-leading security processes and customisable features to protect your account, CoinSpot is Australia's…
Alternatively, if you would like to make a contribution to help fund my work please consider a bitcoin donation to the following bitcoin address. Every sat is deeply appreciated and HODL’d with love.
Finally, consider supporting me on Patreon.
Daz Bea is creating Finance and Macro education with a focus on Bitcoin. | Patreon
Become a patron of Daz Bea today: Get access to exclusive content and experiences on the world's largest membership…
Thanks for reading