Client side application of https://github.com/0Alic/COBrA-Smart-Contract. The backend, i.e. the smart contracts are extended (as explained in the report).
A simple content sharing platform backend / frontend on Ethereum blockchain. Final project of the Peer To Peer and Blockchains course at the university of Pisa, academic year 2017/2018.
The goal of this project concerns to learn how to write a client application (in this case a web app) interacting with Solidity smart contracts. This application has no practical use, and the contents have no real "content" to display (sorry if in the other page I have promised that the DApp would store the actual contents 🐑).
In any case, I would like to thank DApp univeristy with this great tutorial who helped me a lot at the beginning.
NodeJS to download Truffle and other useful packages. Truffle basically helps you to compile your smart contracts, provides you abstractions to interact with them in your client side application and helps you to deploy your contracts on a local blockchain or on real one.
- To create a local blockchain and get some fake accounts to interact with I have used Ganache;
- to deploy on a real blockchain (in my case, the test chain called Ropsten) I have exploited an Infura node running an Ethereum client (instead of using Geth, since I would need to sync with Ropsten (download it) in order to interact with it) following this tutorial.
Finally Metamask. In any case, the tutorial linked above exaplains everything way better than I do here.
- Install NodeJS;
- Install Truffle
npm install truffle -g
git clone
this repository;npm install
;- Install Metamask.
- Install Ganache;
- Run Ganache (my case, port 8545);
- Open Metamask, import account from Ganache (by copying the private key);
truffle migrate --reset
(it also compiles the contracts);- new tab and
npm run dev
to run a local server to enable ajax calls (to retrieve JSON contracts);
- Follow this.
Latex code for code highligthing:
- Javascript: gist from sgmonda;
- Solidity: github repo from s-tikhomirov.