Bitcoin so how does it actually work?

in #bitcoin7 years ago (edited)

I actually did this kind of backwards. I had to write all the code before I could convince myself that I could solve every problem, then I wrote the paper.

Satoshi Nakamoto, 2008

Bitcoin is complex. Like a bee hive, different actors perform strange tasks (like mining) that only make sense at the macro level.

In this post I'm going to describe "how" Bitcoin works and then in my next post I'll focus on the "why". Normally I take the opposite approach, but like Satoshi's quote, you need to build it first before you can explain it.

Buying Bitcoins

If you're not a miner you need to buy your first Bitcoin (or fraction of a Bitcoin - Bitcoins are divisible up to 8 decimal places. The 8th decimal, 0.00000001, is affectionately known as a Satoshi).

I bought mine on Gemini (screenshot below) - I wrote about Gemini in my Dive Right In - Getting Started With Bitcoin post, Gemini and GDax are good options in the US.

Gemini Buy Bitcoin.png

Using Bitcoins

To send Bitcoin, you usually need the following:

  • Wallet address: This is like an email address or phone number. It uses the same hash format (SHA 256) that we discussed in the Mining Hashes and Nonces - the evolution of Cryptocurrency post. Often a QR is used to share the long address visually.
  • The amount you want to send: This is in Bitcoin or the equivalent amount based on your functional fiat currency (chosen in the settings tab)
  • The fee amount: We need to pay the miners a fee to process the transaction (i.e. add it to the block). With Gemini the fees are automatic (and often free) with Airbitz they suggest a fee which you can change.

Below are screenshots of Gemini's transaction screen ("Withdraw BTC"). Check out this video if you want to use Airbitz instead (recommended).

Withdraw Bitcoin Gemini.png

It's good practice to send all your money out of Gemini into a proper wallet so you have full control of your funds. Remember, Gemini, GDAX, Coinbase etc. are exchanges not wallets (hence they use the word "withdraw" instead of "send/pay").

The MemPool

After you make your transaction, the money doesn't transfer straight away. Instead it sits in a queue waiting to be processed. During this time you should see it in your wallet's transaction history as "pending".

Here is a snapshot of the queue of transactions ("Mempool").

You can see it live here.

Mempool Bitcoin.png

Miners can only fit 1MB of transactions into each block and they choose the transactions themselves - so logically they choose the higher fee transactions first. You skip the queue by paying more - capitalism at its purest. If you want to set your fee manually, this website helps you determine the appropriate fee based on the urgency/time required: https://estimatefee.com/

Proof of Work

Only one miner gets to add a block to the block chain which should only occur every 10 minutes or so. To earn the right, miners have to compete to solve a "proof of work" task (refer to my previous post, Mining Hashes and Nonces - the evolution of Cryptocurrency).

Essentially they use trial and error to find a random number (a "nonce" - you guessed it, etymology nonsensical) which when added to a combination of the transaction data and the previous hash, results in a new hash with a certain number of leading zeros.

The famous Hello World example is below - the nonce (random number) of 4250 results in a new hash with 4 leading zeros.

Sha 256 Hash Proof of Work.png
http://passwordsgenerator.net/sha256-hash-generator/

Difficulty Adjustment

The puzzle is meant to take about ten minutes to solve. If miners start to solve it more quickly, Bitcoin automatically adjusts to make it more difficult (it does this by increasing the number of the leading zeros). If it takes too long to solve, they decrease the number of required zeros.

At the time of writing, it takes 17 leading zeros to solve the proof of work. You can see this yourself by clicking on the most recent block here and counting the number of leading zeros next to "Hash". The site even tells you the winning nonse.

Folk.Lol provides a handy website where you can see when the next difficulty adjustment will be. At the time of writing, it will be in ~2 weeks and should make it easier for miners, about 3.3% easier.

Bitcoin Difficulty Adjustment.png

Block Explorer - your transactions are public, not anonymous

Bitcoin is fully transparent - a point that many people fail to recognize. When someone gives you their wallet address (so you can send them money), you can look up their account balance and the history of all their transactions!

To protect your privacy, your wallet address is a pseudonym - a long hash that no one recognizes. Dodgy people no doubt use multiple wallets to confuse police and distance themselves from the exchanges that require IDs. Nonetheless, the government can always "follow the money" - if you use Gemini to buy Bitcoin, they've linked you to all the addresses you send funds to.

Are you familiar with Ross Ulbricht's Silk Road website? Here is the US Marshall Wallet that sold his Bitcoins.

The US Marshall sold 29,658 of his Bitcoins on 01-07-2014, that's currently ~USD240m. You can google his wallet address too - he used heaps so it's not so easy to see, but you get the point, it's public.

Ross Ulbricht Block Explorer.png
US Marshall Wallet Address for Ross Ulbricht Coins - Silk Road

This was part 4 of a series I'm writing on cryptocurrency. Check out part 1, part 2 and part 3.

The next post, Byzantine Generals, Why Bitcoin has Miners and How Secure is Bitcoin is here.

Upvotes are appreciated for motivation. Comments/questions/corrections are welcomed. 🙃

Sort:  

kudo, interesting read

Thanks nortek!

XRP strong buy soon on coinbase. Check out this free app from Coinbase that lets you conveniently and securely store, and trade digital currencies like bitcoin and ethereum. You can get it from http://goo.gl/cb5NZe

Hi outifdebt, as far as I'm aware Coinbase has not announced any plan to include XRP yet.

Coin Marketplace

STEEM 0.16
TRX 0.12
JST 0.028
BTC 54953.89
ETH 2913.89
USDT 1.00
SBD 2.03