The Money Chain

PREFACE

83242f46d992ef8514058ed85730e5d6097e9f7f49f17cb84a55e18fe6b56ab7

 

I have always had an interest in the mechanics of "how things work" from a very young age, having been in trouble regularly for taking apart most of my electronic toys with a screwdriver to examine the internals.  My Introduction to computing started at when I was ten years old - my brother was given the infamous ZX Spectrum.  After playing a few games (loaded from tape), the curiosity grew on how to create games and that's when I started learning BASIC. This was when the love affair with computers and programming started to flourish.

I have been quite fortunate in that my career has forced me to work with and research a number of different technologies.  Recently, I have gained a keen interest in blockchain and machine learning and have been fortunate enough to be granted a three month sabbatical from the company that I work for to further myself in these areas.

From experience, I have always found that doing something practical in an area that you want to learn is the best way to understand something.  To steal a quote from Einstein, "Any fool can know, the point is to understand."  Having spent a bit of time thinking about what practical applications can be used, I came up with the idea of building a trading bot for the cryptocurrency market using machine learning.  Four students at MIT managed to do this and achieved excellent results when applying their algorithm to Bitcoin.  

This ebook will evolve as I continue down the road of gaining a deeper understanding of the technologies and start building the bot.  At this point it is very much a work in progress.  But my hope is that you will take the time to read it and provide feedback.  Just like people and transactions bring value to the blockchain, I would like the same to apply to this document.

Thank you for your interest and please feel free to drop me an email for any contribution you would like to make.

 

 TABLE OF CONTENTS

INTRODUCTION

BOOK I - Cryptocurrencies

1 An Introduction to Cryptocurrencies

2 The Genesis of Bitcoin

3 Altcoins

4 Types of Cryptocurrencies

5 Wallets

6 How to Procure Cryptocurrencies

7 Valuing Cryptocurrencies

8 Dissecting the Blockchain

9 Cryptocurrency Mining

BOOK II - Machine Learning

1 An Introduction to Machine Learning

2 Machine Learning Software

3 Statistical Foundation

BOOK III - Trading

1 An Introduction Trading Equities

2 Technical Analysis

3 Trading Strategies

BOOK IV - Bringing it all Together

1 The Solution

2 Results

3 Conclusion

 

 

CHAPTER 1

An Introduction to Cryptocurrencies

c075a53bcae24149a871f5b0efd44efddb57b650c20663864a953298219c644d

 

A cryptocurrency is a digital currency that can be used as a medium of exchange.  There are many cryptocurrencies today but they are all essentially built on the same technology called blockchain.  Bitcoin is the most popular cryptocurrency.  The traditional currencies, like the US Dollar or the Euro, are called Fiat currencies. 

The table below shows some of the differences between Cryptocurrencies and Fiat Currencies.

Fiat Currency

Cryptocurrency

Can be represented by tangible or physical notes

The currency is digital (intangible) and stored online

Fiat currency is legal tender backed by a central government

Cryptocurrency is not a legal tender and it is not backed by a central government or bank

The money supply is controlled by the reserve bank or government

The money supply is controlled by an algorithm built into the block chain technology at inception

The control of fiat is centralised

The control of cryptocurrency is decentralised

A fiat currency is country or region specific

A cryptocurrency is international and "borderless"

 

A cryptocurrency is supported by a network of peer machines.  Every peer has a record of the complete history of all transactions.  Based on this, it will have a view of all the balances.

Transactions are confirmed by miners.  Mining machines stamp the transaction as legitimate and then spread this information across the network.  This transaction has now been confirmed in the blockchain.

The major hurdle with payment networks is preventing "double spending" or to prevent someone from spending the same money twice.  In traditional banking, this is managed by a central system.  What popularised Bitcoin and supported its value was that the inventor of Bitcoin found a way to prevent double spending on a decentralised technology.

Altcoins refer to all the other cryptocurrencies outside of Bitcoin. There are thousands of Altcoins that compete with Bitcoin.  Some of the other notable cryptocurrencies are Ethereum and Ripple.

 

CHAPTER 2

The Genesis of Bitcoin

8ab52a4290b9184ed4e02afffd48436a8e394bcc1879332acc97b1e290d01878

 

There have been many attempts (especially in the early 90’s) to create digital cash or a digital currency, but with no sustainable success.  DigiCash, founded in 1989 by David Chaum (a computer scientist and cryptographer), was an example of this when it finally filed for bankruptcy in 1999.  Chaum felt that it had failed because, at that time, e-commerce was not fully integrated within the internet.

Ten years passed before Bitcoin was created by Satoshi Nakamoto.  In an announcement in late 2008, Satoshi said in a forum that he had developed "a peer-to-peer electronic cash system." He had found a way to decentralise the trust by building a peer-to-peer technology which is very similar to common file sharing systems today.

Satoshi Nakamoto is actually a pseudonym for the mysterious inventor of Bitcoin – no one really knows how he is.  He published a paper on a cryptography mailing list at the metzdowd.com website explaining the principles of block chain and released the first version of Bitcoin.

