This repository provides a complete Hardhat setup for testing reencryption, decryption, and ciphertext formation in smart contracts.
Below, we run a local node and a local covalidator (taken from the Docker Compose file), and run Hardhat tests against it.
git clone <your-repo-url>
cd into_your_repopnpm installThe current instructions will run a local node and a local covalidator. If you are using this template against another network, e.g. Base Sepolia, skip this step.
docker compose upFill in your own information in the .env file, you can take this as example:
# This should be a private key funded with native tokens.
PRIVATE_KEY_ANVIL="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
PRIVATE_KEY_BASE_SEPOLIA=""
# This should be a seed phrase used to test functionalities with different accounts.
# You can send funds from the main wallet to this whenever needed.
SEED_PHRASE="garden cage click scene crystal fat message twice rubber club choice cool"
# This should be an RPC URL provided by a proper provider
# that supports the eth_getLogs() and eth_getFilteredLogs() methods.
LOCAL_CHAIN_RPC_URL="http://localhost:8545"
BASE_SEPOLIA_RPC_URL="https://base-sepolia-rpc.publicnode.com"
pnpm hardhat compilepnpm hardhat test --network anvilOr, if running against another network, e.g. Base Sepolia, run
pnpm hardhat test --network baseSepolia- End-to-end testing of encryption, reencryption and decryption functionalities.
- Hardhat-based test framework.
- Supports reencryption and ciphertext validation.