Skip to main content

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.

note

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.

important

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:

http://<hostname>:<port>

In the MetaMask extension, connect to your Ganache network:

  1. Select the network you're currently connected to.
  2. Select Add network.
  3. Select Add a network manually.
  4. Enter the RPC URL of your network.
  5. Enter MetaMask's default chain ID for Ganache, 1337.

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.

Next steps

Once you have your development environment set up and development network running, you can connect to MetaMask by setting up MetaMask SDK, detecting MetaMask, detecting a user's network, and accessing a user's accounts.

For an end-to-end example, you can also follow the Create a simple React dapp tutorial.