What is a Bitcoin Address and How Do You Sign It?
Short Answer: A Bitcoin address is a unique number that “holds” bitcoin currency. You use the address to receive and send bitcoins.
Medium Sized Answer: A Bitcoin address is the public key half of the public-private key pair that enables the validation of ownership of that address. WHOAH there, what in tarnation does that mean??
Bitcoin addresses are created as part of a key generation process that creates a pair of keys. They are a matched set, where one is public and the other is private. When you “sign” a bitcoin address you are running the public and private keys through an algorithm that checks to see that those keys belong together. Usually signing is talked about in the context of a message. Someone sends you a signed message and you can verify that the message came from the genuine person. You can verify the message because it was signed with their private key and you match it to their public key. When sending bitcoins the signed message is a portion of the bitcoin transaction and you do not explicitly see the message, it is just part of the transaction. This lets you validate the ownership of the address. The transaction (the transfer of value) was signed with the owner’s private key and you check that it’s valid using their public key.
A little diversion – public key cryptography is a really cool technology developed in the mid 1970’s. The amazing thing about public-private key pairs is that everyone can know the public key and the owner of the private key can prove that he is the owner of the message sent with the associated public key. For more information on PKI (Public Key Infrastructure) upon which much of bitcoin’s security is based see Mike Hearn’s (a core bitcoin developer) great description of many issues in “Why you think the PKI sucks…but can’t do any better“.
A Longer Story: Let look at the sequence of actions to create and then use the key pairs. First we need to generate the key pair, which will result in two keys the public and private keys. The Bitcoin address is actually a form of the public key (it’s a hash of the public key). From the Bitcoin protocol specification at: https://en.bitcoin.it/wiki/Protocol_specification#Signatures
A bitcoin address is in fact the hash of a ECDSA public key
Since anyone can know the public key and really the Bitcoin address is the public key, it’s perfectly OK to give out the Bitcoin address. So now we have a Bitcoin address, what’s next?
Let’s say that I want to get paid for something, say writing this article! I can advertise a Bitcoin address, and since you are all so thrilled to read this, you have an overwhelming urge to send me some coins. You would open up your Bitcoin wallet, enter my address as the address to send bitcoins to; click send; and I would happily receive some bitcoins. Recall that I and only I have the private key matching the public key (address) which enables me to be the only person that could spend the bitcoins I just received.
If you wanted to double check that I was actually the owner of the address before you sent me coins you could ask that I send a signed message associated with address proving it’s mine. I could create a message and sign the address. You would then take the message I sent, and put it into your wallet along with my address to prove that I am the “owner” of the address. Bitcoin wallets usually contain this message signing and verification functionality.
An address is used to “hold” bitcoins, however the concept of an address holding bitcoins or that you are the “owner” of a Bitcoin address is a misnomer. Recall that the address is one half of a public-private key pair. The reason you “own” an address and have control over the coins associated with that address is simply that you also know the other half of the public-private key pair, the private key. If someone else learns the private key to an address then that person has just as much control and “ownership” over the address, as you. In other words that person can spend your bitcoins. The solution is quite simple, make sure you and only you control the public keys to your bitcoin addresses. From a practical point of view this means that you create a good, not easy to guess, Bitcoin wallet password, and/or keep it in a safe place. Some excellent security practices are outlined at the Bitcoin Foundation’s site at: https://bitcoin.org/en/secure-your-wallet.
Since Bitcoin addresses are one of the cornerstones to using Bitcoin, it is instructive to play around with addresses to get a better understanding of just what exactly a Bitcoin address is all about. A particularly good website to play around with is bitaddress.org. After generating a new Bitcoin address play around with the various options and observe the public and private keys it generates. Just don’t go putting real bitcoins into an address while also displaying the private key. Keep the private key private!
As always keep up with my Bitcoin musings here and at: BitcoinInPlainEnglish http://www.bitcoininplainenglish.com