Skip to content

Inco-fhevm/fhevm-hardhat-template-rivest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hardhat Template Open in Gitpod Hardhat License: MIT

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.

Getting Started

Click the Use this template button to create a new repository from this template.

Features

This template integrates popular frameworks and libraries. For more details, refer to their respective documentation:

Sensible Defaults

Default configuration files included:

├── .editorconfig
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solcover.js
├── .solhint.json
└── hardhat.config.ts

GitHub Actions

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.

Usage

Prerequisites

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

Development on Rivest Testnet

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

Development on Local Docker Setup

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

Resources