Chapter 4: Keys and addresses
-
In this scenario, Alice wants to send bitcoins to Bob while maintaining their privacy, composed of thousands of full nodes, will verify Alice’s transaction without knowing the identities of Alice or Bob.
⇒ The goal is to ensure that Bob can receive bitcoins from Alice without revealing his identity or linking this transaction to any other Bitcoin payment he receives.
-
To achieve this, Bob provides Alice with a public key. Then, Alice signs the transactions using her private keys to generate her signature.
⇒ The bitcoin network nodes can verify the authenticity of Alice’s signature by ensuring it matches a hash that includes Bob’s public key and other transaction details. This process ensures that Bob can further spend the bitcoins he receives from Alice.
-
Without tying any aspect of that transaction to Bob’s real-world identity or to other Bitcoin payments that Bob receives:
- Bob’s Real-World identity stays private: The transaction doesn’t reveal any information that could link Bob’s bitcoin address to his actual identity. For example, it won’t include Bob’s name, address, or any personal information. Instead, it uses cryptographic addresses (public keys) that don’t provide any clues about who Bob is in the real world.
- Other Bitcoin Payments remain unlinked: Each Bitcoin transaction is independent, meaning that this specific transaction from Alice to Bob won’t be connected to any other transactions Bob has received or will receive in the future. This prevents anyone analyzing the bitcoin blockchain from determining all of Bob’s transactions just because they see one transaction involving him.

A. Public Key Cryptography
Based on these mathematical functions (prime number exponentiation, elliptic curve multiplication), cryptography enables the creation of unforgeable digital signatures. Bitcoin uses elliptic curve addition and multiplication as the basis for its cryptography.
In Bitcoin, we can use public key cryptography to create a key pair that controls access to bitcoins. The key pair consists of a private key and a public key derived from the private key. The public key is used to receive funds, and the private key is used to sign transactions to spend the funds.
- Private key generation: The process starts with the creation of a private key. The private key is a randomly generated number, which is kept secret. This key gives the holder the ability to control and spend the bitcoins associated with it.
- Derivation of public key: Using a special mathematical function, the private key is used to generate the public key. This process involves elliptic curve cryptography, which is a type of public key cryptography. The important point here is that while it’s easy to generate the public key from the private key, it is practically impossible to reverse the process and derive the private key from the public key
- Why impossible: The mathematical properties of elliptic curve cryptography and the difficulty of the ECDLP make it practically impossible to reverse the process and derive the private key from the public key
- Usage of Public and Private Keys:
- Public Key**:** This is shared openly and used by others to send bitcoins to the address derived from it. It's like an email address that others can use to send you messages.
- Private Key: This remains secret and is used to sign transactions, proving ownership and authorizing the spending of the bitcoins. It’s like your email password that you use to send emails, ensuring that only you can send messages from your email address.
B. Private keys
-
It must remain secret all times because if it’s lost, the funds secured by it are forever lost too.
-
Creating private keys:
- Generating a Private Key: You can generate a private key by creating 256 random binary digits (e.g., by tossing a coin 256 times). The private key can then be used to derive a public key.
- Importance of True Randomness: The process of generating a private key must be truly random. Any predictability in the random number generation can compromise the security of the private key and the bitcoins it controls.
- Secure Randomness Source: The first crucial step in generating keys is to ensure a secure source of randomness, also known as entropy. Bitcoin software uses cryptographically secure random number generators (CSPRNGs) to produce 256 bits of entropy.
- Range of Private Key: The private key must be a number between 0 and n - 1 (where n is approximately 1.1578 × 10^77, slightly less than 2^256). The key is generated by producing a 256-bit random number and ensuring it is less than n.
- CSPRNG Use: It's vital to use a cryptographically secure pseudorandom number generator (CSPRNG) with a seed from a source of sufficient entropy. Using non-secure random number generators can lead to insecure keys.
- Verification of Private Key: If the randomly generated number is less than n, it is a valid private key. Otherwise, another random number is generated.
⇒ For example: 256 bits (64 hexadecimal digits, with each digit representing 4 bits)
3f1fa92e75b0e54f3c9a0cdd56f7ab8bfa2c2a84a9e27f60508edc8c632b6865
C. Elliptic Curve Cryptography Explained
Elliptic Curve Cryptography (ECC) is a type of asymmetric or public key cryptography based on the discrete logarithm problem as expressed by addition and multiplication on the points of an elliptic curve.
Elliptic Curves are a family of curves which have the formula
$$
y^2 = x^3 + ax + b
$$
In Bitcoin, the elliptic curve is used is defined by the following function
$$
y^2 = x^3 + 7
$$
or
$$
y^2 \ mod\ p = (x^3 + 7)\ mod \ p
$$