Writing a campaign decentralized application
We just deployed our smart contract on our local Ganache blockchain environment. Now, we will start to write UI code to trigger smart contract functions through an RPC call. The source code for this chapter is available at https://bit.ly/2X8xPBL.
Selecting a web3 provider
When we load a web page, we need to connect to a web3 provider. If you have already installed a provider such as MetaMask, you can use your correct provider option, as follows:
App.web3Provider = web3.currentProvider;
In our crowdfunding example, for the sake of simplicity, we will directly connect to our local Ganache server, as follows:
App.web3Provider = new Web3.providers.HttpProvider('http://localhost:8545');
Loading account information
To load accounts, we define a drop-down menu with empty content, as follows:
<div class="form-group"> <label for="exampleFormControlSelect1">Accounts</label> <select class="form-control" id="accts...