How to study Bitcoin source code?

in #bitcoin7 years ago (edited)

This tutorial series is the most satisfactory answer to the most asked question: how Bitcoin works? this tutorial is focused on the study of Bitcoin application compiled from the source code.

You don't need to be a computer genius to understand how Bitcoin works you just need to know some basics of C++ programming language to differentiate between classes and its members, you must have the ability to read code as its the ultimate expression of Bitcoin design.

first, you have to start with the most basic C++ implementation of Bitcoin, in this tutorial, we will start with satoshi client Bitcoin v 0.1.5 ALPHA, it's not that far from current implementation as they share the same classes and functions.

Before starting this tutorial I will have to first give an eye-bird view on what Bitcoin application do in general when it's compiled from the source code, what it do?. A Bitcoin application handles four major tasks:

1- Construct a transaction: the main function of the Bitcoin application is to send Bitcoins to someone. So firstly you need to create the transaction the transaction itself is just a record of who paid to whom and how much he pays

2- Communicate with other Bitcoin applications: the first thing your Bitcoin application to do is to broadcast the newly created transaction to other Bitcoin applications that are currently connected to the Bitcoin network, the reason behind that broadcasting is to tell everyone that your ready to initiate a transaction. To achieve that all Bitcoin applications implement using a peer to peer protocol to communicates with each other, the point behind peer to peer protocols is that any node on the network can communicate with any Bitcoin network node directly without the need of intermediaries to be included

3- Mine a block: the other main thing a Bitcoin application to do is that after collecting enough number of transactions, Bitcoin application will back them together to form a block and start hashing the block data into a certain format, that process called mining, the process is specified in such a way it takes a considerable amount of computational power to find that hash that must be compatible with the same format the block data format, after that the block must be broadcasted to all the network.

4- Maintain the Blockchain: while receiving new blocks Bitcoin applications firstly will try to validate all transactions in it, and that all transaction are hashed in a compatible format, after that blocks will be chained to other mined blocks, one after another to form a chain of blocks finally, each node will have its own blockchain and then they communicates with each other via Bitcoin peer to peer protocol to reach consensus on which is the longer block chain, that is the final ground-truth, after that each node converge its own blockchain to the ground truth.

finally studying Bitcoin source code is a must

Sort:  

great work..please upload more tutorials..

Coin Marketplace

STEEM 0.20
TRX 0.13
JST 0.030
BTC 65733.39
ETH 3506.40
USDT 1.00
SBD 2.51