Skip to the workspace
Pebellslearn by building
Hashes, Keys and Signatures  ›  Capstone Project

Keys and Digital Signatures

Cryptography & Hashing 15 minA private key signs transactions and the matching public key lets anyone check the signature, so owning funds on a blockchain means controlling a key rather than having an account in your name.

blockchain / Keys and Digital Signatures

Explore each scene at your own pace.

01 · The rule

The rule

Keys and Digital Signatures

No bank checks Asha's identity before her payment goes through. The network does not even know her name. So how does every node know that "Asha pays Meera 4" really came from Asha, and that nobody changed the 4 to 40 along the way? The answer is a pair of keys and a digital signature.

The rule

Sign with the private key; anyone verifies with the public key.

  • Private key. A very large secret number chosen at random; on Bitcoin and Ethereum it is 256 bits. Whoever knows it controls the funds tied to it.
  • Public key. Computed from the private key using elliptic-curve mathematics. Easy to compute in that direction, infeasible to reverse.
  • Address. A shorter identifier made by hashing the public key, sometimes with a format prefix and a checksum added. It is what you give people so they can pay you.
private key  →  public key  →  address
   secret        shareable      shareable

Each arrow is one-way.

A digital signature is computed from two things: the private key and the exact transaction data. Checking it takes three things: the signature, the transaction data and the public key. A valid signature answers two questions at once:

  1. Authenticity. Was this signed by whoever holds that key?
  2. Integrity. Is the data exactly what was signed? Change one digit and the check fails.

Signing hides nothing. The transaction and its signature are public, so everyone can read them and verify them. And there is no "forgot password": lose the private key and nobody can ever sign for those funds again.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.