The snippet below provides some detail to explain the transfer of coins along with the distribution of coins.

 

Reference url: http://www.metzdowd.com/pipermail/cryptography/2009-January/014994.html

Satoshi must have spent time thinking about and applying economic mechanisms to support demand for the coins – a diminishing supply should lead to an increase in demand.

He worked with other developers in maturing the Bitcoin software until about mid-2010 when he handed control of the system to Gavin Andresen, a 3D Graphics and Virtual Reality software developer.  Gavin had worked with Satoshi on Bitcoin and was declared lead developer on the software once Satoshi had left.

In developing the technology, Satoshi left a text message in the first mined block of Bitcoin which reads “The Times 3 January 2009 Chancellor on brink of second bailout for banks”.  This shows that the first block was mined on or after that date.  This block is referred to as the genesis block and is unlike all other blocks since it does not have a predecessor. 

For being the initial miner of Bitcoin, he was awarded Bitcoin at the genesis and for the next 10 days afterwards.  His public Bitcoin address for Satoshi shows that he owns roughly one million Bitcoins.

Bitcoin has flourised online and more and more people are becoming comfortable with the different approach technology has provided for providing electronic mechanisms of exchange.  As a result, many Altcoins have been created that attempt to differentiate themselves from Bitcoin through enhancements or other elements of perceived increased value.

 

CHAPTER 3

Altcoins

410c825024cb0a7e05dc3d4936f84f02df4fa975746d60e822b11ce775b57375

 

Altcoin is a combination of two words: “alt" and "coin"; alt is short for alternative and coin signifies currency. Thus together they imply a category of cryptocurrency that is alternative to the digital currency Bitcoin.  Examples of these coins may include Ethereum, Litecoin, Dogecoin, Peercoin, Feathercoin, Zetacoin, Novacoin.

Altcoins are generally more volatile than Bitcoin and there can be massive shifts in their value based on market perception.

They are all newer than Bitcoin, ranging from a few years old (after 2010) to a few days old.

Altcoins have their own communities built around them.  These communities are made up of people that have an intrinsic interest in the coin and will find ways to support the coin.

Altcoins also have their features.  Generally speaking, Altcoins are deviations from the original Bitcoin technology with perceived enhancements or differentiations to bring them alternative value.  Newer and more innovative versions are getting launched that offer modifications in areas like transaction speed, privacy, proof-of-stake, DNS resolution and more.

They are also highly tradable and investable.  People are all looking for the new Bitcoin.

To illustrate different examples of Altcoins, the section below provides more detail on some of the more notable Altcoins.

 

Bitcoin Cash (BCH)

www.bitcoincash.org

The first block of Bitcoin Cash was created on 1st August 2017, after a Bitcoin Improvement Proposal (BIP), aka Segregated Witness, was activated.

The Bitcoin community became divided on how to scale Bitcoin on the underlying technology.  As more people used Bitcoin, the network started to struggle to keep up with the volume of transactions. 

In Bitcoin, the transactions are processed block by block.   A block is created and new transactions are added to that block before being verified by miners.  Initially, Bitcoin was design to process 6 blocks per hour (or 1 every 10 minutes).  According to statistics provided by a Bitcoin website (www.bitcoin.com), by 2014 adoption had grown and the Bitcoin network was processing 500 transactions per block.  At time of writing (Jan 2018), the network is processing 1500-2500 transactions per block. 

Image source : https://blockchain.info/charts/n-transactions-per-block?timespan=all

 

For a transaction to be verified, it needs to be included in the block.  If the block is full, then it must be included in the next block.  But this can lead to congestion because other Bitcoin users may pay a higher fee to have their transactions processed quicker.  Their transactions are escalated to the top of the list of pending transactions known as the mempool. 

Image source : https://blockchain.info/charts/avg-confirmation-time?timespan=60days

 

This increase in transaction time and fees has caused a split in the Bitcoin community with opposing viewpoints.  The one group wanted to increase the size of the blocks (to be able to have more transactions in a block) whilst the other group wanted to restructure the way the data was stored in the existing blocks. 

Generally speaking, the miners of Bitcoin wanted to increase the size of the blocks on the Bitcoin blockchain.  But since there was no consensus, this group split away and created what is called a “hard fork” from the original Bitcoin blockchain.  As a result, Bitcoin Cash was formed as a new currency.

When Bitcoin Cash was launched, it inherited the transaction history of the original Bitcoin cryptocurrency.  However, all later transactions were separate.  Block 478558 was the last common block and thus the first Bitcoin Cash block was 478559. Bitcoin Cash uses the hash function SHA-256 to secure the transactions in the blocks and has a total coin supply of 21 000 000.

Bitcoin Cash has experienced mixed success since its inception.  With a number of other coins that have emerged that also boast lower fees and fast transactions times, it is going to take a lot of drive (through user adoption) and potential innovation to keep it competitive.

Image source : https://www.worldcoinindex.com/coin/bitcoincash

 

Ethereum (ETH)

www.ethereum.org

Vitalik Buterin, the creator of Ethereum, has the very ambitious vision of wanting to take the underlying technology of Bitcoin (the blockchain) and use that to decentralise the internet.

