Remix IDE Cheatsheet
Compiling
Use this Remix IDE reference while you build software engineering projects, review code, or refresh the syntax you reach for most.
Opening the Compiler
Click the Solidity compiler icon (looks like an S) in the left icon bar. (Ctrl+S compiles the active file; Ctrl+Shift+S compiles it and runs the open script.)
Compiler Settings
| Setting | Where | Notes |
|---|---|---|
| Compiler version | Version dropdown | Pick exact version or use auto (reads pragma) |
| Language | Language dropdown | Solidity (default) or Yul |
| EVM Version | Advanced → EVM Version | prague, cancun, shanghai, … — default tracks the newest fork the selected compiler supports |
| Optimization | Enable Optimization checkbox | Runs = 200 default; raise for deploy-once contracts, lower for frequently-called |
| Via IR | Advanced → Via IR | Enables the Yul intermediate pipeline (better optimization, slower compile) |
| Auto compile | Auto compile checkbox | Recompiles on every save (Ctrl+S) |
| Hide warnings | Hide warnings checkbox | Suppresses non-error diagnostics |
Selecting a Compiler Version
pragma solidity ^0.8.24; // Remix auto-selects >=0.8.24 <0.9.0
- Auto: Remix reads the
pragmaand picks the latest matching release. - Manual: use the dropdown to pin an exact version (e.g.,
0.8.24+commit.e11b9ed9).
First compile after selecting a new version downloads the compiler WASM — wait for the spinner to stop.
Compiling
- Auto compile on — file saves trigger compilation automatically.
- Manual — click the blue Compile \<filename\>.sol button.
- Keyboard —
Ctrl+Ssaves and (if Auto compile is on) compiles.
Reading Compiler Output
After a successful compile the button turns green. Expand the Compilation Details panel:
| Tab | Content |
|---|---|
| ABI | JSON array of function/event signatures |
| Bytecode | Deployed bytecode (hex) |
| Runtime Bytecode | Code stored on-chain |
| Metadata | IPFS/Swarm hash, compiler settings |
| Function Hashes | 4-byte selectors |
| Gas Estimates | Per-function upper-bound gas |
Click Copy ABI or Copy Bytecode to clipboard.
Errors and Warnings
| Color | Meaning |
|---|---|
Red underline + red ✗ | Error — contract will not compile |
Yellow underline + yellow ! | Warning — compiles but potential issue |
| Blue squiggle | Info / style hint |
Hover over underlined code for the full message. Errors also appear in the Terminal with file + line references.
Common Errors
| Error | Cause | Fix |
|---|---|---|
Source file requires different compiler version | pragma mismatch | Change compiler version in dropdown |
Identifier not found | Missing import | Add import statement |
Stack too deep | Too many local variables | Use --via-ir, split function, or use memory struct |
Contract size limit | Bytecode > 24 KB | Split into libraries, optimize, or enable --via-ir |
SPDX license identifier not provided | Missing header | Add // SPDX-License-Identifier: MIT |
Optimization Examples
// For a contract deployed once and called many times (e.g., ERC-20) // Optimizer runs: 200 (default) — good balance // For a factory deployed rarely but instances called often // Optimizer runs: 1 (minimize deploy cost) // For a library called millions of times // Optimizer runs: 100000 (minimize runtime cost)
Set runs in Advanced Configurations → Optimization → Runs.
Exporting Artifacts
After compile, artifacts (ABI + bytecode JSON) are written to artifacts/<ContractName>.json in the workspace. Use these with ethers.js / web3.js:
const artifact = require('./artifacts/Hello.json'); const factory = new ethers.ContractFactory(artifact.abi, artifact.bytecode, signer);