Bitcoin

How Does Bitcoin Work? A Guide to Understanding Bitcoin

You can start using Bitcoin in a matter of seconds and, although it is a very simple process, it is strongly recommended that you learn about how it works and what is happening to your coins when you make a simple transaction.

With Bitcoin it is you who has control over the money and you need to take care of it responsibly.

The following text is a very simple guide that will introduce you to the nature of the Bitcoin network and explain what happens during a Bitcoin transaction in a very simple way.

The Story of Alice and Bob

Once upon a time… there was a reddit user called Bob who wanted to send his friend Alice some bitcoins. He knows that Alice needs 10 BTC and so he decided to send them to her.

Bob has got a Bitcoin Wallet with some bitcoins and before clicking the send button he wonders where his bitcoins are actually stored. “Is every Bitcoin a file on my computer? Or a serial number maybe?

Bob quickly notices that this would be very inefficient. What would happen if someone was spying on his connection and intercepted this files? And what would happen if the connection dropped?

No. The way Bitcoin works is simple and elegant.

When Bob sends Alice 10 Bitcoin, what he is actually doing is digitally signing a declaration of payment. In human language this would look something like this:

“I, Bob, send the amount of 10 BTC to Alice”.

Of course, Bob is also worried that someone might actually forge such a declaration in his name. He also knows that bitcoins are impossible to forge. So how exactly are they protected?

These declarations are protected by a mechanism known as Digital Signature. It is an implementation of mathematics and very strong cryptography that guarantees that only the owner can produce a valid signature. Else, the signature would be invalid and the transaction would be rejected by everybody.

Digital Signatures

You probably already know that in order to receive and send bitcoins you need a Bitcoin adress. Just like with email. And just like with email you need “your password” to be able to send and receive bitcoins.

Bitcoin Adresses are generated using mathematics and they can be generated in a decentralized manner. You don’t need to login anywhere nor do you need to be online. You just need a program capable of generating such an address.

A Bitcoin address, just like your email account, is made up of two different things:

  • A public part – Give this to anybody so they can send you bitcoins.
  • A private key – This is what most users don’t know. Each Bitcoin address has got it’s own very unique key. Most Bitcoin programs don’t tell you about this and they keep the keys hidden from the user, basically because it is very important that ONLY you have access to this key and showing them around is not a good idea.

This is the key used to digitally sign a transaction and to guarantee that only the owner of the key can emit a valid transaction and thus spend those bitcoins.

Back to Alice and Bob

Once Bob’s bitcoin wallet has signed this transaction, he sends it across the Bitcoin P2P network. All people who use Bitcoin and are running a Bitcoin client, are connected to each other in order to receive and send these “declarations”.

Bob’s transaction gets relayed from node to node. These nodes verify that the signature is valid and pass it on until, in a fraction of a second, Alice gets notified by her Bitcoin program that she got bitcoins from Bob!

“Nice!” Alice thinks. But at the same time she’s worried about something else. Alice knows how the Bitcoin network works and ponders whether it was possible for Bob to make up that amount.

She knows for sure that it was Bob who sent the money because the digital signature matches. But what would have stopped Bob from writing down any arbitrary amount? What if Bob would have said “I give 1 Bazillion Bitcoins to Alice?”. Whie Alice keeps thinking about it, she is unaware that the transaction that was sent to her is still hopping around the network and has a very important role to play…

Meet Miner Steve

As the transaction keeps hopping from node to node in the Bitcoin network, it will also reach this person who is playing a very peculiar game: a sort of racing game. Steve and many other people who “play” this same sort of game are called miners.

Steve’s objective is to collect all transactions and publish them in a sort of ledger. In order to guarantee Bitcoin’s decentralized and open nature, this must be done in a very specific way.

Miner Steve and other miners are running a program on their computer that helps them solve extremely difficult mathematical problems. Steve knows that only the miner who finds the solution to such a problem is authorized to publish the next block of this ledger that contains all the collected transactions.

All miners are competing with each other because they want to be the first to solve the problem, publish the transactions and get a Bitcoin reward for it. (Actually more than a game it’s a job).

