A Bitcoin Primer

What makes Bitcoin tick? Starting with a short historical and terminological overview, you will then dive straight into what's going on under the hood.

A Bitcoin Primer

Bitcoin is a form of digital currency based on the Blockchain and allows the owners to mine, transfer and store funds in their digital wallets. The network grows every day and more and more shops, services, and investors are accepting this kind of payment in their business. In this chapter, I will give you an introduction to the Bitcoin world, explain the basic terms and how it works. If you want to become a blockchain developer, this is the perfect point to start — from the very beginning, with the most popular cryptocurrency.


Bitcoin was mentioned for the very first time in October 2008, by an individual or organization called Satoshi Nakamoto. He or she published a paper on a Cryptography Mailing list explaining a new idea of a cryptocurrency called Bitcoin that was decentralized, transparent, anonymous, and cryptographically secured. On the 3rd January 2009, they published the Bitcoin software and mined block 0. Until mid-January, all mined funds remained untouched.

Satoshi mentioned that Bitcoin's purpose is to handle micro-transactions without any broker between the sender and the receiver, i.e., without a bank or a government that could block your assets, cancel the transfer, or freeze the account. With Bitcoin, you are the money owner with all the rights and obligations. It is a huge responsibility. If you transfer funds to a wrong account or even to the wrong network (that happens surprisingly often), it will be gone.


Bitcoin can be described as a ledger of transactions. Every transaction can be explained by a simple sentence.

Some amount of funds is transferred from address A to address B and signed by A's owner with their private key.

This sentence introduces a couple of terms that are fundamental for Bitcoin — the address, the transfer, and the private key. There are a couple more that I will explain — a block, a confirmation, etc.

Imagine that you write this sentence on a piece of paper and give it to your friend. He also wants to make a transfer, so he writes his own sentence below yours in the same format — word for word — and changes only the A, B, and private key variables. The paper goes to the next person until there will be no more place to write or until the time frame will end. After 10 minutes, the paper is put on the stack, on the top of other similar papers.

This stack is the blockchain, a single piece of paper is a block, and the sentence you wrote is a transaction.

Bitcoin is a digital currency, and the general perception of the money transferring mechanism seems to be pretty similar to Internet Banks. I bet you have one or two open accounts in some Internet Bank. Those accounts are just numbers. To get access to those accounts and manage your money, you need to enter your username and password.

When you log in to the bank’s website, it is possible to make a transfer by filling the amount, a title and a receiver’s address. In most banks, it is not mandatory to put all information about the receiver, like the name or address.

Bitcoin generally works in the same way and may be compared to the Internet Banks, but with few differences.


The Address

If you want to start playing with Bitcoin you need to open an address or a wallet — that is how many addresses are called. Because Bitcoin keeps the users anonymous, some of the information has to be omitted — like the name or the transfer title.

Opening a new address can be as easy as registering a new email address. There are many services and applications that have an interface for Bitcoin wallets, like bitcoin.info or blockchain.info. A new address can be opened from the web browser without installing any additional software on your computer. Usually, the account will be protected only by a password, and if you would like to use this address from other services, a private key should be generated.

Another method to open a new address is to install one of the node applications like the Bitcore, the btcd, or the Bcoin. The difference between the software installed on your computer and services available on the Internet is that, for the former, no one keeps the password to your account but you. However, installing the Bitcoin node requires 160-200 GB of free space on the disk and a couple of days to download and synchronize your database with the public Blockchain.

The Wallet Address

The Wallet Address is a specific kind of address that you can login into. For every transaction, a new address should be generated (see The Transaction section). It does not mean that you should keep all the addresses and private keys for them to manage your funds. All new addresses will be automatically assigned to your wallet. All funds received by any of the assigned addresses will automatically be counted into the wallet balance.

The wallet number should not be used for any transaction and should not be shared with anybody else.

The Transaction

As I described before, the transaction can be described as a statement that some number of Bitcoins are moved from address A to address B and signed by address A’s owner's private key. This is the simplest situation that may occur in the blockchain. If you run an e-commerce shop that sells much stuff in one day, you will receive many transfers. Usually, every transfer will have a defined title related to the order number in your shop. Because of the anonymity that the Blockchain provides, there will be no title in the transfer, and it would be irrational to ask your customers to paste their Bitcoin address into every order.

