Integrations / Development Toolkit
Quai Foundry Integration
Foundry's forge is the fastest way to build and fuzz EVM contracts — and because Quai zones are EVM-compatible, your forge build and test loop works unchanged. Deployment pairs forge artifacts with a small quais script, since Quai nodes speak the quai_ RPC namespace.
- Works today
- forge build · forge test · fuzzing
- Deploys via
- quais SDK + forge artifacts
- Compiler
- solc ≤ 0.8.20
- Status
- Community workflow — no official plugin yet
How Foundry fits Quai
Foundry is a self-contained EVM toolkit: forge compiles and runs Solidity-native tests against its own in-process EVM, with no chain connection required. Since Quai's zone chains execute standard EVM bytecode, everything that makes Foundry attractive — fast compilation, property-based fuzzing, gas snapshots, Solidity test files — applies directly to contracts destined for Quai.
The boundary is at the RPC layer. Tools like forge create, cast, and anvil assume an eth_ JSON-RPC namespace, while Quai nodes expose quai_ methods and a sharded address space. So the workflow advanced EVM teams use today is: develop and test with forge offline, then deploy the artifacts forge produces using a short script built on the quais SDK — Quai's maintained fork of Ethers v6.
This split is less awkward than it sounds. Forge artifacts are plain JSON containing ABI and bytecode, and a quais ContractFactory consumes them directly. Your test suite, fuzz campaigns, and gas profiling stay pure Foundry; only the final deploy step changes.
Set up a Foundry workflow for Quai
- 1
Install Foundry and initialize a project
Standard Foundry installation — nothing Quai-specific yet.
terminalbash curl -L https://foundry.paradigm.xyz | bash foundryup forge init my-quai-project && cd my-quai-project - 2
Pin the compiler to a Quai-supported version
Quai supports Solidity up to 0.8.20, so pin solc in foundry.toml to keep artifacts deployable.
foundry.tomltoml [profile.default] src = "src" out = "out" libs = ["lib"] solc = "0.8.20" optimizer = true optimizer_runs = 1000 - 3
Build and test with forge
Run your full unit and fuzz suites locally. Quai zone chains execute the same EVM semantics your tests exercise.
terminalbash forge build forge test -vvv forge snapshot # gas report - 4
Deploy forge artifacts with quais
Add the quais package alongside your Foundry project and deploy the compiled artifact to Cyprus-1 (mainnet, chain ID 9) or Orchard testnet (chain ID 15000).
terminalbash npm install quais node script/deploy.mjs - 5
Verify on Quaiscan
Verify deployed sources through quaiscan.io/contract-verification using the Solidity standard JSON input that forge produces.
What teams use it for
Property-based fuzzing
Run forge's fuzzer against invariants before contracts ever touch a live zone — the highest-leverage testing for DeFi and token logic.
Gas profiling
forge snapshot and gas reports tune contracts locally; Quai's sub-penny fees still reward efficient bytecode at scale.
Solidity-native test suites
Teams that prefer tests in Solidity over JavaScript keep their entire test culture and add only a thin quais deploy layer.
Migrating Ethereum codebases
Bring an existing Foundry repo as-is: tests keep passing, and only the deployment scripts change to target Quai endpoints.
Deploy a forge artifact to Quai
Forge writes ABI and bytecode to out/. A quais ContractFactory consumes that artifact directly — this is the entire deployment bridge.
import { JsonRpcProvider, Wallet, ContractFactory } from "quais";
import artifact from "../out/Counter.sol/Counter.json" with { type: "json" };
const provider = new JsonRpcProvider("https://rpc.quai.network", undefined, {
usePathing: true,
});
const wallet = new Wallet(process.env.DEPLOYER_PK, provider);
const factory = new ContractFactory(
artifact.abi,
artifact.bytecode.object, // forge stores bytecode under .object
wallet
);
const counter = await factory.deploy();
await counter.waitForDeployment();
console.log("Counter deployed to:", await counter.getAddress());Frequently asked questions
Can forge deploy directly to Quai Network?
Not yet. forge create and cast send issue eth_ namespace RPC calls, while Quai nodes expose quai_ methods. The working pattern is to compile and test with forge, then deploy the forge artifact with a short quais SDK script — about ten lines of JavaScript.
Does anvil simulate Quai Network?
anvil simulates a generic single-chain EVM, which is fine for unit testing contract logic. It does not model Quai-specific behavior like sharded addresses, cross-zone transactions, or the quai_ RPC namespace. For integration testing against real network behavior, run a local Quai node or use the Orchard testnet.
Which Solidity version should I target with Foundry for Quai?
Pin solc to 0.8.20 or lower in foundry.toml. Quai supports Solidity up to 0.8.20, and pinning keeps your forge artifacts directly deployable.
Is official Foundry support for Quai planned?
There is no official Foundry plugin today — this page documents the community workflow that advanced EVM teams use. Watch docs.qu.ai and the dominant-strategies GitHub organization for tooling announcements.
Can I keep my existing Foundry tests when moving to Quai?
Yes. Tests run against forge's local EVM and are independent of the target chain, so an existing suite carries over unchanged. Only deployment and any chain-specific scripting move to the quais SDK.
Keep forge. Add Quai.
Your test suite already works. Add a ten-line deploy script and put your contracts on a network built to scale proof-of-work.