Decentralised applications, or DApps, are the core pillar to the philosophy of Ethereum and these can run on the Ethereum virtual machine.  This Ethereum virtual machine is known as the “world computer”.

One of the caveats of a centralised system is that they suffer from single points of failure.  If an application on a centralised system goes down and there are no backups, you would suffer severe downtime and potentially lose data that is critical to your business.  DApps run on a decentralised block chain and make use of data that is scattered across all users of Ethereum.  The data is encrypted so it is not viewable to everyone but everyone can validate and verify the integrity of the data and the transaction.

There are many DApps that have been developed already, from online gambling to prediction markets.  Some social platforms also run on top of Ethereum.

Smart contracts are an important part of how Ethereum works.  Contracts are created by users and these have rules and triggers.  The contract executes when a trigger occurs as long as all the rules have been adhered to.

The Decentralized Autonomous Organisation (DAO) was a smart contract that supported a decentralised venture capital fund with the objective of providing funding for all the future DApp development.  People investing in DAO could decide (via voting) which DApps got funding and which didn’t.  The DAO turned out to be a huge success, accumulating around $150 million worth of ETH.  However, the DAO was hacked.  Most people in the Ethereum community decided to hold the money taken by the hacker and return all the money to those that invested in the DAO.  There was another group that disagreed with this since it went against the philosophy of a blockchain being “immutable” or unchangeable and should not be changed by the users.

The code was forked and the blockchain was reset.  The individuals in the Ethereum community that were against “rewinding” what the hacker had done broke away and formed Ethereum Classic.

Ethereum has seen excellent growth playing second to Bitcoin (at time of writing) in terms of market capitalisation.  Interestingly, there is no limit on the Ether coin supply.

Image source : https://www.worldcoinindex.com/coin/ethereum

Pros

  • Lower transaction fees than Bitcoin
  • Faster transaction times than Bitcoin
  • Allows the creation of decentralised apps (DApps)
  • Can be used to create new cryptocurrencies which means they will have a dependency on the Ether platform
  • Pioneered the concept of smart contracts on the blockchain

Cons

  • Network congestion can cause a delay in the processing of transactions
  • There are other blockchain development platforms out there that are starting to compete with Ethereum

 

Dash (DASH)

www.dash.org

Dash (formerly known as Darkcoin and XCoin) has been around since 2014 and was created to focus on privacy and speed of transactions.  The founders of dash had also identified these as two areas of weakness with the technology that support Bitcoin. 

Bitcoin transactions are not anonymous – once you identify a wallet address, you can view all the associated transactions by navigating through the blockchain. Blockchain.info is a website that can be used for navigating the public ledger on the block chain.

To address these issues, two mechanisms were developed; PrivateSend and InstantSend.

The PrivateSend feature bundles your transactions with other anonymous payments.  This makes it almost impossible to see where the transaction came from and where it is going to.

The InstantSend feature is meant to support transaction processing that takes less than a second.  You pay for higher processing fees but it does mean that it is practical in certain areas of industry (like retail where Point of Sale systems need to validate a transaction immediately).

To achieve this, Dash essentially created two “layers” – a two-tier network. 

The first layer is composed of nodes.  These computers make up a peer-to-peer network. Miners use these nodes to verify Dash transactions and create new coins.

The second tier is composed of masternodes that contain the full blockchain of a cryptocurrency. These masternodes are dedicated to PrivateSend and InstantSend transactions.

Anyone can run a masternode, but they need to own 1,000 Dash coins – this was to prevent sybil attacks.  An operator of a masternode is then entitled to a percentage of the associated transaction fees. The fee distribution from Dash for managing the blockchain is as follows;

  • The miner gets 45%
  • The masternode operator gets 45%
  • The Dash maintenance fund receives 10%

Dash has experience some solid growth and support since its creation.

 

The Dash maintenance fund is also seen as a key differentiator to Bitcoin since those goes towards running the nodes.  Instead of relying on community donations, Dash can fuel its growth directly from its blockchain.  These feature sets make Dash self-governing and self-funding that will support a sustainable model.

Dash, however, is not with controversy since they are linked to an instamine.  In an instamine or premine, a large number of coins are kept for a select few before the code is released.  These people can then benefit greatly if the coins increases in value.  There are some that say this is unethical and can lead to developers floating coins for their own enrichment and not to provide a new and practical solution.

Pros

  • Private transactions
  • Virtually instant processing of transactions
  • The network is self funding which pays for software development, business development, integrations, marketing and whatever other real-world activities benefit the network
  • The governance is decentralised by blockchain, where masternodes vote on how to spend the Dash budget. Anyone can submit proposals to grow the value of the network
  • Incentivising the masternodes creates a sustainable model to help with scaling
  • The difficult adjustment algorithm (for mining) is superior to the Bitcoin Cash algorithm (which came under some fire for being inconsistent)
  • Positive uptake from merchants

Cons

  • Linked to an instamine which has has a negative effect on their reputation
  • Masternodes cause slight centralisation
  • InstantSend fees are a bit high