How to mine Bitcoin, and two simpler ways of obtaining it

Bitcoin has proven to be more than a mere trend, capturing news headlines and skyrocketing in valuation (from 0.0001 USD to over $1,000 per Bitcoin, to be exact) since its creation in 2009. And its proven lucrative: as of early 2017, cumulative earnings from Bitcoin mining surpassed $2 billion.

While the future of bitcoin is uncertain, there's no doubt that the cryptocurrency will play a significant role as financial technology continues to develop. While bitcoin as a concept can seem like a black box, it's important for those in financial services and fintech to understand the basics of a technology that will play such a crucial role in the future of finance.

Bitcoin mining is no longer practical for hobbyists looking to earn money, but understanding how it works helps uncover how the process is essential to running Bitcoin, along with the financial and non-financial innovations that can be built on top of the protocol.

Bitcoin basics

Digital currencies like bitcoin allow users to send money anywhere in the world with no capital controls, just as easily as sending an email. For the uninitiated, Bitcoin (with a capital B) is a technology and protocol that offers an immutable ledger called a blockchain, where all transactions are recorded when using its underlying currency, bitcoin (lowercase), as a token.

The Bitcoin protocol opens a number of unprecedented opportunities— for one, removing the trust-layer inherent in the third parties in our daily lives — but sending money is its first application. The price of bitcoin fluctuates based on demand. But the total supply of bitcoin that can ever be created is hard-coded into the protocol at 21 million whole bitcoins. Today, 16 million bitcoins exist, and 12.5 are created every 10-12 minutes through a process called mining, which we’ll cover shortly. Bitcoin can also be divided into incredibly small units of value. The “satoshi” is currently the smallest denomination of the bitcoin currency recorded on the blockchain. It represents one-hundred-millionth of a single bitcoin (0.00000001 BTC), and is the smallest value that still gives you the “right to write” to Bitcoin’s global ledger.

Two simple ways of obtaining bitcoin

Before jumping into the details of bitcoin mining, which is now the less-common way of obtaining the currency, we’ll cover two more straightforward — and less technical — ways of doing so.

The first way to acquire bitcoin is to earn it in the free market, just like earning money anywhere online or in person. To do this, you need to set up a bitcoin wallet (one of which is available for free here, which functions as a bank account for stored bitcoins. Your bitcoin wallet will have a public key, which you’ll need to give to the person (or machine) who is sending you bitcoin so they know where to send the money. There are some interesting companies such as 21.co that use this this service for micro-contractors, and some employers are even allowing their employees to be paid in bitcoin.

The second, and perhaps easiest, way to obtain bitcoin is to purchase it on an exchange like Coinbase or in person with a service like LocalBitcoins using local currency. Bitcoin exchanges operating in the U.S. are subject to KYC/AML laws, so it’s necessary to first link a bank account and answer some questions before trading sovereign currency for a mathematical one.

Mining bitcoin

The third way to acquire bitcoin is by mining it with a computer. You can think of a computer’s effort in electricity and computing power as equivalent to throwing a pick axe over your shoulder to unearth precious metal. As mentioned above, there is a finite supply of bitcoin, so machines must labor harder and harder as supply becomes more scarce; they do this by solving mathematical problems, which in turn ties the transactions to the immutable blockchain ledger forever.

Let’s unpack the how and why of mining to better understand why earning or buying bitcoin as described above aren’t the only options.

Bitcoin mining serves two purposes: to create new bitcoins and to confirm transactions that happen in the Bitcoin network in a globally trusting manner without a third party.

Mining is done on a network of thousands of decentralized node computers that use special mining software to solve simple yet very compute-intensive algorithmic problems and are issued a certain amount of bitcoin in exchange. In the early days, mining was performed by regular computers, even laptops. But as competition in mining increased, people started using gaming computers to solve the mathematical problems faster. Eventually, even these computers were replaced by custom application-specific integrated circuit (ASIC) processors running in large warehouses like these. By some estimates, the Bitcoin network has 100 times more computing power than Google at the time of this writing.

Bitcoin’s blockchain, the immutable ledger of transactions, is updated in chunks, which are conveniently called blocks. You can think of blocks as a cryptographically secure package of verified transactions. Since the processing of transactions over the network and eventual commitment of blocks to the blockchain happens every 10-12 minutes, the blockchain naturally gets lengthier over time and transactions are observable forever as each node has a full copy of the blockchain.

A bitcoin transaction is made of a list of “inputs” and “outputs.” Outputs have two things: a value in BTC, and the conditions under which it may be spent. An input contains a reference to a previous output, as well as the information required to fulfill the spend conditions. A transaction is valid if (1) each input matches an unspent output, and (2) all inputs fulfill their respective outputs' conditions. These transactions are bundled into a block. A header with the ID of the last committed block is inserted into this new block in the form of a hash, which is a short, seemingly random alphanumeric sequence.

The hash is interesting because this short, identifiable string can be produced from the data of thousands of transactions, but you won’t know what those transactions are just by looking at it. Each hash is unique. If you were to adjust a single character in transactional data held in the block, the hash sequence would look completely different and not map to those transactions. Because each hash includes the previous block’s hash, the chain it creates is tamperproof.

To generate a hash for the newest block, computers around the world will then individually, or in a pool, apply a massive amount of computing power to try to be first to solve the math problem for the hash. The one with the longest proof of work wins a set amount of bitcoin. The bitcoin “prize” is awarded every 10-12 minutes and currently stands at 12.5 bitcoins, but halves about every four years.

The moment a miner finds the solution, it is broadcasted to the rest of the network. The network accepts the winner by seeing the proof of work that has led to the solved the problem. That block gets sealed forever into the blockchain and the process then begins over again with the next block. The humans (or machines) who own the mining rigs will get to keep the bitcoin reward if they win.

The last bit of bitcoin is projected to be mined in the year 2140 based on the block reward halving frequency of four years. Given that there are 32 halving events, in 2136, the block reward will yield 0.00000168 BTC per day, which is 0.00000042 BTC per block, or 42 satoshis. The network will then operate solely on transaction fees charged by the miners.

Zooming out

Bitcoin is a technology, protocol, and programmable currency that creates its own central bank, allows for personal bank accounts, and operates a transaction network. The game theory behind it keeps it running, secure, and valuable.