In order for Bob to have 10 BTC in the first place, he must have gotten them previously from someone else. Steve checks the part of the ledger that has already been published previously by other miners and makes sure that the transaction is there, recorded somewhere. This tells him that Bob had 10 BTC in the first place and is thus authorized to spend them. Then he just hopes that, with a little bit of luck, his computer program is the first one to find the solution.

Guess what? Today’s Steve’s lucky day! He finds the solution and immediately publishes all the transactions he has collected. The rest of the network verifies that the solution is correct and watches dumbfolded as Steve gets the reward. But there’s no time to lose because new transactions never stop arriving and new blocks of this ledger always await to be published.

The Blockchain

This ledger is known as the Blockchain. It is called a chain, because all published blocks depend on the previous. They are protected by a cryptographic function known as hash.

What if someone decided to maliciously edit a previous block and assign themselves thousands and thousands of bitcoins? Fortunately this is impossible. If one were to change one single digit, character or bit from the blockchain, all following blocks would be invalidated.

Also, notice that not even Miner Steve can maliciously edit Bob’s transaction because the digital signature would not match if he tampered with it.

The openness, transparency and decentralized nature of the Bitcoin system together with the use of these protection mechanisms create a solid, strong and reliable Bitcoin network, where absolutely no one can cheat.

Back to Alice

As soon as Miner Steve published the next block of the blockchain, it was redistributed over the whole network until it reached Alice. Once it got to Alice, her Bitcoin Wallet Program checked it to see if there were any transactions that involved her and, as it was the case, made sure to inform Alice that her transaction was confirmed and is now a permanent part of the Bitcoin network. Transactions that are included in the blockchain receive a confirmation.

Notice how Alice doesn’t need to be online in order to receive bitcoins. She could be offline for hours, days or years and still receive bitcoins with no problem. As soon as she gets online, her program will download the latest blocks of the blockchain and inform her of any incoming transactions.

Actually, the only thing Alice will ever need is her private key. She can even keep the private key printed on a piece of paper (paper wallet) and receive bitcoins at the same time.

Once she wants to spend them, she would import the private key to a Bitcoin Wallet Program and the program would then read the blockchain to inform her about her balance. Also, since she’s got her private key she will be able to digitally sign a valid transaction and spend them.

Take a look at http://www.bitaddress.org . This is an online Bitcoin Adress generator that lets you see the private key.

About Bitcoin Security

As you can see, Bitcoin is extremely secure and absolutely no one who does not know the private key to a public address will be able to spend bitcoins without authorization.

You are the sole owner of your bitcoins and it is thus your responsibility to keep the private key to those coins safe. Many bitcoin wallets will encrypt these keys using a password you provide. This is extremely recommended.

Also make sure that your computer is free from keyloggers, trojans and malware. If you hold large amounts of coins you might want to consider creating a paper wallet, as no virus in the world can get in your drawer and printed documents.

Where does Miner Steve get the reward from?

He gets it from the voluntary fees that are included in each Bitcoin transaction. That’s why he wants to collect and publish as much transactions as possible because he gets the fees associated with them.

Also, every time he publishes a block he’s allowed to write his name in the new block and assign himself 25 newly minted bitcoins. This is how new bitcoins get into circulation and injected into the economy in a decentralized manner. This reward will gradually decrease until there are 21 million bitcoins in circulation, which is the maximum amount that will ever be available.

Are 21 million bitcoins enough? Yes, because they are divisible up to eight decimals. This amount of divisibility guarantees that there will never be a lack of bitcoins.

Why does it take so long for my Bitcoin Wallet to synchronize?

The first time you run a full Bitcoin Wallet, it’ll need to download the Blockchain in order to read it and keep you updated on the Balance of your addresses.

If you don’t like this or can’t wait, you should use a light client. These are Bitcoin Wallets that connect to a server to read the blockchain and don’t need to download anything.

This is it! Don’t redistribute it until I’ve got feedback and corrected any mistakes. The whole text is Creative Commons BY – SA

This Article was Written by u/DanielTaylor. Donations appreciated: 18pYzN97CxB8qfUwoBbAFYvD3rGs9rjbH3