When we want to test the truffle application, we should construct a test environment. Generally, we use MetaMask to complete transactions. Before that, we must have some ethers in the MetaMask.
1. Install Ganache and MetaMask.
2. Open the ganache and click the setting icon on the top-right of the window. Then set port number to “8545”. Next, click “cancel” and copy the RPC server in the window.
3. Open MetaMask and change the network to custom RPC. Then click setting. Paste the RPC server to the new network.
4. Then import account in MetaMask. And input the private key of any addresses in Ganache now. Remind don’t input the address. Instead, click the key icon on the right of the address you can get the private key.
5. Now you have ether in your account.