A Rock-Paper-Scissors game with Fully Homomorphic Encryption (FHE) enabled Solidity smart contracts using the FHEVM protocol by Zama.
| Package | Release | Description |
|---|---|---|
fhevm-rock-paper-scissors-hardhat |
0.1.0 |
Hardhat project for the development of the FHEVM Rock-Paper-Scissors smart contracts. |
fhevm-rock-paper-scissors |
0.1.0 |
TypeScript library that facilitates the interaction with the FHEVM Rock-Paper-Scissors smart contracts. |
Execute the following steps from the root folder of the monorepo.
Install the package dependencies.
pnpm installInside the packages/hardhat/ folder, set the required variables using Hardhat's built-in variable system:
npx hardhat vars set MNEMONIC
npx hardhat vars set INFURA_API_KEY
Inside the packages/sdk/ folder, rename the .env.example file to .env, then set the required environment
variables. Ensure the first and second accounts derived from the MNEMONIC have sufficient Sepolia testnet funds to run
the tests.
Compile the smart contracts.
pnpm hardhat:compileTypeChain types are generated automatically after compilation and are available at packages/hardhat/types/ and
packages/sdk/src/types/.
Build the TypeScript SDK.
pnpm sdk:buildRun the TypeScript SDK tests.
pnpm sdk:testfhevm-rock-paper-scissors/
├── packages/
│ ├── hardhat/ # Hardhat package
│ │ ├── contracts/ # Smart contract source files
│ │ │ ├── FHERockPaperScissors.sol # FHEVM Rock-Paper-Scissors contract
│ │ │ └── FHERockPaperScissorsFactory.sol # FHEVM Rock-Paper-Scissors factory contract
│ │ ├── deploy/ # Deployment scripts
│ │ ├── tasks/ # Hardhat custom tasks
│ │ │ ├── FHERockPaperScissors.ts # FHEVM Rock-Paper-Scissors tasks
│ │ │ └── FHERockPaperScissorsFactory.ts # FHEVM Rock-Paper-Scissors factory tasks
│ │ ├── hardhat.config.ts # Hardhat configuration
│ │ └── package.json # Dependencies and scripts
│ └── sdk/ # SDK package
│ ├── src/ # Source files
│ ├── test/ # Test files
│ └── package.json # Dependencies and scripts
├── docs/ # Documentation and guides
└── package.json # Dependencies and scripts
| Script | Description |
|---|---|
pnpm lint |
Run linting checks |
pnpm format |
Apply Prettier format |
pnpm clean |
Clean build artifacts |
pnpm hardhat:compile |
Compile all contracts |
pnpm hardhat:chain |
Run a local development chain |
pnpm hardhat:deploy |
Deploy all contracts on localhost and generate the types |
pnpm hardhat:deploy:sepolia |
Deploy all contracts on Sepolia and generate the types |
pnpm sdk:build |
Build the TypeScript SDK |
pnpm sdk:test |
Run all SDK tests |
To interact with the FHEVM Rock-Paper-Scissors contracts, you can use either the TypeScript SDK or the Hardhat tasks.
Quick start guides:
Technical references:
This project is licensed under the BSD-3-Clause-Clear License. See the LICENSE file for details.
Built with ❤️ by Germán, based on a template from the Zama team