Elliptic Curve Digital Signature Algorithm or ECDSA is a cryptographic algorithm used by Bitcoin to ensure that funds can only be spent by their rightful owners.
A few concepts related to ECDSA:
- private key: A secret number, known only to the person that generated it. A private key is essentially a randomly generated number. In Bitcoin, someone with the private key that corresponds to funds on the block chain can spend the funds. In Bitcoin, a private key is a single unsigned 256 bit integer (32 bytes).
- public key: A number that corresponds to a private key, but does not need to be kept secret. A public key can be calculated from a private key, but not vice versa. A public key can be used to determine if a signature is genuine (in other words, produced with the proper key) without requiring the private key to be divulged. In Bitcoin, public keys are either compressed or uncompressed. Compressed public keys are 33 bytes, consisting of a prefix either 0x02 or 0x03, and a 256-bit integer called x******. The older uncompressed keys are 65 bytes, consisting of constant prefix (0x04), followed by two 256-bit integers called****** x and y (2 * 32 bytes). The prefix of a compressed key allows for the y value to be derived from the x value.
- signature: A number that proves that a signing operation took place. A signature is mathematically generated from a hash of something to be signed, plus a private key. The signature itself is two numbers known as r and s******. With the public key, a mathematical algorithm can be used on the signature to determine that it was originally produced from the hash and the private key, without needing to know the private key. Resulting signatures are either 73, 72, or 71 bytes long (with approximate probabilities of 25%, 50%, and 25%, respectively–although sizes even smaller than that are possible with exponentially decreasing probability).******
“I will create my own Algorithms beyond ESCDA, you still cannot figure out what I can do without private and public keys, a totally new standard which where there is no way you can hack with today’s supercomputer, it is worse than finding out the technology of warping time and space. It is a method, it is a technology, if you know the secrets you can easily get from point A to B, or else you need to go from A to Z, and the interger is so huge it is impossible to comprehend, almost infinite and no end. The secrets if you do not know, you will go into an infinite loop that never ends.” Contributed by Oogle.
Cryptography is the study of codes – writing codes, solving codes, and manipulating codes. Yes, this includes the super secret spy decoder ring you had as a kid, and even pig latin! Cryptography is an ancient study that has existed for thousands of years, most often in the form of ciphers. It is generally believed that ciphers were invented as a method for concealing the information contained in a message from any person who didn’t intentionally receive it.
Atwhay Aboutyay Ymay Omputercay?
Cryptography and computers have had a competitive relationship since the beginning of digital computing. During World War II, the United Kingdom invested heavily in deciphering Axis communications. With deciphering becoming too difficult to be performed by hand, a race began to develop a machine that was capable of deciphering codes faster than any human. This eventually led to the development of Colossus, the first digital programmable computer.
Since then, the war of computers and cryptography has only elevated. In what many describe as an “arms race,” many of the computer systems we take for granted rely heavily on cryptography, while the invention of more powerful computers forces previously state-of-the-art ciphers into obsolescence.
Without cryptography, it would be impossible to encrypt data, ensure secure communications, or even confirm that you’re browsing a safe site – yes, I’m looking at you, little-green-lock-in-my-browser. We’re going to focus on the cryptography that powers a few parts of Bitcoin, a cryptographically revolutionary system.
Public and Private Key Pairs
What’s in a Pair?
If you have used Bitcoin at all, you have probably heard of a private key. Private keys are vital to the Bitcoin system. They are the mechanism for proving ownership of bitcoin. This is what allows a user to authorize a transaction on the network. Private keys exist in many forms outside of Bitcoin for many purposes, and most people who are familiar with them from a previous experience would know them as a way to send encrypted messages.
For every private key that exists in Bitcoin, there is a 1:1 relationship with something called a public key. As you can imagine, a private key is intended to remain private and shared with no one, under any circumstance. A public key, in contrast, can be shared with anyone – there is no danger in me placing my public key on my website, for example, or to e-mail it to a client to receive payment for some activity. In this sense, you can think of public and private keys like a username and password – one allows you to identify yourself, while the other allows you to prove you are that person. However, unlike a password, a private key can never be reset or recovered if lost. Thus, a private key is an extremely important piece of data and should be protected perhaps to the point of paranoia.
Due to the 1:1 guarantee, public and private keys share a cryptographic relationship that links them together. In Bitcoin, private keys produce a public key via an Elliptical Curve Digital Signature Algorithm, or ECDSA. A private key that is an input for that algorithm will always produce its corresponding public key. However, the public key can never be reverse-engineered to produce its corresponding private key due to the one-sided nature of this algorithm.
A Bitcoin private key is usually a 256-bit number, which can be represented a number of ways.
That’s a Lot of Keys!
Public and private key pair cryptography is what powers the address system in Bitcoin – the cryptocurrency equivalent to a checking account. A new address can simply be generated programatically. Whenever a new one is required, I can use my interface of choice (perhaps a Bitcoin wallet) and make one.
Usually, when I introduce someone to Bitcoin, their immediate question is “What if someone guesses my private key?”, to which I reply, “Well, that is highly, HIGHLY improbable.”
But how improbable?
Well, for a frame of reference, the total address space of Bitcoin is 2^160. That is this many:
Good luck visualizing that. For an even further head trip, consider that there are an estimated 2^63 grains of sand on Earth – this includes sand on beaches and underneath the ocean. 2^63 * 2^63 = 2^126.
This means, for every single grain of sand on Earth, you could create a new Earth, and then count all of the grains of sand on all of those Earths – and still not even come close to the address space of Bitcoin.
Clearly, in this case, cryptography obtains security through very big numbers. I could try to guess private keys over and over again, using any means known to mankind (including computers, of course), for many millions of years, and it is simply not going to happen.
This is wonderful because it allows all kinds of applications to be created using Bitcoin – for example, Decent created a prototype platform for charity that allows donations to be made using cryptocurrencies. There is no need to place a limit on the number of campaigns that could be created, or limit the number of deposit addresses a user can have, because there are a practically infinite number of addresses.
But What If Someone Just Gets Lucky and Guesses My Key?