Requesting Payment

In Bitcoin, if you would like to request a payment from someone else, you generate a unique address for this specific payment or a specific person. So, you, as a wallet owner, can have many addresses and generate a new one every time somebody needs to pay you with Bitcoin.

In the e-commerce shop, when the user selects the Bitcoin payment method, a newly generated address should be presented to him. A QR code is usually generated with the address because many users are using their smartphones to pay with Bitcoin. It is recommended to avoid rewriting the address by hand, as every mistake will cause the money lost.

The generated address should be saved in the database and assigned to the order. When the user makes the transfer, the funds appear at the generated address, and the user or the order can be recognized by this address.

There is no need to generate a new address for every order. They can be generated for a specific user or for a specific case. That depends on your business needs — if you run an e-commerce platform, then payments should be related to orders. If you run an investment or ICO project, then maybe it is best to generate an address for a user, and when you are raising money by an application similar to the Kickstarter, you may consider keeping only one address per project.

Making a Transfer

Let us consider another point of view — the returns. We will stick to the e-commerce example for a little bit longer. If somebody orders a dress and it does not fit, they should be able to return the order and receive the money back. The application should ask for the pay-back address. This address should be generated by the user, but it is not necessary.

The system prepares the transfer and publish it to the blockchain. This transfer will not be confirmed until it is mined with the next block. Moreover, there should be a fee added to the transfer which will be received by the miner. The fee is set by the sender and should be balanced to keep it low, but not too low, because it may happen that the transfer remains waiting on the pending list forever.

I described that a transfer could be described as moving funds from address A to address B. But, as I wrote before, the funds are counted to the Wallet. If you received 10$ to 10 different addresses and would like to make a payment for 10$ you do not need to make 10 different transfers. In Bitcoin, every unit is assigned to your wallet, and you make a payment from your wallet and sign it with your wallet's private key. In the Blockchain, the transfer will be presented as a transfer from those 10 different addresses to the receiver address.

This transfer is done by one user that received his funds to a couple of different addresses that are listed on the left side. If the amount of money does not match the amount of money that is sent to the receiver, the rest is transferred to a new address that will be assigned to your wallet. If the numbers match, there will be only one address on the right site.

The Fee

Every transaction needs to be sent with the fee. The miner will be rewarded with this fee when the transaction is added to the next block. All miners want to earn as much Bitcoin as they can so transactions with the highest fees will be mined first. The Bitcoin algorithm does not specify the lowest fee, so it is possible to send a transfer without any fee, and some of the miners accept transactions without fees, but this is a really rare situation. Most likely, this transaction will remain stuck on a pending list.

The Block

The block is a set of information with a list of transactions. The block is defined by its hash number, the previous block's hash number, and the list of transactions. Every block is published in approximately 10 minutes. That means if you send a proper transaction with the fee high enough to be mined in the next block, the block with this transaction may be published in next 2 minutes, next 10 minutes, or next 60 minutes (with another 6 blocks).

When the transaction is added to the first block, it is already confirmed.

The Blockchain

The Blockchain is a ledger containing all published and confirmed blocks in a specific, chronological order. All blocks that are added to the blockchain are safe and cryptographically confirmed. The question is, what happens if somebody wants to add a wrong block to the blockchain? Bitcoin provides a mechanism that secures this state called mining or proof of work. Those two terms define the same thing.


When you receive a transfer to your bank account, you trust that that money can be spent. Bitcoin does not provide a true/false value that says the transaction was successfully processed, but gives a number of confirmations. Because some of the blocks may be orphaned (for different reasons) the number which you trust should be balanced with the time of confirmation.

That happens because while every block is mined in approximately 10 minutes, it depends on the fee and the blockchain load. So, if you would like to be pretty sure that the payment is secure, then it has to have more confirmations. This implies that it requires more time — 1 confirmation takes 10 minutes, 6 confirmations take 60 minutes.

