How does Bitcoin work?


How Does Bitcoin Work?

This question can ask how does Bitcoin work technically, or how do people use it. Let's look at how people use Bitcoin first, then discuss the technology.
The original way to use Bitcoin is to install what's called "wallet" software on your computer. The wallet software allows anyone to send and receive bitcoins easily.
 The wallet creates bitcoin addresses which are long strings of numbers and letters that look like this: 1PGFCtrJHUsc7fs4LGWLmXUEwuKyDaHuRa. People can send bitcoins from address to address as easily as sending email, meaning bitcoins can be sent anywhere in the world in seconds.
There is something else to know about wallet addresses. They consist of a public key and private key. The public key is linked to the private key by cryptography. In Bitcoin everyone sends coins to everyone else's public key, but they don't know their private key. The private key is what allows you to send coins.
Now let's look at how Bitcoin works technically.
Bitcoin uses the Internet and software. There are two main groups to know about: users and miners. Anyone can be a user or miner or both. There is actually one other group which is software developers, but they only help people be either a user or miner. Anyone can develop software for Bitcoin, but nobody has to accept it, because with Bitcoin things are democratic, and controlled completely by the free market.
A technical description can be found in the whitepaper written by Bitcoin's creator (Satoshi Nakamoto).
However, a laymans explanation follows. Probably the most important thing in Bitcoin is called the block chain. The block chain contains every Bitcoin transaction ever done on the network to know which addresses have which coins. The block chain, like Bitcoin's software, is completely transparent. Anyone can view it all.
The block chain works in an ingenious way. Nobody controls bitcoin, therefore the block chain uses a method for everybody to have a "vote" so to speak, as well as be able to authenticate transactions.
A "block" in the chain consists of the valid new transactions a miner (who successfully mines the block) knows about. Each successive block in the chain contains a hash of the previous block linking them.
The very first block in the chain is called the Genesis block. In order to mine a block a computer using "mining" software must successfully solve a complex math problem. The first computer, of all on the network competing to mine, to solve the problem "wins" that block. By winning the block that computer (miner) is able to package valid new transactions it sees on the Bitcoin network into the block, collect associated transaction fees, and give a special transcation, called the block reward, of 50 new coins to its own wallet address*.
So this process is how all bitcoins come into circulation. It's similar to people mining to bring gold into circulation. Miners have incentive to mine because they have the random chance of being rewarded with new bitcoins. Mining serves the purpose of bringing coins into circulation, but also the very important task of securing and auditing the network.
Bitcoin is a trustless system. Nobody has to trust anybody else. Miners check that each block is valid (contains valid transactions, and the winning hash) because they want to be the first one to produce a valid block and receive associated rewards. Users check that valid transactions happen as intended by awaiting network "confirmations" from miners.
The network agrees that the longest valid copy of the block chain it hears about is the correct one. Due to the fact that the difficuly in finding correct blocks is automatically adjusted by the network to maintain a relatively stable coin creation rate, the more computers that partcipate in mining the harder it is to intentionally disturb the block chain with malicious acts, since doing so would require more computing power than the network of miners combined.
A final thing to understand is that cryptography allows Bitcoin to work by letting computers verify things publicly while keeping the ability to spend coins private. As mentioned Bitcoin uses public and private keys. Anyone that tries to send coins from one address to another must do so by "signing" the transaction with their private key. By using cryptography the network can verify that the user is authorized to send the coins by computing whether or not the private key is correct without ever knowing the private key. Explaining how this works briefly is not possible, but here is an excellent video explaining the cryptography (cryptography talk starts at 20 min mark).
So to recap, bitcoins come into circulation from miners who compete to mine valid blocks. The blocks contain transactions which are verified to have come from users authorized to send the coins. The block chain is a distributed record of all the blocks containing all transactions done from the very start of Bitcoin to present. The network protects itself from malicious activity by relying on the fact that it takes a certain amount of computing power to mine blocks; therefore, to create a longer "spoof" chain than the network, which could be cofirmed as valid, would require more computing power than the combined network of miners.
* the block reward halves automatically about every 4 years so there will only be 21 million bitcoins total over time