Introduction

From 2009 to this date there has been a phenomenon with the ability to harness the power of cryptography and the internet. The intention of combining these two areas created a new commodity called Bitcoin. Bitcoin is a relatively new technology which has made headlines and attracted governments throughout the world. Some governments have banned while some other governments have regulated the use of Bitcoin within their countries. However, when a new “trend” comes along, we normally find that others start to copy. This copying has created new and improved alternatives to Bitcoin by utilising the use of other cryptographic algorithms and implementing new features to use on the Blockchain such as Smart Contracts. Bitcoin was created in 2009 by an unknown person who goes by Satoshi Nakamoto. Satoshi Nakamoto wanted to create a form of commodity which did not rely on a central organisation. Instead, a Peer-2-Peer protocol is used to decentralize the network. By building the network based on mathematical proofs and cryptography, Satoshi Nakamoto was able to produce Bitcoin. Where there is anonymity, there is usually crime. In this case for Bitcoin or any alternative cryptocurrency, there tends to be a minority who use these currencies for illegal activities as it is not an easy job trace the person sending the currency. After the release of Bitcoin, a few more alternatives arrived such as Litecoin and Ethereum. These “altcoins” (the formation of “alternative” and “coins”) have given way to different algorithms to verify transactions and to mine blocks. For example, Bitcoin uses the SHA-256 algorithm while Litecoin uses the Scrypt algorithm. The difference between these causes the mining of blocks to become harder. In this case, a GPU will mine in Kilo hashes per second for Litecoin while Bitcoin will reach Giga hashes per second. This creates a frenzy of ASIC purchases and GPU purchases, driving up the cost of each device. In the case of Bitcoin and Ethereum; both have different algorithms. However, Ethereum has more practical and commercial values than Bitcoin such as Smart Contracts. Even though, Bitcoin itself is the true smart contract where coins are sent from A to B along with messages.

Motivation and Project Context

Bitcoin has a been a fascination of mine since I discovered the currency back in April 2011. I had mined using an iMac but for reasons with the ventilation of Mac’s, it was not successful in the long term. However, I did mine some Satoshis (smallest decimal of the currency) and decided the currency was not going to increase in price. This lead me to sell whatever I had in my wallet. But looking back now, it seems I should have held the currency. In that perspective, the prices on 11th April 2011 are shown in Figure 1. If we compare that price to now, there was a peak on 17th December 2017 where it reached almost $18,000. This shows that Bitcoin has relevancy and has a perspective of becoming even bigger within commercialisation.

Currently, I have mainly focused on Bitcoin as I have dealt with this coin a lot more than Ethereum, however, now we will look at Ethereum. We can think of Ethereum as Bitcoin, but Ethereum is a lot more useful in the terms that decentralized application can be created. This means one could a banking system where no central authority has control of the creation of bank accounts. Users can invoke certain methods on the Blockchain to withdraw and deposit their currency. And this example has encouraged me to gain an interest into Ethereum and to create my own smart contract and create a banking system. As the Blockchain is public, there is the possibility to prove ownership for products too third party users. It is very interesting. Within this project, we will dive into the world of cryptocurrencies to investigate the major features and facilities that Bitcoin, Litecoin and Ethereum has to offer. Towards the end, we will look at the possibility of coming up with a solution of creating a banking system which could be further extended to real estate where a house owner could sell a house on the Blockchain via Smart Contract. When the house is sold, the smart contract triggers a series of events to enable the buyer to get proof of ownership. The Smart Contract could possibly be linked to a bank who would know exact amount of information about the contract and could get alerted to know that the buyer may need a mortgage or some sort of banking services. There could be another smart contract which is triggered by the sale of a house where the land registry is notified and details need to be changed. This is a vague example at best but can be much further improved. However, for this project, we will focus on creating a Smart Contract for a basic bank system allowing users to deposit and withdraw their currencies.

Project Aims

Within the project, we will be looking at the ability of Bitcoin, Litecoin and Ethereum to perform in the real world. For example, Bitcoin can be used to process transactions anonymously. The following are bullet points of aims that we hope to achieve and can be evaluated at the end of the project.

  • Investigate the uses of the blockchain and how they can be used in the commercial industry for ease of payments.
  • Investigate the uses of smart contracts and how they came about.
  • Understand how a smart contract is made using the Solidity programming language.
  • Research information about Bitcoin, Litecoin, Ethereum and the Blockchain.
  • Give an in depth description about Bitcoin, Litecoin, Ethereum and the Blockchain including the security behind cryptocurrencies.
  • Create a Smart Contract for a simple banking system.

