Skip to content

chen1415-UNSW/COMP9900

Repository files navigation

Block Business

Yihan Xiao: z5099956@ad.unsw.edu.au
Li Yu: z3492782@ad.unsw.edu.au
Chenwei Qian: z5107753@ad.unsw.edu.au
Hao Chen: z5102446@ad.unsw.edu.au

Final Demo accomplished. Well done! front page

Initialization:

The project is based on Node.js, which requires NPM environment to install all needed package. You need to install Node.js and NPM in the first place.

Start terminal at the root directory.
Run:

npm install

This will install all packages the project needs according to the package.json file in root path. When the installation is done, directory node_modules will be made.

Install Webpack, which is used to pack all files related to block-chain. You may need to run the following commands:
Run:

npm install -g webpack
npm install -g webpack-cli

Install TestRPC(Ganache). Download and install following the link:
http://truffleframework.com/ganache

Start Ganache and you will see the interface:

interface of Ganache

Click on the configure icon at the top-right, next to the search bar. Then fill in all information of SERVER page as below. The Port Number is extremely important, and make sure it is set to 8545 otherwise the webpage will fail to connect.

Ganache config

Click on ACCOUNT&KEYS next to SERVER and you shall see a page as below. Copy the keys from address_keys.txt in the root path or below and paste in the keys field here. The addresses generated by Ganache are different on different PC and this will cause problem that the address assigned to user may conflict with each other. We use the identical key to ensure the consistency of address pool. Set the total number of address to 50.
Keys:

snack aim path industry cabbage knife ball select meadow oppose wrist vote

keys

Finally, click RESTART at top-right to restart Ganache.

Buildup Smart Contract

You can now begin to build the project. Start the terminal from root and run:

truffle develop

You should be able to see the following message:

truffle

Next Run:

compile --reset

compile contract

This will make truffle to compile all Solidity code in Contract directory. When it is done, a new directory named build/contracts will be generated in root path. All compiled contracts will be placed here in .json format.

Next Run:

migrate --network development --reset

migrate

This will migrate the smart contract defined in Solidity onto Ganache. You shall see the details showing the deployment of smart contract on Ganache from the interface of Ganache in the Transaction page:

deploy

At last, run:

.exit

You will exit from truffle command-line and back to the root path.

Package files with Webpack

After all steps above, the smart contract is ready to use and we need to include them into a Javascript module for webpage to use.
Run:

npm run build

webpack

Start Website

Run:

npm start

Go to http://localhost:3000 with browser and you shall see the front page of the project.

About

Project for COMP9900

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors