Beginner

Intro to Hardhat / Foundry — Key concepts

Learn the dev workflow.

Developer Beginner
3/7 — Intro to Hardhat / Foundry — Key concepts

ConfigNetwork RPCs, chainIds, accounts, paths. Keep secrets in .env.

ArtifactsCompilation outputs ABI + bytecode. Scripts/tests import these.

TestsHardhat uses Mocha/Chai; Foundry uses Solidity tests. Aim for fast unit tests and a few integration tests.

ScriptsDeploy, verify, or interact tasks. In Hardhat, use ethers/signer; in Foundry, use forge scripts or cast for quick calls.

// Hardhat sample test (JS)
it("increments", async () => {
  const counter = await ethers.deployContract("Counter");
  await counter.increment();
  expect(await counter.getCount()).to.equal(1);
});

ForkingBoth can fork mainnet/testnets for realistic tests. Great for integration without live funds.

← Previous section
Next section →