The project proposes that I must learn how to use Solidity. This is discussed later in the paper giving the result of a small system I have created to do with a banking system. To this end I would have also created additional Smart Contracts for various other systems.

Background Information

The well known and most popular cryptocurrency proposed by Satoshi Nakamoto, called Bitcoin, is a decentralised computer based currency that is released as open source. That meaning the code is publicly viewable and modifiable, but not modifiable in a way that could be malicious.

The intention is to create a currency that is not owned by a central organization, however, is distributed using a peer-2-peer network basing the currency on a consensus. The network only needs to work with proven cryptographic algorithms creating a consensus. Thus each peer does not need to trust each other, however, needs to know the information being distributed is a result from a particular algorithm for a given cryptocurrency. The network Bitcoin runs on is called a blockchain. Each peer on the system is given a public address composing of both public and private SHA-256. Only the public key is given out to the public so transactions created by blockchain software can become hashed. However, a private key is secret and should never be give out to the public. We could say that in a stock trading system, identities of sellers and buyers are not given, but the date, time and volume of trades are given [Nak08].

November 2017, the Winklevoss twins submitted plans to build a Bitcoin exchange. However, it was declined by the authorities in the United States of America due to the lack of regulation of cryptocurrencies [Det17].

Mining Cryptocurrencies

Cryptocurrencies can be mined. Mining is a ludicrous activity which has the possibility of creating an income as an individual or commercial value. The mining of cryptocurrencies can be done by running the respective secure hashing algorithms on a CPU. However, there have been advancements of creating more specific and advanced hardware such as FPGA’s (Field Programmable Gate Array) and ASIC’s (Application Specific Integrated Circuits). Not all currencies can be mined with FPGA’s or ASIC’s or even GPU’s as the algorithmic operations are too demanding too be profitable after creating such specific hardware.

The process of mining is complex. Essentially, we are trying to solve a puzzle which the inputs and outputs are not known. This results into the need of generating random values and values gained from each transaction made, to put through a hashing algorithm, which of course, is dependent on the type of cryptocurrency. The random numbers generates a hash value which meets the specification in the open source code which again is publicly viewable [Coi18]. The output from the algorithm is then broadcast to the entire network. If the hash is a valid value which meets a specific and unknown value, then a “block” is mined. A block is merely a list of transactions which have occurred since the previous block. The block is published and stored on the storage on each of the peers on the network and stored as a blockchain.

As of May 7th, the machine that mines a block is rewarded amount of Bitcoins in addition to the total in fees from transactions. The amount of reward changes approximately every four years by halving. Currently the reward amount is 12.5 BTC. BTC is the ticker unit for Bitcoin.

The Dark Web

The dark web is not for the feint hearted. There, the dark web is an enabler for criminals or explicit activities. This results with the inability to access the dark web through a simple web browser, however, through a network called The Onion Router Network, also known as TOR.

An example of a website on TOR Network was Silk Road. Silk Road was a forum which enabled people too access weapons, drugs, illegal material and criminal services. Such services defamed cryptocurrencies due to the ability of avoiding government officials to stop these criminal activities. If we think about the implications, cryptocurrencies are typically anonymous meaning as long as the public key is not published on a public forum where a username can be retrieved, then no one would know the identity of such public key. This would make cryptocurrencies ideal for illegal activities where the criminals do not want to get caught by special services such as the FBI, CIA, NSA or any other Secret Services.

Silk road was closed down when the owner, Gary Alford, was charged with money laundering, computer hacking and conspiracy to traffic narcotics. This resulted into the FBI seizing 26,000 Bitcoins and 144,000 later. These Bitcoins were auctioned off by the US Government. [Sil17].

Mt.Gox

Mt.Gox was one of the biggest in Bitcoin exchanges in the world before it was forced to declare bankruptcy. Mt.Gox was believed to handle over seventy percent of all transactions on the Bitcoin network. The exchanged allowed the deposit of Bitcoin and ordinary money via bank transfer into the exchange to use as a way to purchase or sell Bitcoin.

The bankruptcy of Mt.Gox was forced by a hacker using an auditor computer to transfer a large quantity of BTC to his account which got sold at a much larger price. The Bitcoins on the Mt.Gox exchange briefly sold for 1% of its real value. Luckily enough, Mt.Gox stored 424,242 Bitcoins in a cold storage and moved them over to the live account. Therefore showing they still owned a large proportion of Bitcoin. [Lee11]. This itself did not force the bankruptcy. However, the event on February, 28th 2014 caused Mt.Gox to finally file for bankruptcy due to another hack losing 750,000 customer bitcoins and also their own 100,000 Bitcoins from profit. At that time, the amount stolen amounted to an approximation of 7% of all Bitcoins mined.

