Remix IDE Cheatsheet

Environments (VM, Injected, Testnet)

Use this Remix IDE reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.

Environment Overview

The Environment dropdown in Deploy & Run determines where transactions are sent.

EnvironmentNetworkWallet neededGas cost
Remix VM (Prague)In-browser EVM, latest hardfork rules — the defaultNoFree (fake ETH)
Remix VM (Cancun / Shanghai / …)In-browser EVM under older hardfork rulesNoFree
Remix VM — Mainnet forkIn-browser EVM forked from live mainnet stateNoFree (fake ETH)
Saved VM statesReload a VM state you saved earlier (.states/ in the workspace)NoFree
Injected Provider — MetaMaskWhatever network MetaMask is onMetaMaskReal or testnet ETH
WalletConnectAny WC-compatible walletYesReal or testnet ETH
Hardhat ProviderLocal Hardhat node (port 8545)NoFree (local)
Foundry ProviderLocal Anvil node (port 8545)NoFree (local)
External HTTP ProviderCustom RPC URLDependsDepends

Remix VM — the default environment

The in-memory EVM runs entirely in the browser. No network calls.

  • 15 pre-funded accounts with 100 fake ETH each.
  • The dropdown offers one VM per hardfork — the newest supported fork (Prague-era at the time of writing) is the default; older ones (Cancun, Shanghai, London, …) stay available for regression testing.
  • Remix VM — Mainnet fork boots the browser VM from live mainnet state, so you can call real deployed contracts with fake ETH; custom forks let you pick an RPC URL and block.
  • State resets on page refresh — save the VM state to keep it (next section).
  • Best for: rapid iteration, unit-test-style experiments.

Saving & Restoring VM State

Remix does not have an environment literally named "Persistent" — instead you save VM states and reload them:

  • In Deploy & Run, use the save VM state control next to the environment selector. The current VM state (deployed contracts, balances, storage) is written as a JSON file under .states/ in the active workspace.
  • Saved states appear as selectable environments, so a deployment can survive page refreshes and multi-session work.
  • Delete the state file (or use the delete control) to reset.
  • Separately, the pin icon on a deployed-contract card pins that instance to the workspace so it reappears in Deployed Contracts when you return to the same environment.

Injected Provider (MetaMask)

Connects Remix to MetaMask (or any EIP-1193 injected wallet).

  1. Install MetaMask.
  2. Select Injected Provider — MetaMask in the Environment dropdown.
  3. MetaMask popup asks to connect — approve.
  4. Remix shows the active account and its real balance.
  5. Every Deploy or write call triggers a MetaMask confirmation popup.

Switch networks inside MetaMask; Remix follows automatically. The network name is shown next to the Environment label.

Common Testnets via MetaMask

TestnetChain IDFaucet
Sepolia11155111cloud.google.com/application/web3/faucet
Hoodi560048hoodi-faucet.pk910.de
Base Sepolia84532faucet.quicknode.com
Arbitrum Sepolia421614faucet.arbitrum.io

Add testnets to MetaMask via chainlist.org.

WalletConnect

  1. Select WalletConnect from the Environment dropdown.
  2. A QR code appears — scan with any WalletConnect v2-compatible mobile wallet.
  3. Approve the connection on your phone.
  4. Transactions require mobile confirmation.

Local Hardhat / Anvil

Run a local node first:

# Hardhat
npx hardhat node          # RPC at http://127.0.0.1:8545

# Foundry Anvil
anvil                     # RPC at http://127.0.0.1:8545

Then in Remix select Hardhat Provider or Foundry Provider — Remix connects to port 8545 automatically. The pre-funded accounts from the node appear in the Account dropdown.

External HTTP Provider

For any custom RPC (Infura, Alchemy, local devnet, L2):

  1. Select External HTTP Provider.
  2. Enter the RPC URL in the dialog (e.g., https://mainnet.infura.io/v3/YOUR_KEY).
  3. Remix uses eth_accounts to list signers. For remote nodes without unlocked accounts, use an injected wallet instead.
https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_KEY
https://polygon-amoy.infura.io/v3/YOUR_KEY

Never send real-mainnet transactions from Remix without reviewing gas and confirming in MetaMask.

Switching Environments Safely

  • Switching environment resets the Deployed Contracts panel (instances from old env disappear).
  • Reload existing on-chain contracts with At Address + the same ABI after switching.
  • Account and gas settings carry over but Value resets to 0.