Bit coin(2)

32
BitCoin, Machine Learning and Using Them together.

Transcript of Bit coin(2)

Page 1: Bit coin(2)

BitCoin, Machine Learning and Using Them together.

Page 2: Bit coin(2)

Bitcoins-Magic Internet Money

Bitcoin is a purely

● digital ● Open Source● P2P● secure● Currency with no central regulating authority.

Page 3: Bit coin(2)

Problems with traditional Digital currencies

1. Double Spending Problem.

2. The problem of trust.

Page 4: Bit coin(2)

Short overview of how it works:

Page 5: Bit coin(2)

A Deeper Dive

Page 6: Bit coin(2)

The overall picture to keep in mind:

Page 7: Bit coin(2)

Why Cryptocurrency?

Because the integrity of the entire bitcoin network depends on a few basic cryptographic principles.

As will be discussed in the following slides.

Page 8: Bit coin(2)

Hashing

Process of converting a message of arbitrary length into a fixed length string of seemingly random alpha-numeric characters.

● Prime hashing example.● 31662.

Page 9: Bit coin(2)

Calculation of nonce

Nonce is the random string that miners attach to the end of the transaction message to create a desirable hash.

● Link the prime number to the nonce.

Page 10: Bit coin(2)

Remember introduction?

Note that the only way the bitcoins are introduced in the network is by the miners rewarding themselves bitcoins for their effort of hashing the transactions.

● We want to make sure that the introduction of bitcoins is not random and occurs in a controlled manner.Why?

● The system has a tool for this called difficulty.

Page 11: Bit coin(2)

Difficulty

● The hashes created by the miners can not be random.● The system dictates that the nodes only create hashes that are less that a

challenge.● The challenge is auto generated by the system looking at how quickly the

previous transactions were hashed.● The system maintains hashing time at 10 min per block .

Page 12: Bit coin(2)

Remember Nonce?

● To meet the challenge of the system the miners add an appropriate nonce so that the hash created by them is less than the challenge.

● Finding this nonce is not simple it involves trial and error of around 300,000,000,000,000(300 trillion) nonces.

● This is because no one knows how to back predict the SHA-256 hashing algorithm.

● If you do you become a billionaire just by mining faster than any man alive.

Page 13: Bit coin(2)

The Block chain-20GB of transactions

● The Ledger that has all transaction on it since the beginning of bitcoin time.

● Once hashed and accepted by nodes in the network, the block of transactions along with its nonce and hash is added to the Blockchain and the new Blockchain is synced up with all nodes in the network.

Page 14: Bit coin(2)

The security of the network

● Any node in the network can potentially change the block chain. So how is this ever secure.

● Well there is this assumption that Good always Beats Evil.● Remember the nodes when presented with 2 blockchains always choose

the longer and more complex block-chain.

Page 15: Bit coin(2)

Good beats Evil

● The evil node that wants to change a past transaction in the block-chain would have to do the following .

● First he would have to modify the transaction then create a hash based on the difficulty of that time.

● Then he would have to recompute the hashes of all subsequent blocks as they include the hash of the previous block.

● The hope is the good nodes have enough computing power to always stay ahead in the block-chain and never give evil a chance.

Page 16: Bit coin(2)

Empty Block problem

● The problem is that miners can keep creating blocks with no transactions except their rewards this is detrimental to the system.

● This is countered by producing only a finite number of bitcoins ever and the reward for mining is also reduced to half after every 210,000 bitcoins mined starting from 50 bitcoins for the first block(Genesis block).

● Finally only 21million bitcoins can be produced.● After which miners live on transaction fees.

Page 17: Bit coin(2)

Predicting BitCoin Exchange Rates

Page 18: Bit coin(2)

The Problem

Due to the absence of any regulatory mechanisms BitCoin exchange rates are extremely volatile.

We set out to solve the problem of finding the best model and features to fit the BitCoin exchange data.

20XX 20XX 20XX 20XX

Page 19: Bit coin(2)

Machine Learning Introduction:

Predicting the future from past values.

The obvious next point can be predicted by using intuition.

In more complicated models we need a bit more mathematics to figure out the next point. This mathematics is called machine learning.

Page 20: Bit coin(2)

Error in prediction:

Which line fits the points best ?

Page 21: Bit coin(2)

Error in prediction:

The Aim is to minimize error. So the net residual in prediction is minimized to find the best fit.

Page 22: Bit coin(2)

The models we tested

SVMLowest error for all time marching models tested.

NNThe NN regression from R was used it gave a less accurate result.

Random ForestThe random forest gave the highest rms error.

Page 23: Bit coin(2)

Features Used

The features we used to train our models include:● The mining difficulty of the bitcoins.● The number of trades per minute.● The volume of trades occurring in past days.● The number of transactions in past days.

Page 24: Bit coin(2)

Method Used to train the model

After deciding on the features based on covariance calculations We trained a model to predict the price on a given day based on the value of features on that given day.

Next we created models for predicting the features based on time i.e how the features varied w.r.t time.

Finally to make predictions we calculated the value of the features based on the model that we had and then predicted the value of the price based on the predicted feature values.

Page 25: Bit coin(2)

Transactions per minute model

Page 26: Bit coin(2)

Trade volume with model

Page 27: Bit coin(2)

Price model using SVM

Page 28: Bit coin(2)

Price model using NN

Page 29: Bit coin(2)

Price Model using Random Forest method

Page 30: Bit coin(2)

Appendix

Data Sources:

● Bitcoinity.org● Wikipedia for data on time series

analysis● R tutorials for help regarding

application of R for our project.

Page 31: Bit coin(2)

The team

Srinivas Sakshi

Page 32: Bit coin(2)

Thank YouFor the opportunity given to us.