The Blockchain

We can think of a blockchain as a ledger. That is the blockchain is a type of datastore storing transactions with a timestamp. Each peer on the network will have the datastore which acts like a database. The datastore holds information about “blocks” and transactions which have been mined and distributed on the network therefore can be seen as an official list of verified transactions. Since data is cascading, this is an ideal data structure to mitigate double spending attacks and prevention of altering the data. Double spending is a malicious attack where an input from a previous transaction. Usually it leads to a duplicate transaction creating more Bitcoins appear in a Bitcoin wallet [Bit18].

Ethereum and Smart Contracts

Ethereum was initially proposed by Vitalkic Buterin in 2013. He is a well-known researcher with many publications within cryptography. Ethereum was an idea, which had envisioned the impossible become possible. It was funded via public crowd-sale online. After successfully obtaining the finds, the Ethereum network became life on July 30th, 2016 [Ai16]. Ethereum is a type of cryptocurrency that uses the same technology as Bitcoin. However, there are a few exceptions. Firstly, smart contracts runs on the Ethereum blockchain utilizing an Ethereum Virtual Machine. Smart Contracts are specified using a programming language called solidity and run the way they are specified. There is no fraud or third part interference and are decentralised. The objective of a Smart Contract could allow the use of contracts between parties. For example, if someone places their house for sale using a Smart Contract on the Ethereum network, one could buy the house. Once bought and the buyer has sent the currency to the smart contract, the blockchain would store that transaction and prove the ownership of the property is to the buyer. This could allow other third parties to be notified by extending a Smart Contract to notify other Smart Contracts, created by third parties for insurance, mortgage deals, etc. This then cuts out the middle man and potentially could become a commercial reality [Dog17].

The only catch to Smart Contracts is to use one requires you to pay a fee. After all it is fair that the miners that process your Smart Contract state is rewarded for its time. Therefore a user must pay a fee called Gas. This is a small fee calculated by the Ethereum Virtual Machine dependant on how complex the code within the Smart Contract.

At this point, it would be best to research the topics previously stated to find out more information. The research papers will be a mixture of information found in research papers and information on the internet.

How Can Cryptocurrency and Blockchain Technology Play a Role in Building Social and Solidarity Finance?

After reading this paper, it has enlightened me with the potential that alternative cryptocurrencies possesses and how a digital currency can be created to solve financial problems.

The paper starts with the analysis of the currency of Bitcoin and comparing the use from first world countries and third world currencies and how Bitcoin can be used in poorer countries for financial inclusion. Next, the creation of different types of cryptocurrencies are criticized “based on explicitly cooperative and social justice principles” [Sco16]. Lastly, Brett Scott looks at the fundamental technology of Bitcoin, the Blockchain 2.0. Within the paper, the author, Brett Scott, gives us an example of a current electronic banking system and compares the differences between the system and Bitcoin. The description of the banking system gives a bank’s customers some identifier, this can be thought of as a pin number. The pin number verifies the person accessing an account is a verified user and therefore the user is authenticated. We can also state that a bank has a database which contains relevant information about each bank account including the balance and a hidden identifier. Since we have authenticated our self, we can go ahead and check our balance and withdraw money from the account or send to another account. When we withdraw money, we are telling the bank to send money to another bank account which deals with the particular cashpoint the money is being withdrawn from. The problem that Brett lists, is that the system has to work by a “set of private intermediaries editing private databases that they hold”.

Bitcoin is a commodity that has real value, despite Bitcoin being a virtual item with no physical meaning. Cryptocurrencies takes the same role as out banking system. We can deposit, withdraw and send money to others using both banks and cryptocurrencies.

Lastly, there is discussion on the possible future uses of the Bitcoin 2.0 technology or even editing the code to suit different types of data to become applied to alternative application. An example stated describes the use of the Ethereum blockchain utilizing the Smart Contract facility [Sco17].

How to Make a Mint: The Cryptography of Anonymous Electronic Cash.

Investigating the paper, authored by, Laurie Law, Susan Sabett and Jerry Solinas, gives a satisfying attempt to model an electronic payment system after our note currency system.

A discussion shows the potential of digital signature to facilitate electronic transactions. However, these would be anonymous and therefore might become worrisome for law authorities due to reasons of illegal activities such as drug trafficking. The researchers insist the following is a priority for any decentralised currency system:

  • Privacy: To protect against eavesdropping.
  • User Identification: Protection against impersonation.
  • Message integrity: Protection against tampering or substitution so the message received is the same message that was sent.

