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 here:
https://github.com/PacktPublishing/Blockchain-Quick-Start-Guide/tree/master/Chapter04/CrowdFunding.
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');