Project realized for the course "Software Cybersecurity" at UniversitΓ politecnica delle Marche.
This project create a ticket office application for events using blockchain technology.
This project is tested on OS windows 10 and browser Google Chrome.
- Clone the repository
git clone https://github.com/MassimoCiaffoni/Software-Cybersecurity-Project
-
Download and install ganache at official web site: trufflesuite.com/ganache
-
Execute ganache and create a new blockchain as below screenshot
-
Go under "Workspace" section and click "Add project" to add configuration in "truffle-config.js" file under root directory of this repository.
-
Select "Accounts & keys" section and paste this string:
today rifle dish twin sight endless tube prepare tribe detect accident blur
inside the mnemonic field and finally save the workspace.
To manage a user accounts and login, we use a browser plugin Metamask.
-
To install it, with google chrome browser go to: metamask.io/download and click "Install MetaMask for Chrome"
-
Click on the extension, it will open a new page with this screen and click here to import account from ganache
-
In the "Secret Recovery Phrase" paste the previus string used to generate account on ganace, and choose a password to login into metamask.
-
Now we have to configure the network that we use to connect metamask and ganache. On the extension, click on the network icon and select "Custom RPC".
-
Compile the fields as below and then save it
-
Now we are connected. For use more account, we have to import it manually. So, go on ganache under "Account" section and click the right key button on the second account. It will open a dialog with the private key. We have to copy it.
-
Now go on metamask and click "Import account".
-
Then paste the private key and import it
-
Repeat from the 6 step to import more account. For our purpose, we need at least 3 user.
To compile contracts and manage the blockchain, we use the Truffle suite.
-
To install it run
npm install -g truffle
(if you don't have npm, download and install it from nodejs.org/it/download )
The client is a web-app with react and Node.js. To launch it, we have to do the following steps:
-
Compile the Solidity contract, with this command on the root directory
truffle migrate
-
Now change directory and go under /client folder.
-
We have to install the dependencies used into project. So run the command:
npm install --no-audit
-
Now we can finally execute the web-app. Now run this command to start the server. It will open a new tab on the browser with the app!
npm run start-all
-
Now we need to connect our metamask accounts to the WebApp. For this purpose go to the three dot options and select connect to site
Metamask will ask which accounts we want to connect; select all imported accounts
-
Now we are connected to the WebApp and ready to test all his functionalities.
For usage guide, see the detailed report from page 101.
Massimo Ciaffoni (Matricola 1102853)
Denil Nicolosi (Matricola 1100331)
Michele Pasqualini (Matricola 1101226)
Francesco Zerbino Di Bernardo (Matricola 1102495)
Apache License 2.0