For these to be met, there would need to be some element of a wide use of an authentication infrastructure. It is proposed that this is possible with the use of RSA cryptographic algorithms to encrypt messages using private keys [LSJ96].

Solidity

Solidity is a Turing complete programming language to create Smart Contracts on the Ethereum Virtual Machine. The aim is to learn how Solidity is programmed and how internal code related to specific functions that can be called on the Ethereum network.

Solidity follows a typical structure of coding like C, C++ and Java. There is an if-then-else and do-this-while-doing-this aspect. Let us define a typical structure of a Smart Contract in Solidify. As we can see in figure 2, there is a simple program which involves itself with the manipulation of a state on a Smart Contract. We can see that the contract must start with contract. This indicated to the virtual machine that the following is a contract. Next comes the contract name. All contracts must have a name to identify the contract on the Ethereum network. On line 2 we can see a state variable set up called data. This is of type uint which is an unsigned integer which has a value of 256 bits. The functions created called setData() and getData() allows us to set the variable and retrieve the variable. This is a small example of the potential of Solidity for creating Smart Contracts. From this example we can see that a contracts are merely collections of code and its functions create a system which a bank would potentially use. One crucial element of a contract is too state the version of solidity used as stated in figure 3.

We can create sub-currencies, tokens and smart contracts using the Mist Browser [Mis18]. However, we will be looking at the JavaScript like code called Solidity before it is placed onto the network as byte code.

Solidity Bank

Imagine no central authority owning your money that is contained in your bank account. Smart Contracts make it possible. Here we will be looking at a simple bank created using Solidity.

Let us determine the following as crucial aspects of a bank account:

  • User must be able to deposit money.
  • User must be able to withdraw money.
  • User must be able to transfer or send money to another user.
  • User must be able to view the balance of the account.

From this list, let there be four functions called deposit, withdraw, transfer and getBalance. Even though the functions are almost self-explanatory, we can conclude that deposit will allow the user to add money to their account; withdraw will allow the removal of money from their account; transfer will allow the movement of money between accounts and lastly; getBalance will give the user the balance they have in their wallet.

As we can see in figure 4, we have the functions implemented including the required information. In addition to previously stated, I revised the functions needed and realised that a constructor was required so the Smart Contract would know who the owner of the contract is. Here we have a variable called owner which is of a type address. When we set owner to a value within the constructor, we are essentially storing the owners address in the contract. The withdraw function has the ability to allow the user to remove ether they have already deposited into the smart contract where amnt is the amount transferred from the smart contract to the users wallet. Deposit works the same way as the previously mentioned withdraw function. The only problem we have with the code in figure 4 is that there is no validation and therefore a user could withdraw more ether than what they had deposited. This can be fixed with a simple if statements. This has been revised and reflected in figure 5.

This is a simple bank system which can have plenty of adaptions to fit the needs of other types of sectors around the world in the commercial industry.  

Project Management

Initially, we planned to create a formal specification of Bitcoin using Agda. However, after creating a project plan and gant chart to describe the learning progress, it was later decided that formulising was not an interest of mine and therefore decided to take a view on a different aspect of cryptocurrencies. It was decided that I would look at Smart Contracts and the Ethereum network and how Bitcoin works.

The first task that I was tasked with was to learn how Bitcoin works and the technology behind the cryptocurrency. Next was the task to understand how the Ethereum Virtual Machine worked and how it accepted the language of Solidity to create Smart Contracts.

Secondly, I had to investigate Solidity as a programming language and how I am meant to use the language and the Mist Browser [Mis18] to help create error free Smart Contracts.

Applied Methodology

Action research was suggested by my supervisor and therefore I had applied this methodology. This method can be described as “an approach in which the action researcher and a client collaborate in the diagnosis of the problem and in the development of a solution based on the diagnosis” [Bel11]. By using this type of methodology, we can use both quantitative and qualitative data to gain deep knowledge about the problem. Action research consists of a spiral of following self-reflective cycles. The following outlines the cycles:

  1. Planning to initiate change [Act17]
  2. Act upon the change to start implementation also observe the process of implementation and consequences [Act17]
  3. Reflecting on processes of change and re-planning [Act17]
  4. Acting and observing [Act17]
  5. Reflecting [Act17]

Figure 6: Image to show process of action research [Act17]

