Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
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.

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.

The shortcut

For any "is this transaction genuine?" question, run the verify check: which key made the signature, what data did it cover, and is anything different now?

Someone tampers with Asha's paymentStep 1 of 4
  1. Asha signs

    Her wallet signs "Asha pays Meera 4" with her private key and broadcasts the transaction together with the signature.

The traps: thinking the public key is secret (it is meant to be shared), thinking a signature encrypts the transaction (it does not), and thinking a lost private key can be reset (it cannot).

Drills

Answer fast — trust the rule.

quick drill

Which of these must stay secret?

quick drill

Meera wants Kabir to pay her. What should she send him?

quick drill

An attacker changes the amount in a signed transaction but keeps the original signature. What happens?

quick drill

Which statement about a signed transaction is true?

quick drill

Why can nobody work out Asha's private key from her address?

Remember

  • Sign with the private key; anyone verifies with the public key.
  • Shortcut: which key signed, what data did it cover, and has anything changed? Any edit breaks the signature.
  • Trap: signatures prove and protect but do not hide. A lost private key cannot be reset.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainTrust without names

Explain how the network can trust "Asha pays Meera 4" without knowing who Asha is. Cover what the private key, the public key and the address each do, and what happens if someone edits the transaction in transit.