Ethereum Accounts, Addresses, Private and Public Keys

In this post I'm going to tell you what exactly an account on the Ethereum Blockchain is. We are also talking about how an address is really created internally. And what the private key is for anyways.

So, when you are sending Ether, you are usually sending them from one address to another. Let’s just assume for a moment that you want to send 1 Ether to your friend Bob.

The Ether that you are sending are not directly in a wallet. They are saved on the Blockchain. So, when you send Ether from one address to another then you basically instruct the Blockchain to debit and credit Ether.

But how does the Blockchain, or a miner, know if you are really allowed to do so? That comes with cryptography. In particular private/public keys.

Ethereum Private Keys are 64 random hex characters or 32 random bytes.

A private key in Ethereum is nothing else than 64 random hex characters. As a short reminder: Hexadecimal is going from 0 to F, which is 0 to 15 in decimal numbers. So there are 64 random values between 0 and 15, or 0 to F. That translates to 256 bits or 32 bytes.

You could literally go in and create your own private key, let’s say 0xFF00FF00FF00FF00FF00.. And so on. The trick here is to make it really random. So nobody can guess it. And that is why you should not create your own private key yourself from the top of your head.

The public key is derived from the private key using ECDSA.

From the private key the public key is derived. This is done with something called ECDSA or Elliptic Curve Digital Signature Algorithm. How this exactly works is not important, just keep the following in mind: The public key is for the public, the private key is always only for you.

Okay, if I lost your attention somewhere along the way, that is the important part: There are the two keys: the public key and the private key.

But how can you get the Ethereum address now?

The Ethereum address are the first 20 bytes of the SHA3 hashed public key.

On Ethereum you take the public key and hash it with SHA3. Then you should get a 64 characters long string. That are 32 bytes.

To get the final address take the last 40 characters or 20 bytes. These 20 bytes are the Ethereum address.

Additionally the private key can also be encrypted with a password which is fairly standard. So when you open your wallet for example, you have to enter a password. Or if you send off transactions you first have to enter your password. Many keystores make it pretty hard to get access to the real unencrypted private key. For a good reason, because the private key is very important.

But what is that private key for anyways? Why is it so important?

The private key creates a signature. The public key verifies the signature.

With the private/public key cryptography you can create signatures using the private key. This doesn’t reveal the private key, but makes sure that a content was authorized by you, the person who owns the private key. Then anybody could go ahead and verify that signature with the public key and also the Ethereum address.

So if you send Ether from one address to another, you instruct the Blockchain to deduct 1 Ether from your address and add it to the balance of another address. This transaction is signed. The signature is created with the help of your private key. The signature can then be verified by everyone, but not altered or faked.

This is how private/public keys and Ethereum addresses work. Never give out your private keys and make sure they are safe. Always give out your public keys. They can be used to verify your transaction-signatures.

Don't forget: All of this is something we're discussing extensively in The ultimate Blockchain Mastery video bundle. Join it here for $19 only!