My professional experience says that we can divide the payment types into 3 different groups, depending on how much we trust the sender and how much money we are willing to risk losing in the worst case:

  • Small transactions — usually e-commerce websites have a lot of them. Most of those transactions are below 50-100 USD. Moreover, the time between the transaction and the moment when an order will be sent is a day or two, so only 1 confirmation is enough to trust the payment.

  • Medium transactions — in this case, let us say you raise the payments for 1,000 USD or more. Losing this kind of money will not cause huge damage to your business, but it is a good idea to secure them better than 1-2 USD payments. It is quite unusual for 1 miner to be able to confirm 3 blocks in a row, so 3 confirmations.

  • Big transactions — the ICO projects became more popular lately. Even if some say that the trend is calming down, those project still raise significant amounts of money. A single investment can be more than 500,000 USD, and in selected projects, the tokens are distributed just after the transaction is confirmed. For those transactions, it is necessary to make sure, that it is 100% confirmed, but the confirmation time is not so relevant. Mining 6 blocks in a row is virtually impossible, so I prefer to wait for 6 or more confirmations from the blockchain.


Much trust is put in the mining mechanism when we think about the Blockchain, Bitcoin, or other cryptocurrencies. The algorithm should secure the network and prevent double spending. To ensure that can happen, the blocks should be published in correct order. To keep this order and propagate blocks to all nodes, Bitcoin allows publishing a block in approximately 10 minutes. This time or the process does not depend on the computational power of a computer or a computer's network. If the computation power allows for mining the block faster than in 10 minutes, then calculations for the next block will be harder and will take more time. On the other hand, if the block were to be published after 10 minutes, that means it was too hard to calculate, and the difficulty level should be adjusted.

Mining should be a hard process that takes a lot of resources and time. However, confirming that the block is correctly mined should be fast and easy.

Discard the Dice

Imagine that you have a 12-sided dice in your hand and you have to discard all values lower than 6. You roll the dice until you have an expected result. Moreover, let us agree that we will be doing that over and over again, and each time that we get a correct result, we will call it a block. Our job is to make sure that every block is mined in approximately 6 discards.

If you need to discard the dice more than 6 times per block, you adjust the number to be lower than 7 (6 plus 1) for the next block. In the opposite situation, when it took less than 6 rolls, we make the process harder by rolling a number less than 5 (6 minus 1).

In our game, the mining mechanism requires a simple action to be repeated several times until the expected result is achieved.

However, if somebody else looks at the table, they may easily confirm if the last result is correct or not.

How it Works in Bitcoin

Of course, the previous example is simplified to show the general idea of the mining mechanism — that the block should be hard to generate and easy to confirm. The Bitcoin node has access to a list of pending transactions and creates a block that contains all accepted transactions (usually in a fee order, from the biggest to the lowest). All the information included in transactions have to take up less than 1MB and the calculations complexity has to be lower than the computationally difficult level set with the previous block.

The node takes some selected amount of transactions and calculates the SHA-256 hash for them. The difficulty level requires a minimum number of zeros at the beginning of this hash. If the number is bigger, the block is accepted and can be published to the blockchain. If not, the node takes another set of transactions and starts the calculations from very beginning. This process is repeated for the next 10 minutes until a new block is mined.

Proof of work is not only used by the Bitcoin blockchain but also by Ethereum's and many other blockchains.

Proof of Work vs Proof Of Stake

Proof of Work refers to cryptocurrencies such as Bitcoin and means that the miner is rewarded for the calculations needed to create a new block.

Proof of Stake is a different way to validate the transactions. The creator of a new block is chosen in a deterministic way, depending on its wealth, also defined as stake. So, he takes only the fee from all transactions included in a block with no pre-defined reward. The miners in the Proof Of Stake networks are called forgers.

The next difference is that, in the Proof of Stake mechanisms, all the coins are generated initially, and their number never changes.

The Proof of Stake algorithm is meant to limit the electricity that is consumed during the mining process. A single Bitcoin transaction requires electricity worth $8, and in one block, there are about 2000 transactions included. Because the PoS does not reward the fastest miner, but one of the forgers from the validation pool, the need to use high-powered computer networks will be limited.


Now, you know all the basics about the Blockchain and the Bitcoin. These sections defined all the most important terms and explained the mechanisms. You need to remember what the blockchain, the block, the transaction, the confirmation, the fee, and the mining mechanism are. In the next part, we will set up a Bitcoin node, make and simulate the first transaction and explain step-by-step what happens.

04 Milestones


We help you execute projects by providing trusted Blockchain developers who can join your team and immediately start delivering high-quality code.

Hire Blockchain Developers