What is Bitcoin and how does it work

  • (5.0)
  • | 675 Ratings


In traditional financial transaction system the buying party and selling party, need an intermediary usually a bank or a financial institution to facilitate and keep records of the transaction. The trusted intermediary charges money to facilitate transaction and asks important and sensitive information about involving parties. 
To solve this problem and eliminating the intermediary Satoshi Nakamoto (Pseudonym) introduced Bitcoin and devised first Blockchain database.

What is Bitcoin?

Bitcoin is a decentralized, peer-to-peer electronic crypto currency. There is no governing body or issuing authority for Bitcoin. Bitcoin network operates on cryptographic protocol and the public database is fault tolerant and resistance to corruption. Bitcoin network operates without a central repository or a centralized administration and the transactions directly takes place between users.  
Bitcoins can be converted to other real world currencies and can be used for payment. Bitcoins are created by mining. Mining is the process by which volunteers known as miners lend their computing power to verify transactions and record them in a public ledger. Miners keep the network secure.


Blockchain is a distributed database. In Bitcoin network Blockchain is a public ledger that records transactions. It is fault tolerant and resistance to modifications that can corrupt the records. All nodes share a copy of Blockchain, when a node joins the network it downloads all the blocks and verifies it. So modifying the Blockchain is nearly impossible, as everyone in the network has its copy and if someone modifies it, all other nodes will reject the modified block. Blockchain contains all the transaction history that ever been happened in the network.
Each block has a hash value referring to the previous block. 

Related article: Getting To Know Bitcoin That Works On Blockchain Platform

Genesis Block:

Genesis block is the first block in block chain. It does not have a hash value referring to previous block. Genesis block was hardcoded and fist mined by Satosi Nakamoto. To mine genesis block it requires custom codes.

How are Bitcoins generated?

Bitcoins are created by a proof of work concept known as mining. Mining is the process by which miners lend their computing power to verify and record a transaction into the Blockchain. Bitcoin mining is a difficult process and requires a lot of computing resource. By verifying the transactions miners prevent double spending of bitcoin. Without miners, the network would be vulnerable and hence for their volunteer service miners are awarded with new Bitcoins.

While the software and network was created for first time, Satoshi Nakamoto mined 50 Bitcoins as a reward of mining the genesis block. 21 million bitcoin will come into existence ever.
The block reward started at 50 bitcoins per block, and halves every 210,000 blocks. This means that each block up until block 210,000 will reward 50 bitcoins, but block 210,001 will reward just 25. Block halving happens every four year with an average 10 minutes time for a block.

Value of Bitcoin:

Bitcoin is just like any other currency and can be used for trade exchange. Value of bitcoins have increased a lot from last 7 years and changes just like gold and you have to check the market to get the value for the day.

How do you get Bitcoins?

You can create a wallet by downloading a wallet software. There are many wallets available for bitcoin both software and hardware based wallet. Wallet will give you a payment address and a private key. The private key is very important and if lost you cannot access the wallet and all Bitcoins will be lost. Once you generate your address, you can accept payment. 

You can request payment online being completely anonymous and share your payment address to the payee. You can buy bitcoins from coindesk, zebpay, and there are other apps who trade in bitcoin. But before buying and investing in bitcoin you should check auctions sites to get bitcoin value.

Bitcoin can be earned by mining. However, mining is a pain taking process. It involves highly sophisticated custom mining devices and lot of electrical power. Before investing in you should run a profit calculator.

How does Bitcoin make money?

Bitcoin is an open source software and the network is public. There are no owners of the bitcoin network and the developers does not make any money by creating it. However, they can receive donations. The network is self-sufficient due to volunteers mining and verifying the block and the miners who are rewarded by new bitcoins.

Bitcoin Mining

Bitcoin mining is resource intensive and compute intensive difficult task. By mining miners verify and transaction to the block and make it secure. By design the mining process is difficult so that the number of blocks may remain steady each day as found by the miners.

Enthusiastic about exploring the skill set of Bitcoin? Then, have a look at the Bitcoin Training Course together additional knowledge. 


By mining the miners run the proof of work algorithm that converts the transaction data to a 64 digit hash and the hash must be less than or equal to the target value.
Now the hash must follow certain rules. It should start with at least eight leading zeros. So miners generate random nonce to create the hash.

Nonce (Number only used for once) is a 32-bit field. It is generated randomly and if a hash contains a nonce that is less than or equal to target value than the block is verified and bitcoins are rewarded. If you change the nonce the hash will be completely different.

To generate the hash many nonce value are given input and each time computation runs to generate the desired hash.

