Advisors: Giovanni Pau, Rita Tse, Steven Liu
Group Members: Joe Wong, Tony Lin
1.1 Overview
Blockchain has been growing up rapidly in these days. A growing list of records, called blocks, which are linked together using cryptography. Also, smart contract is mostly used in the blockchain area, which allow the performance of credible transactions without third parties. One of the outstanding decentralised applications called Ethereum, is going to be our topic in this project. It allows anyone to write smart contracts and decentralised applications where they can create their own rules of ownership. This is a blockchain project about the document certification. We will create an Ethereum smart contract that saves an SHA-256 hash of a file on the blockchain with a timestamp. The SHA-256 hash is a 32-byte fingerprint derived from the input data. Once created, this hash is the only one that belongs to the file and the hash will be permanently added to the blockchain. That’s why documents can prove that a document has not been modified since its certification.
1.2 Tools
2.1 Developing the smart contract
We have used the Solidity programming language to develop our smart contract and we use Truffle framework to process the smart contract problem, such as initialize our smart contract development project or create creates various directories and files. The two main functions of our contract as follows:
The addDocHash() function are able to add the SHA-256 hash to blockchain.
The findDocHash() function can found out a hash exist in the blockchain or not.
2.2 Running an Ethereum node
In order to develop our contract on a real Ethereum blockchain. We need to make our computer as an Ethereum blockchain network node. However, running a node on a real network have to pay a lot of money. Therefore, we use the Rinkeby network to develop our smart contract. Rinkeby is one of the test network of Ethereum. There are several options to run our own node. In this part, we use the alternative software Parity to solve this problem.
2.3 Developing web interfaces for smart contracts
For the user interface, we decided to display the result on a website. Therefore, we are planning to design a web pages with three buttons, they are input button which can upload the files that need to be certificated. Add fingerprint to blockchain button that helps the selected document to be added to the blockchain and timestamp it. The last button is "Find on Blockchain" that is to find out if the selected file has been modified. If that file has been modified, it cannot be found in the blockchain. We also have an area to display the detail information, such as transaction ID, contract address, etc.
First of all, we can create a file and try to found on the blockchain. Obviously, It will not be found on the chain. Because we have not put it in fingerprint.
Secondly, We try to add fingerprint to the file. As you can see, this is the unique ID of the file. Now, this hash has been added to the blockchain already. The following picture shows the new block we just add to the chain.
Now, if we do not modify the file. We can find the hash on the chain.
However, if we edit the content of the file. We cannot find the hash on the chain. Because this file has been modified.
By finished this blockchain project, we have learned plenty of knowledge and skills. This is a valuable experience for us. I remember that the first day at the hotel, we have to choose a project that fits our wishes and we decisively chose the blockchain project. It is because we are very interested in this technology and believes that blockchain is a revolutionary technology like AI or IOT. Therefore we must learn this technology through this opportunity. However, the process is not very smooth. We have encountered many bottlenecks during the work. For instance, we are no any idea on Ethereum, because we have to write a smart contract base on Ethereum. The biggest problem is we have to connect to the Ethereum test network to test our contract and we need to wait for complete synchronization of Ethereum. Syncing takes a lot of time. However, we cannot sync successfully, it is because of the UCLA network has blocked the package and not allowed to sync the Ethereum. Therefore we use a Mircosoft virtual server to finish the complete synchronization. |