Skip to content
Tutorials Center
My learning

Topics

Lesson 4 of 47 ยท Getting Started

Your Solidity Toolbox

A tour of the tools behind Solidity work: the solc compiler, Remix, Hardhat, Foundry, ethers.js and viem, wallets, local nodes and testnets, with a runnable loop.

Writing Solidity is only one step of a loop. You write a contract, compile it to bytecode, deploy it to a chain, call it, read the result, fix the bug and repeat. A small set of tools covers each step of that loop, and knowing what each one is for saves a lot of confusion on day one, because the names (Remix, Hardhat, Foundry, ethers, Anvil) all sound like they do the same thing.

This lesson maps the toolbox and shows the commands you would run. The real tools cannot run inside this website, so every command here is shown as read-only text. Afterwards you will run a small JavaScript stand-in that imitates the compile, deploy and call loop, so you can see what each tool does under the hood.

The Solidity loop

Write A .sol file in your editor.
Compile solc makes bytecode and an ABI.
Deploy Send it to a local or test chain.
Call Read and write through the ABI.

Every tool below automates one or more of these steps.

1 / 2

The compiler: solc

The Solidity compiler, solc, is the program that turns .sol source into EVM bytecode and an ABI (the JSON description of the functions, see How a Smart Contract Runs). Almost nobody calls it by hand. Remix, Hardhat and Foundry each download and drive it for you, and the pragma line at the top of a contract (see Your First Contract) tells the tool which compiler versions are acceptable.

If you did want to run it directly, the shape is roughly:

Terminal
solc --version
solc --bin --abi Counter.sol

You would get a long hexadecimal string (the bytecode) and a JSON array (the ABI). That is the whole output of compilation.

Remix: start here

Remix is a Solidity development environment that runs in your browser at remix.ethereum.org. You create a file, press compile, and deploy to a simulated in-browser chain with fake accounts that each hold fake ETH. A panel lists the deployed contract's functions as buttons, so you can click increment and watch a counter change without writing any JavaScript.

Remix is the best place for your first ten contracts: no installation, instant feedback and visible transactions. It is not what you use for a team project, because there is no real project structure, testing workflow or version control.

Hardhat: a JavaScript project

Hardhat is a Node.js tool for real projects. It gives you a folder layout (contracts/, test/, a config file), compiles your contracts, runs tests written in JavaScript or TypeScript against a built-in simulated chain, and runs deployment scripts. A typical session looks like this (commands are read-only here):

Terminal
mkdir my-contracts && cd my-contracts
npm init -y
npm install --save-dev hardhat
npx hardhat init
npx hardhat compile
npx hardhat test

If you already know JavaScript or TypeScript, Hardhat is the gentlest next step after Remix, since your tests, scripts and front end all share one language.

Foundry: fast, Solidity-first

Foundry is a toolkit written in Rust, and it takes a different approach: your tests are written in Solidity itself. That keeps you in one language and makes tests very fast. Foundry ships several programs:

Program Job
forge Compile, test, deploy and verify contracts
anvil Start a local chain with funded test accounts
cast Command-line client to read and send transactions
chisel An interactive Solidity shell
Terminal
forge init my-contracts
cd my-contracts
forge build
forge test
anvil

Many teams use both Hardhat and Foundry. For this tutorial's concepts either works, and the testing ideas are the same (Testing Contracts shows both).

ethers.js and viem: talking to a chain

The tools above write and test contracts. To use a deployed contract from a website or a script you need a client library. The two common ones are ethers.js and viem. Both connect to a node over JSON-RPC (a simple request format over HTTP), read contract data, sign and send transactions with a wallet, and listen for events. A small read-only example, using the ABI and an address, would be:

JavaScript
import { ethers } from "ethers";

const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
const counter = new ethers.Contract(counterAddress, counterAbi, provider);
console.log(await counter.count());

Talking to Contracts with JavaScript is a full lesson on this.

Wallets, nodes and networks

Three more words show up constantly:

  • A wallet (for example a browser extension such as MetaMask, or a hardware device) stores your private key and signs transactions for you. Never share the key or seed phrase, and never commit it to a repository.
  • A node is software that holds the chain state and answers JSON-RPC requests. You rarely run your own mainnet node. You use a provider's URL, and for development you run a local node.
  • A network is a specific chain: your local chain, a testnet such as Sepolia, or mainnet. Each has a numeric chain id.

For learning, the order is: Remix with the in-browser chain, then a local chain (anvil or npx hardhat node), then a testnet with free faucet coins, and mainnet only once the contract has been tested and reviewed. See Deploying to Testnet and Mainnet.

A compile, deploy and call loop you can run

The stand-in below is a miniature "toolchain" in JavaScript. It does not parse Solidity. It uses a tiny source format to show the shape of each step: compile produces bytecode (here a plain object) plus an ABI, deploy puts it at a fake address on a fake chain, and call goes through the ABI. The point is the pipeline, not the parser.

JS A toy compile-deploy-call loop

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The output walks through the same stages a real tool shows: the ABI list, an address, then calls that read and change storage. Real addresses are 20 bytes derived from the deployer, and real calls are encoded bytes sent over JSON-RPC, but the roles of compiler, chain and client are exactly these three.

Why local chains make you faster

A local chain such as Anvil or Hardhat's built-in network gives you funded test accounts, instant blocks and the freedom to rewind time. The next stand-in imitates one: it mines a block per transaction, lets you check balances, and can "mine" extra blocks to skip ahead, which is how real tests move past a deadline without waiting.

JS A fake local chain with instant blocks

Press Run (or Ctrl + Enter) to see the console output here.

No output.

What is real: solc produces bytecode and an ABI, Hardhat and Foundry automate compile, test and deploy, and local chains give you funded accounts and let you skip time. What is the stand-in: there is no Solidity parser, no real addresses, no JSON-RPC and no gas. The commands in the code blocks above are shown for reference and were not run here.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does the Solidity compiler (solc) produce?

    solc outputs bytecode that the EVM can run and an ABI that describes the public functions. Tools such as Remix, Hardhat and Foundry call it for you.
  2. 2. Which tool is best for your very first contracts, with nothing to install?

    Remix runs in the browser with an in-browser chain and fake accounts, so you can compile, deploy and click functions straight away.
  3. 3. What is the main difference in testing style between Hardhat and Foundry?

    Hardhat lives in the Node.js world, so tests are JS or TS. Foundry keeps tests in Solidity, which is also why they run so quickly.
  4. 4. What is the job of ethers.js or viem?

    They are client libraries that speak JSON-RPC to a node, use the ABI to encode calls, and work with a wallet or signer to send transactions.

Summary

  • The loop is write, compile, deploy, call; each tool automates part of it.
  • solc compiles Solidity to bytecode and an ABI; other tools drive it for you.
  • Remix needs no install and is ideal at the start; Hardhat suits JavaScript projects and Foundry suits Solidity-first workflows.
  • ethers.js and viem are client libraries for scripts and front ends.
  • Wallets hold keys and sign; nodes answer JSON-RPC; networks are local chains, testnets and mainnet with different chain ids.
  • Use local chains and testnets until contracts are tested, and never share private keys.

Next: Your First Contract.