Run a development network
You can run a personal Ethereum development network using Ganache, which allows you to develop a dapp in a secure test environment.
When using a local development blockchain such as Ganache or anvil, your node must calculate gas to make transactions on MetaMask.
Connect to Ganache
Follow the Ganache quickstart to set up a development network.
When you create a Ganache workspace, enter your MetaMask seed phrase into the Account & Keys setting. Ganache automatically gives each of your first 10 accounts 100 test ether (you can configure these numbers in Accounts & Keys), which makes it easy to start development.
Your seed phrase controls all your accounts, so we recommend keeping at least one seed phrase for development, separate from any used to store real value. You can manage multiple seed phrases by using multiple browser profiles, each with its own MetaMask installation.
In the Server setting of your workspace, find the hostname and port of your Ganache network, which comprises the RPC URL of your network:
In the MetaMask extension, connect to your Ganache network:
- Select the network you're currently connected to.
- Select Add network.
- Select Add a network manually.
- Enter the RPC URL of your network.
- Enter MetaMask's default chain ID for Ganache,
Reset your local nonce calculation
If you restart your development network, you can accidentally confuse MetaMask because it calculates the next nonce based on both the network state and the known sent transactions.
To clear MetaMask's transaction queue and reset its nonce calculation, go to Settings > Advanced and select Reset account.