# Cryptographic roots in Blockchain technology

The Blockchain is expected to be the revolutionary technology to take the centre stage in our society where the traditional ledger system once dominates, from bitcoin that emerged in the finance sector to fields where transactions are dependent on authenticity, be it a paper document from bank, an import / export data exchange, or even documents in judicial systems, it is important to understand the principles of its fundamental roots in cryptography.

For example, to ensure the rightful spending of currency in bitcoins, there are a lot of technology being in place on the virtual money market. One being the Elliptic Curve Cryptography that is based on mathematics to ensure the identity of parties involved in any bitcoin transactions.

# Bitcoin inflation

Bitcoins are created through reward for successfully mining a block. The current reward as of writing is 12.5 BTC per block.

Referring to the bitcoin history, the current bitcoin in circulation is around 16,378,375, and a year ago it was 15,628,475. So there is 749,900 bitcoins being mined in between.

The rate of a successful mining is around 10 minutes. Assuming this, in one year there should be 24 * 60 / 10 * 12.5 * 365 bitcoins created. That is 657,000 and this theoretical value doesn’t quite add up with the history as this only amounts to 87.6% to the historic value. Close, but more than 10% than expected.

It turns out, in fact, there is a mechanism built-in to the bitcoin to halve the reward as a form of inflation. A month from now will mark the anniversary for the last Bitcoin reward halving from 25 BTC to 12.5 BTC. This change is by design and happened twice as expected in the past, from 50 to 25, to 12.5 as of time of writing.

The first block receiving 12.5 BTC is 420,000 on 2016-07-09, according to the original constant set in stone by the creator of Bitcoin:

`Consensus.nSubsidyHalvingInterval = 210000;`

Therefore during the period mentioned above where 749,900 are mined there are times when the reward was 25 and some other 12.5.

A rough calculation shown the current reward, which is 12.5 BTC per block, applies to 334 days during that 365-day period. Revising the calculation of the theoretical value resulted in 712,800 bitcoins. Taking into account this fact the estimation improved from 88% to 95% of historical values.

# Using TI Nspire to explore mathematics behind blockchain technology

The TI Nspire is a great tool for exploring mathematics through its calculation and graphing capability. One of the emerging technologies that is based on mathematics is blockchain. It gained popularity through bitcoin that caused much debate and controversy in the field of banking, economics and finance. Until recently more and more established research and technology firms started to look at it seriously and its underlying core technology, blockchain, is gaining momentum for being adopted by traditional financial institutions.

In a previous installment, the property of the Elliptic Curve is explored using TI Nspire. As shown in the dynamic graph below, the curve exhibit several properties that form the two basic operations of asymmetric encryption – point addition and point doubling – for public and private key pair generation.

Using a=0, and b=7 as in Bitcoin, the two properties are basically illustrated in the following graphs.

Point Doubling

However, in reality, the Elliptic Curve Digital Signature Algorithm (ECDSA) algorithm to generate public and private key relied also on another mathematical concept known as the finite field. This is basically a limit imposed on the numbers that are available for use in the calculation, and in this case, positive integers from a modulo calculation. The prime modulo for Bitcoin (as in secp256k1) is set to  2256 – 232 – 29 – 28 – 27 – 26 – 24 – 1. Having this in place, the graph will not look like the above but some scattered points on a fixed region, and overflows will wrap around. However, the symmetry will still be preserved and recognized visually on graph.

With this mathematical backed technology as the foundation, blockchain can provides open ledger for secure transaction service.

# SHA-256 initial hash derivation explained in TI Nspire

The SHA-256 is a cryptographic hash function with many usages. From bitcoin and block chain calculation to digital signature, SHA-256 played a pivotal role.

From the official definition, there are 8 initial hash values in the algorithm. They are hexadecimal form of the fractional part of the square roots of the first 8 prime numbers 2, 3, 5, 7, 11, 13, 17, and 19. The values are:

In practice these initial values are constants, but for demonstrating how fractions are represented in hexadecimal, the calculation can be shown in TI Nspire although no built-in support is provided for hexadecimal fractions. The calculation is very simple, take the fractional part from the value times 16, and then convert the integer part to hexadecimal. Repeat with the resulting value to concatenate the answer. In the below example, the second SHA-256 initial hash value calculation is shown (first three most significant value).