Walking through the code of BITCOIN (SV)

Walking through the code of BITCOIN (SV)

11 September, 2019 0 By Raul Pelaez

 

Today I would like to show you a little bit about the Bitcoin guts, that is, the code, that set of magic phrases or “spells” that make up the entity called “Bitcoin” and its most recent evolution by the same creator, Dr. Craig Wright, that is, Satoshi Nakamoto called Bitcoin SV or Satoshi Vision.

Let’s start with the block size that is one of the big differences between the versions of Bitcoin:

The block size limit in Bitcoin v0.01

In main.h (line 17) we have a constant MAX_SIZE

static const unsigned int MAX_SIZE = 0x02000000;

which in decimal format equals 33554432 (32 MB)

This constant is used to verify if the block exceeds the size limit in main.cpp (line 1154)

 bool CBlock::CheckBlock() const { // These are checks that are independent of context // that can be verified before saving an orphan block. // Size limits if (vtx.empty() || vtx.size() > MAX_SIZE || ::GetSerializeSize(*this, SER_DISK) > MAX_SIZE) return error("CheckBlock() : size limits failed"); ... }

According to the GIT version control history, Gavin Andersen added line 18 of the history to main.h (see):

static const unsigned int MAX_BLOCK_SIZE = 1000000;

In other words, all this means that Satoshi already had an idea of increasing the block size progressively over time in the code, always thinking (I suppose) of Moore’s mythical Law that states that approximately every two years the number of transistors doubles in a microprocessor

If we look at the current Bitcoin core code, it can be seen that they have not yet defined the variable in the consensus.h file … nor a trace of it. You could say that the development of Bitcoin (core) has died.

Captura-de-pantalla-2019-08-30-a-las-19.27.04

If we go for example to Bitcoin (cash) ABC (or also known as BCH ABC, where ABC means Adjustable Blocksize Cap). We can see the clear difference about the evolution or enlargement of the block size. Specifically 8 MB that had 32MB Bitcoin Cash that has BCH ABC.

1563624244_356_bitcoin-cash-milestones-delivered-code-upgrades-and-platform-development

We can see more code (and more updated) here:

Captura-de-pantalla-2019-09-10-a-las-19.20.08

If we go through Bitcoin SV now, we can also observe the changes they announced of impressively large blocks of up to 2GB, so we already see there in the code a constant of 1GB (ONE_GIGABYTE)

Captura-de-pantalla-2019-08-30-a-las-19.30.14

And we can also observe the 2 GB limitation in the policy.h file (see)

Captura-de-pantalla-2019-09-10-a-las-20.11.04

I like it, because in addition the BitcoinSV Community has created very good specifications for anyone who wants to experiment with the Mining theme (see)

Walking, walking, we can go and see the famous maximum amount of Bitcoins available and see what part of the code is the limitation. If we observe the Bitcoin code (core) we can check those 21 Million Bitcoins. The constant is called MAX_MONEY as it could not be otherwise.

Captura-de-pantalla-2019-08-30-a-las-19.39.27

If we now go to the same amount.h file, but in BITCOIN SV we can see that there are practically no differences, given that the limit is the same of 21 Million BSV.

Captura-de-pantalla-2019-09-10-a-las-20.20.38

Did you like the post? If so, put it in the comments and we will make more posts like this. Regards

By MrAddon for CoinMarketRank & Ankonan

 

More from Ankonan.io