A Hardhat-based template for developing Solidity smart contracts, complete with sensible defaults.
- Hardhat: Compile, run, and test smart contracts.
- TypeChain: Generate TypeScript bindings for smart contracts.
- Ethers: Trusted Ethereum library and wallet implementation.
- Solhint: Solidity code linter.
- Solcover: Code coverage tool.
- Prettier Plugin Solidity: Code formatter.
Click the Use this template
button to create a new repository from this template.
This template integrates popular frameworks and libraries. For more details, refer to their respective documentation:
- Hardhat Tutorial and Docs.
- Check out the Testing Contracts section in Hardhat’s tutorial.
Default configuration files included:
├── .editorconfig
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solcover.js
├── .solhint.json
└── hardhat.config.ts
GitHub Actions are pre-configured for this template. Contracts are linted and tested on each push and pull request to the main
branch.
To enable CI, set INFURA_API_KEY
and MNEMONIC
as GitHub secrets. The CI script is located at .github/workflows/ci.yml.
Install pnpm. To get started, create a .env
file and set a BIP-39 compatible mnemonic as an environment variable.
cp .env.example .env
If you don’t have a mnemonic, generate one here.
Next, install dependencies (requires Node v20 or newer):
pnpm install
Run the pre-launch script to set up the environment:
sh pre-launch.sh
This generates necessary precompile ABI files.
Compile contracts with Hardhat:
pnpm compile
Deploy contracts on the Rivest network:
pnpm deploy:contracts --network rivest
Run tests on the Rivest network:
pnpm test:rivest
Install Docker.
Start fhEVM During installation (see previous section) we recommend you for easier setup to not change the default .env : simply copy the original .env.example file to a new .env file in the root of the repo.
Then, start a local fhEVM docker compose that inlcudes everything needed to deploy FHE encrypted smart contracts using:
pnpm fhevm:start
The initial setup takes 2–3 minutes. Wait until blockchain logs appear to confirm completion.
Run tests in a new terminal:
pnpm test
Stop the node after testing:
pnpm fhevm:stop
Clean up artifacts, coverage reports, and cache:
pnpm clean
- Block Explorer: https://explorer.rivest.inco.org/
- Faucet: https://faucet.rivest.inco.org/
- RPC Endpoint: https://validator.rivest.inco.org
- Gateway Endpoint: https://gateway.rivest.inco.org