This article follows the first article on the subject: http://128mots.com/index.php/2020/03/30/construire-une-application-decentralisee-full-stack-pas-a-pas-ethereum-blockchain-dapp-en-plus-de-128-mots-partie-1/
Example of decentralized voting application (Dapp)
The user of the decentralized application needs a wallet that contains Ether. As stated in the first article it is possible to easily create a wallet on https://metamask.io/.
First we will use the ropsten network. Ropsten Ethereum, also known as the "Ethereum Testnet", is, as the name suggests, a test network that performs the same protocol as Ethereum and is used for testing purposes before deploying on the main network (Mainnet). https://ropsten.etherscan.io/
The use will allow us to create and use our app for free before eventually broadcasting it on Ethereum's main network.
When the user connects to our application and the network he sends his vote and has to pay a few fees via his wallet in order to write his transaction in the Blockchain (called "Gas", this term refers to the fees to complete a transaction or execute a contract on the Ethereum blockchain).
Dapp app architecture
As stated in the first article the business rules and logic will be coded in a Smart Contract. The Smart Contract is written with the solidity programming language: https://solidity.readthedocs.io
Creation of the Front-End
The front-end will be simple it allows you to display the result of the vote for your favorite song in the form of a list and to choose from a drop-down list the song for which you wish to vote.
Check node installation
If node is not installed you can refer to my article on angular: http://128mots.com/index.php/2020/02/27/angular-en-plus-de-128-mots-partie-1/
Metamask installation: Installing https://metamask.io/ as an extension of your browser
Installation of the truffle framework: Truffle is a development environment, a testing framework and an asset pipeline for Ethereum, aimed at making your life easier as an Ethereum developer. It provides tools that allow us to write intelligent contacts with the Solidity programming language.
It will also be used to develop the front-end of the application.
npm install -g truffle
Ganache is a personal blockchain for Ethereum development that you can use to deploy contracts, develop your applications and run tests.
This will allow you to have a local blockchain with 10 accounts that are powered with fake Ether.
I started the app and clicked Quick Start
We see the different accounts of our local blockchain.