Risk Assessment

  • To begin, the following were designated as potential risks:
  • The aims that are set are no longer able to be completed.
  • The result of the problem is not computable.
  • Loss of data.
  • Illness and emergencies.
  • Politics and the Law; With the position of bitcoin around the work, if the UK were to make Bitcoin illegal then I would have a problem.

The only problem that can be stated is that I changed my project idea and therefore I decreased the amount of time I had available to research and progress with the project.  

Conclusion

From the information that I have researched about cryptocurrencies, I believe various currencies are strong such as Bitcoin and Ethereum. Ethereum has a high chance of becoming the starting point for a next generation of blockchains, especially for commercial use. From this, no matter how governments perceive Bitcoin, the chance of Bitcoin not existing anymore is very slim. Also, the creator, Satoshi Nakamoto, of Bitcoin still has not been discovered even though there are many allegations for various people with various reasons. Just maybe, the owner will be discovered and thanked for the wonderful creation. Money is made through mining Bitcoin which is a positive aspect of maintaining the blockchain and with the release of better and more efficient mining hardware, it is becoming easier for people to mine cryptocurrencies. As cryptocurrencies are becoming a desired commodity, we are getting more criminals looking to use the features of these coins such as the anonymous features.

As I set out to learn solidity and Ethereum, it has given me satisfaction as I finished aims that I had set out and build a small bank in Solidity which can be used on the Ethereum network. This gave me a better understanding of commercial values by subtracting the middleman with the addition of Smart Contracts. Overall, I could have improved with the amount I have researched and feel I could have done a little better on getting publications from more better known authors around the world who specialise in cryptocurrencies.

Appendix

pragma solidity ^0.4.21;

contract bankSystem{

address owner;
function bankSystem(){
	owner = msg.sender;
}
function withdraw(uint amnt){
	if(address(this).balance > amnt){
		msg.sender.transfer(amnt);
	}
}
function deposit(uint amnt) payable{
	require(amnt == msg.value);
}
function getBalance() view returns (uint){
	return address(this).balance;
}

} 

References

[Act17] Action research can be defined. N.d. Retrieved on October 31, 2017 from: https://research-methodology.net/research- methods/action-research/

[Ait16] Roger Aitken. 2016. Digital Gold ‘Done Right’ With DigixDAO Crypto-Trading On Open Ledger. Retrieved on 7th May 2018 from https://www.forbes.com/sites/rogeraitken/2016/04/23/digital-gold-done-right-with-digixdao-crypto-trading-on-openledger/# 1ebb45a65204

[Bel11] Bryman, A. & Bell, E. 2011. “Business Research Methods” 3rd edition, Oxford University Press

[Bit18] Bitcoin. 2018. Double Spend. Retrieved on 7th May 2018 from https://bitcoin.org/en/glossary/double-spend

[Coi18] CoinDesk. 2018. Retrieved on 7th May 2018 from https://www.coindesk.com/information/how-bitcoin-mining-works/

[Det17] John Detrixhe. 2017. The Winklevoss twins are making headway in their quest to get Wall Street to big on Bitcoin. Retrieved on October 31, 2017 from https://qz.com/1044630/the-winklevoss-twins-want-to-bring- bitcoin-to-wall-street-with-a-cboe-futures-deal/

[Dog17] Ethereum. The homepage of Dogecoin. Retrieved on May 7, 2018 from https://www.ethereum.org/

[Lee11] Timothy Lee. Bitcoin prices plummet on hacked exchange. 2011. http://arstechnica.com/tech-policy/2011/06/bitcoin-price-plummets-on- compromised-exchange/.

[LSJ96] Laurie Law, Susan Sabett, Jerry Solinas. 1996. How To Make A Mint: The Cryptography Of Anonymous Electronic Cash. Retrieved on May 7th, 2018 from http://groups.csail.mit.edu/mac/classes/6.805/articles/money/nsamint/nsamint.htm

[Mis18] Mist Browser. 2018. Retrieved on 7th May 2018 from https://github.com/ethereum/mist

[Nak08] Satoshi Nakamoto. 2008. Bitcoin: A peer-to-peer electronic cash system.

[Sco17] Brett Scott. 2016 How Can Cryptocurrency and Blockchain Technology Play a Role in Building Social and Solidarity Finance?

[Sil17] Silk Road (Market Place). 2017. Retrieved on October 31, 2017 from https://en.wikipedia.org/wiki/Silk_Road_(marketplace)#Arre st_and_trial_of_Ross_Ulbricht

cryptocurrency


QR Code
QR Code cryptocurrencies_bitcoin_and_smart_contracts (generated for current page)