The mining algorithm Bitcoin uses is called Hashcash and is derived from Back’s Hashcash algorithm [B+02]. The idea behind the algorithm is that the miner needs to assemble a block in such a way that the hash of the block header is the solution to a partial pre-image of a hash, i.e. the hash digest that is produced by hashing the header needs to be below a well defined numerical value. The hashing algorithm used is the NIST standard SHA256. The header is actually hashed twice to be a valid block, where the difficulty is a numerical value that needs to be bigger than the resulting hash value: difficulty > h(h(BlockHeader)) From the properties of cryptographical hash functions (see Section 2.1.1), it is infeasible to find such a value – except to try and brute force the output, which is exactly what the miners do. Of course, the block header has a certain structure, so all values cannot be changed at random.

The consensus protocol of Bitcoin has been dubbed Nakamoto Consensus after the original idea from Satoshi Nakamoto [Nak08]. The Nakamoto consensus is a strategy of operation that makes it so, if most nodes adhere to it, the biggest reward that can be gained for a node is achieved by staying with this strategy.

Now the mining fees for each successful block each 12.5 bitcoins.

Purpose Update time Size (bytes)
Version Block version number Software upgrade time 4
Hash of previous block 256 bit hash of previous block A new block comes in 32
Hash Merkel root 256 hash of all block headers A transaction is accepted 32
Time Current Unix timestamp Every few seconds 4
Bits Current target in compact format The difficulty is adjusted 4
nonce 32-bit number (starts at 0) A hash is tried (increments) 4

Bitcoin uses hashcash algorithm for computing the SHA256.


Example python code:

import hashlib
>>> header_hex = ("01000000" +
 "81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" +
 "e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" +
 "c7f5d74d" +
 "f2b9441a" +
>>> header_bin = header_hex.decode('hex')
>>> hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
>>> hash.encode('hex_codec')
>>> hash[::-1].encode('hex_codec')

import hashlib, struct
ver = 2
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"
time_ = 0x53058b35 # 2014-02-20 04:57:25
bits = 0x19015f53
exp = bits >> 24
mant = bits & 0xffffff
target_hexstr = '%064x' % (mant * (1<<(8*(exp - 3))))
target_str = target_hexstr.decode('hex')
nonce = 0
while nonce < 0x100000000:
    header = ( struct.pack("


0            5c56c2883435b38aeba0e69fb2e0e3db3b22448d3e17b903d774dd5650796f76

1            28902a23a194dee94141d1b70102accd85fc2c1ead0901ba0e41ade90d38a08e

2            729577af82250aaf9e44f70a72814cf56c16d430a878bf52fdaceeb7b4bd37f4

3            8491452381016cf80562ff489e492e00331de3553178c73c5169574000f1ed1c

39            03fd5ff1048668cd3cde4f3fb5bde1ff306d26a4630f420c78df1e504e24f3c7

990            0001e3a4583f4c6d81251e8d9901dbe0df74d7144300d7c03cab15eca04bd4bb

52117            0000642411733cd63264d3bedc046a5364ff3c77d2b37ca298ad8f1b5a9f05ba

1813152        00000c94a85b5c06c9b06ace1ba7c7f759e795715f399c9c1b1b7f5d387a319f

19745650        000000cdccf49f13f5c3f14a2c12a56ae60e900c5e65bfe1cc24f038f0668a6c

243989801        0000000ce99e2a00633ca958a16e17f30085a54f04667a5492db49bcae15d190

856192328        0000000000000000e067a478024addfecdc93628978aa52d91fabd4292982a50

Mining Systems:

CPU: When bitcoin came, first it was possible to mine using CPU. However, CPU mining is not efficient and the computing cost does not generate profit. Therefore, CPU mining is now removed from client software.

GPU: GPU mining are faster compare to CPU mining. However, the system costs very high price.

FPGA: Field Programmable Gate Array mining is faster and efficient way to mine.

ASIC: Application Specific Integrated Circuit are specially purposed hardware for bitcoin mining.

Cloud Mining Pool: You can join a pool at a price to mine bitcoin.

How does bitcoin works?

Bitcoin works as a decentralized peer-to-peer electronic payment system. We can get started without understanding much technical details about it. Once you get a wallet and have some bitcoin you can start transaction. Bitcoins are accepted as a trading currency.

You can have as many as bitcoin address for accepting bitcoins.

Bitcoin Usage:

Bitcoin is accepted by many businesses.

Most VPN providers and file sharing services use bitcoin to accept payments and donation in form of bitcoin and as there is no central authority and bitcoin is peer to peer no one can hold on releasing funds.


Frequently asked Bitcoin Interview Questions