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 shareableEach 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:
- Authenticity. Was this signed by whoever holds that key?
- 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.