Wednesday, June 1, 2016

Introduction to Bitcoin

What is Bitcoin and how to get it?



In the simplest possible terms, Bitcoin is a digital currency.
You can acquire bitcoin by:
  • by exchanging it for your dollars, euros, or yen.
  • by providing someone with a product or service that they pay you in bitcoin.
  • by “mining” bitcoin (yes, it's similar to mining gold).
 To send someone bitcoin, you only need to know his bitcoin address.
Your acquisition and subsequent possession of this bitcoin exists as one or more entries in a public ledger (the blockchain) in which you are identified by a secure anonymized “key”. Each time you use your bitcoin, the new transaction is recorded as yet another entry in the ledger.





I thought it was a big scam?

 
A lot of the attention paid to Bitcoin has focused on its success in creating currency without a government backer, about how bitcoin value measured in traditional money fluctuates a lot over time (although its exchange rate has stabilized considerably in 2015), and perhaps also about the use of bitcoin for commerce that many governments consider illegal. Instead of rehashing those topics, I focus here on thinking about Bitcoin as one of many applications of a new set of enabling technologies: decentralized peer-to-peer marketplaces. See for yourself how it works for millions of people.


How does it work?


Let’s say that you want to send your friend Bob digital money. You would ideally say something like this: “I possess at least one currency unit from prior transaction Q, and I am giving Bob one unit.”

This establishes that you have the money, commits you to the transaction, and gives Bob access to the money. The physical-world equivalent would be if you were to give Bob a banknote.

Establishing a digital equivalent first requires the use of a “digital signature.” Let’s say that there are two unique numbers (called “keys,” analogous to what goes into a lock) associated with you. One of these is known only to you, or is stored on a device you own, and is called your private key. Another, available for anyone to look up, is called your public key. If someone “locks” a message (or encodes it using a cryptography algorithm) with your public key, this encrypted message can only be “unlocked” with your private key. And vice versa—if a message is encrypted with your private key, it can only be decrypted with your public key. This allows for a simple way to create a “signature”: since you are the only person who has your private key, then a message encrypted with it could only have come from you. And since your public key is public, anyone can verify that this is your signature.


Next there must be a way to prevent you from arbitrarily spending money you don’t have. In the physical world, this is accomplished by making bank notes hard to counterfeit. In a system like PayPal, on the other hand, a trusted third-party (i.e., a centralized entity, or PayPal itself)—keeps track of who has how much, and updates a private digital “ledger” of some sort every time someone sends money to someone else.


Bitcoin, in contrast, uses a public ledger, the blockchain. Every user of Bitcoin has a copy of this blockchain, and it contains every single bitcoin transaction since the currency was created. When you say, “I possess at least one currency unit from prior transaction Q, and I am giving Bob one unit,” Bob can verify that the message is from you by checking your signature, and he can then check his copy of the blockchain to be assured that you in fact have bitcoin to spend.


What if I simultanously send this coin to multiple people?


Now, let’s say you simultaneously send a signed message to both Bob and Alice giving them each one unit. If they both checked their current copy of the blockchain, they would find the prior transaction, it would seem like you have the money, and both of them would update their ledgers, leading to a problem down the line.

A possible solution might be to delegate maintaining the integrity of the ledger to the “crowd,” as I illustrate here with this simple scenario: After both Bob and Alice receive your message and check their copies of the blockchain to see if you have the money to spend, they then broadcast the transaction to the entire network of users. This transaction then joins a list of “pending transactions,” each of which will “clear” only when enough people on the network match the transaction against their copy of the blockchain and indicate that it is OK. During this waiting period it will likely be discovered that you have (perhaps mistakenly) tried to spend your unit twice.


But what’s to prevent you from creating millions of identities online and “taking over” the network by controlling a majority of the user accounts? If you managed to insert fake transactions suggesting you have money to spend into a majority of the copies of the blockchain, wouldn’t this allow you in effect to create “counterfeit” money?


Here come the Bitcoin Miners 


Bitcoin solves this problem in an ingenious way: continuing to rely on a crowd-based method of clearing transactions, but artificially adding complexity to the validation process. How is this accomplished, and why does it work? Well, when a user, let’s say Bob, checks the list of pending transactions and confirms their validity, Bob also has to solve an intensely challenging computational problem (the “challenge”). Solving a challenge is sort of like factorizing a big number—generating the two factors is difficult, but once you do that, verifying that their product yields the original number is easy. A Bitcoin challenge is significantly harder, but once solved, checking that the answer is correct is relatively simple.

Meanwhile, Alice and others might have also validated the list of pending bitcoin transactions and, in parallel with Bob, would be trying to solve the challenge as well. If Bob happens to win (solve the challenge first), others will verify that his answer is correct, then update their blockchains with his list of validated transactions. (It actually takes a little longer than that for a set of transactions to be accepted by the blockchain, but this is a detail that is less relevant to our discussion.)

As a consequence, Bob can’t simply or arbitrarily generate fake identities to take over the network and insert fake ledger entries. He’d need a large amount of computational power, and meanwhile, others are busy solving the same challenge to validate the transactions. And there’s enough randomness in the challenge so that the person with the most computational power doesn’t necessarily win (although having that power does have an advantage, on average.) So, while there is a risk that someone will invest way more than everyone else in computational power and start to take over the network, this is far more difficult and expensive than setting up millions of fake identities.




This leads to yet another problem, though. Computational power isn’t free. What incentive do Bob and Alice have to invest their resources into solving the challenge repeatedly? Well, the “winner” of the challenge gets issued new bitcoin! (As of 2016, this reward is 25 bitcoin, worth roughly 13k US dollars). This process of validating transactions, solving the challenge, and collecting the reward is referred to as “mining” new bitcoin. The reward is halved after every 4 years. Since there’s a new list of transactions (or “block”) to verify every 10 minutes or so, mining can translate into pretty good returns on one’s investment in computational power.

The next halving event is in July 2016. Read more about Bitcoin Mining here.

That's all for now. See you next time!