Web3 Provider
Connecting using a Web3 Provider actually establishes a connection to a software outside of the browser. Like youād connect to a database. Or to any other API. Itās either a RESTful interface or a WebSocket interface. And behind that interface sits a blockchain. This can be Go-Ethereum, Hyperledger Besu, Nethereum - or - Ganache for Development.
Letās start with Ganache!
Download and Install Ganache
Go to https://www.trufflesuite.com/ganacheā and download Ganache for your Operating System. I am downloading it for Windows for this Lab. But there are also versions for MacOS and Linux. Thereās a UI Version and also a CLI (Command Line Interface) Version.
Run through the Setup Wizard and install it for your operating system.
Start Ganache
If you start ganache, it will ask you if you want to do a quickstart or actually start with a workspace. For now itās safe to say: We do a quickstart.
This will create 10 accounts and assign each 100 ether. The accounts are unlocked. All is ready! š§āš
Ganache is now a Blockchain and a Wallet. Two in one. Anyone can connect to it using a Web3 Provider Method either via http RPC or WebSockets.
Pay attention to the RPC Endpoint:
Connect Remix
From the Environment Dropdown select now āWeb3 Providerā:
A new Popup will appear, and enter the RPC Server URL from Ganache. Pay attention to the Port number:
Your Accounts from Ganache should popup in the Accounts-Dropdown:
Deploy to Ganache
Now letās see what happens if we hit the Deploy Button:
Have you seen how fast that was? šļø
Now you have the benefit of two things: An actual blockchain node, but fast like a development network.
Going forward itās probably best to use either the JavaScript VM or Web3 Provider with Ganache. The choice is yours, whatever you prefer. For ease of use, Iāll use the JavaScript VM throughout the rest of the Solidity explanations.