Note: would you rather watch videos instead of reading a bunch of text? Then check out the Top Five Videos that Explain Bitcoin (Fast), or for even more details, the Best Technical Videos On How Bitcoin Works.
The way Bitcoin works is what differentiates it from all other payment systems and currencies. Bitcoin is software that tracks and verifies transactions on a public ledger over a peer-to-peer network. Operations and data associated with Bitcoin are decentralized, meaning they are not performed or stored in one single location. Instead, the Bitcoin network consists of computers across the world that automatically store and relay Bitcoin data to each other. The computers’ owners voluntarily choose to use and run the Bitcoin software. Anyone can use and run Bitcoin software.
Decentralization is one of the key features that makes Bitcoin exceptional: it is extremely difficult for any single person or authority to control Bitcoin.
tl;dr; Nobody controls Bitcoin. It runs on people’s computers all across the world.
Where bitcoins exist
A bitcoin is completely digital and has no physical presence. And Bitcoins don’t exist as individual files on a computer, either. For example, you cannot download a bitcoin. Instead, bitcoins are represented by entries in a public ledger called the blockchain.
The blockchain is the essential core data of Bitcoin: a database of every Bitcoin transaction ever made. Computers on the Bitcoin network record transactions in the blockchain over time, and broadcast them to other computers. The sums of these transaction amounts are what determines the balance of every Bitcoin user.
Bitcoins are not physically backed by gold, dollars, seashells, or bombs.
tl;dr; Bitcoins are just entries in a big ledger. Everyone on the network has a copy of the ledger and it’s called the blockchain.
How to own bitcoins
In order for someone to have a bitcoin balance greater than zero, they must be the recipient of a at least one transaction stored in the blockchain. Every recipient of a transaction is identified by a unique Bitcoin address. Addresses are represented by a group of letters and numbers, between 27-34 characters long, that can look something like this:
12pL6SzSBbFoQLXqhGyu5gkB7p1qoqHkDf
In order to own bitcoins, you need at least one Bitcoin address.
tl;dr; People get and send bitcoins to addresses (just like email). They’re a bunch of random letters and numbers.
Where Bitcoin addresses come from
Bitcoin addresses are randomly generated by the Bitcoin software running on your computer. Neither the Bitcoin network or any other person or party is contacted or involved in creating a new Bitcoin address. The process is completely private.
Bitcoin addresses are free to create. There is no limit to how many Bitcoin addresses you can have. They are not tied to a your identity, and you do not do not need to provide a username, email address, or phone number to get a Bitcoin address.
But there is more to a Bitcoin address than just this group of letters and numbers. A Bitcoin address is actually derived from two very large randomly generated numbers: a private key and a public key. For every Bitcoin address you create, a private key is randomly generated by the Bitcoin software on your computer or device. Then a mathematical process is used to create a public key from the private key. Together these two pieces of data form a cryptographic key pair. Your Bitcoin address is a simplified representation of that public key.
You can safely share your Bitcoin address with others when you want them to send you bitcoins. But it’s private key should always be kept secret. Its used to prove ownership of the public key by a cryptographic process called digital signing. Anyone with access to your private key can spend any Bitcoins associated with your public key and Bitcoin address. All the public and private keys you’ve generated are stored on your computer in a special file called a Bitcoin wallet.
The private key is the only thing that can be used to spend and prove ownership of bitcoins belonging to the associated Bitcoin address. If the private key is ever lost, all bitcoins listed as belonging to the Bitcoin address cannot be spent. Likewise, if the private key is stolen, the thief can take possession of all bitcoins belonging to the address by sending them to their own address.
When you want someone to send you bitcoins, you give them a Bitcoin address you’ve generated, and they send out a new transaction naming their address as the sender, and your address as the recipient.
tl;dr; A Bitcoin address (a.k.a public key) comes from a private key and they’re specially linked together using math. The private key is used to spend bitcoins.
How the blockchain works
Every computer that participates in the Bitcoin network (as a full node) stores and maintains a copy of the blockchain. When a user spends their bitcoins, they broadcast the transaction to the network, and other nodes (called miners) collect, verify, and save the new transactions in the blockchain. These new updates to the blockchain are grouped and stored as a chunk of data known as a block. The new block is announced to the rest of the network so that all other nodes can update their copy of the blockchain with the latest block of transactions.
All blocks in the blockchain are stored in order from oldest to newest. Only new blocks are added to the blockchain, and existing blocks cannot be modified. This is enforced using cryptographic hashing: all new blocks must contain a hash value that’s computed from the last block in the blockchain. The hash value references and proves that the new block exists immediately after its prior block. Any modification to a prior block would unpredictably modify the referencing hash values of all subsequent blocks. This technique maintains the order of the blockchain and prevents tampering of existing blocks.
But how does the entire network synchronize and agree on which transactions should be added to the blockchain?
What prevents dishonest users from making new bitcoins out of “thin air”?
Or spending bitcoins more than once, or even bitcoins they don’t own?
Bitcoin solves these problems using public key cryptography and a concept called proof-of-work.
tl;dr; Transactions on the blockchain are stored in chunks called blocks. Each block is linked together, in order, using cryptography.
Why other people can’t spend your bitcoins
As mentioned above, every Bitcoin address is the public key part of a cryptographic key pair. The other part of the key pair, the private key, is what’s used to prove ownership of bitcoins.
When bitcoins are spent in a transaction, the transaction is digitally signed by the sender using their private key. The digital signature proves the sender, the amount, and the recipient of the transaction. Anyone else on the Bitcoin network can cryptographically verify the signature using the sender’s public key.
A transaction’s signature cannot be faked or counterfeited because every signature is different based on the private key and the details of the transaction. The same is true for the details of the transaction — a change to the transaction’s amount, sender address, or recipient address will invalidate the signature.
Only the private key associated with a Bitcoin address can create a valid digital signature for that particular Bitcoin address.
If a transaction does not have a valid, verifiable signature, it is rejected and ignored by nodes on the Bitcoin network. If a new block contains any transaction that does not have a valid signature, or a transaction that attempts to spend more than the sender owns, then the entire block is rejected and ignored. In this way, fake transactions cannot be credited or added to the blockchain.
tl;dr; Bitcoins can only be spent using the owner’s private keys because every transaction must be digitally signed using the correct private key.
Why bitcoins can’t be arbitrarily “made out of thin air”
All bitcoins exist as entries in the blockchain ledger. These entries define transactions from a sender to a recipient. Every sender must be a prior recipient of an existing transaction. In other words, in order to spend bitcoins, you must have received bitcoins, and the transaction history is be verifiable by anyone. This rule is enforced by all nodes on the network for every transaction using the digital signatures method mentioned above.
Bitcoins can only exist and be owned as the result of a transaction.
The sole exception to the sender/recipient rule is transactions that define newly created bitcoins: these transactions have a recipient, but no sender. They are the result of a process, called mining, that essentially creates bitcoins “out of thin air”.
However, the process is not arbitrary. The new bitcoins are rewards for computational work performed by users called miners. The work and rewarded bitcoins are subject to a strict set of rules defined by the Bitcoin software, including the limitation of the number of bitcoins that are and can ever be created.
tl;dr; Bitcoins can’t be counterfeited because anyone can track the history of any Bitcoin to its origin, and bitcoins can only be created by mining, which requires a lot of work by computers.
How bitcoins are created
Bitcoins come into existence through a process called mining. Mining is the competitive use of computational power to calculate a number that falls within a certain range. The valid number range is periodically adjusted by the Bitcoin network to make it more or less difficult to find the solution; the target rate is 1 solution every 10 minutes. The solution number itself must be cryptographically computed and verifiable based on the latest set of transactions and the last block of the blockchain. This makes the potential solutions to each competition different and unpredictable.
The first miner to discover a number that meets the criteria is rewarded with a set amount of brand new bitcoins (currently 25 bitcoins), plus any recent transaction fees that have been paid by other people sending bitcoin on the network. The competition then repeats for the discovery of a new number.
The rules of the Bitcoin software periodically adjust the difficulty of the competitions so that on average, 6 competitions are solved every hour. This has the effect of limiting how often and how easily bitcoins can be created: the more computers that mine bitcoins, the harder it becomes to win the competition and be rewarded with new bitcoins.
Additionally, the amounts of bitcoins created per competition is cut in half every 210,000 competitions. It’s estimated that this amount will be halved to 12.5 bitcoins by the year 2016, and by 2140, the amount will go to zero, and no new bitcoins will ever be created again. This is how the creation of bitcoins is limited over time, with the maximum amount of bitcoins that can ever exist limited to 21 million.
While mining is how new bitcoins are created, its primary purpose is the processing of new transactions by adding them to the blockchain. Mining is fundamental to securing and synchronizing the blockchain throughout the network, and the newly created bitcoins are essentially rewards for those people performing the mining process.
-
Bitcoin mining is a competition to find a random number that meets a strict set of conditions.
-
You get rewarded new bitcoins if you win the competition. This is how all bitcoins are created.
-
The reward amount gets cut in half every few years and there can only ever be 21 million total bitcoins minted.
-
Mining not only creates bitcoins, but also secures the blockchain.
How the blockchain is secured and synchronized by mining
Digital signatures can verify the amounts and senders of transactions, but they do not prevent conflicts of new transactions that try to spend the same bitcoins. For example, a user could broadcast two different valid transactions, that spend the same bitcoins, to different nodes on the network. These two transactions create a conflict on the network: which transaction should be accepted into the blockchain, and which should be rejected?
This is known as a double spend, and Bitcoin solves this issue using a method called proof-of-work.
When a miner solves a competition (known as solving a block), they publish the result, which includes all the most recent valid transactions they’ve collected from the network in a new block for the blockchain. This block is broadcast throughout the network, and other nodes receive it and verify:
-
The solution to the mining competition is valid (proof-of-work).
-
That all the transactions within the block are valid based on the existing blockchain.
While the number that solves a block is difficult to originally calculate, once it is known, it’s very easy for others to verify that it’s indeed a correct solution. This is the core concept behind proof-of-work: the solving of a problem whose difficulty is known, and the solution itself can be easily proved by anyone to be correct.
Mining is how Bitcoin protects its transaction history (the blockchain) from conflicting versions. Work must be performed for new blocks, and the transactions they contain, to be accepted into the blockchain by other nodes on the network. By requiring that work has been provably done, transactions are considered to be suitable for inclusion in the blockchain. This mechanism is what keeps nodes on the network in agreement about which transactions have actually occurred.
When a block is solved, all transactions included in that block are shown on the network to have 1 confirmation. Every time a new block is solved, the number of confirmations for transactions already existing in the blockchain are incremented by 1.
Occasionally, two different miners will solve a block at the same time. This can cause a fork in the blockchain: both miners broadcast their own block, and some nodes will accept one block, while other nodes accept the other block. In this scenario, the nodes on the network keep track of both versions of the blockchain. Miners continue to mine for a new block using the blockchain of their choice. Eventually, a new block is solved and added to one of these blockchains, making it longer than the other blockchain. The network and miners then abandon the shorter blockchain for the longer blockchain, and the latest transactions that were in it the shorter blockchain remain unconfirmed until added to a new block.
In this case of multiple blockchains, nodes on the Bitcoin network consider the longest blockchain to be the true and valid one. It is generally agreed upon that once a transaction is six blocks deep in the blockchain (know as reaching 6 confirmations), it is irreversibly confirmed and will permanently exist on the blockchain. It is computationally improbable that a longer blockchain could exist without including those transactions.
-
Winning a mining competition requires lots of work, but it can be verified easily by anyone else on the network (proof-of-work concept).
-
Every time a miner wins a competition, a new set of transactions (called a block) is added to the blockchain.
-
Everyone on the network can come to a consensus about which blocks should be added to the blockchain because provable hard work is required to add new blocks.
-
6 new blocks (or confirmations) is understood to make a transaction irreversible.