Bitcoin Basics
Nov 21, 2023

Understanding Bitcoin Addresses, Public Keys, and Transactions

Bitcoin basics: private keys, public keys, addresses, UTXOs, inputs, outputs explained.

Understanding Bitcoin Addresses, Public Keys, and Transactions

In the world of Bitcoin, understanding the relationships between private keys, public keys, and addresses is essential. This article will provide a comprehensive explanation of these concepts, how they are interconnected, and how they are used in transactions.

Private keys, public keys, and addresses

A private key is a randomly generated number that is used to create a public key. This process involves multiplying the private key by a set of generator points. It is impossible to reverse-engineer the private key from the public key.

The public key is then hashed twice to produce the Bitcoin address. Again, it is impossible to calculate the public key from the address. In summary, private keys produce public keys, public keys produce addresses, and neither addresses nor public keys can be reversed to produce their respective precursors.

Wallets, old addresses, and new transactions

When a Bitcoin wallet automatically generates a new address for each transaction, it does not forget the old addresses. Instead, the wallet continues to track them on the blockchain to see if they receive any funds. If someone sends Bitcoin to an old address, the funds will arrive at that address, and the wallet will find the corresponding private key to sign a transaction using those funds.

Exploring Multiple Inputs and Outputs in Bitcoin Transactions

In the Bitcoin network, transactions often involve multiple inputs and outputs. To better understand how they work, let's delve into the concepts of Unspent Transaction Outputs (UTXOs), inputs, outputs, and the mechanics behind these transactions.

UTXOs and Transaction Inputs

In the Bitcoin system, transactions are not based on account balances but rather on UTXOs. UTXOs are the remaining portions of a previously received transaction that have not been spent. These outputs act as digital coins that can be spent in future transactions.

When a user wants to make a Bitcoin transaction, their wallet scans the blockchain for UTXOs associated with their addresses. These UTXOs act as transaction inputs. Each input is linked to a specific UTXO, and the sum of all inputs must be equal to or greater than the amount the user wishes to send.

Transaction Outputs

Transaction outputs are the destinations where the Bitcoin is sent. There are usually two types of outputs in a transaction:

  1. The recipient's output: This output represents the amount of Bitcoin being sent to the recipient's address.
  2. The change output: This output sends the remaining balance (the difference between the input and the recipient's output) back to the sender's wallet, usually to a newly generated address.

Having a solid grasp of the relationships between private keys, public keys, and addresses, as well as how they are used in Bitcoin transactions, is fundamental to understanding the basics of Bitcoin. These concepts are interconnected and play a significant role in how it all works.