|
| 1 | +# Fhevm React Template |
| 2 | + |
| 3 | +A modern React template for building decentralized applications (dApps) with Fully Homomorphic Encryption (FHE) capabilities using fhevmjs. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **fhevmjs**: Fully Homomorphic Encryption for Ethereum Virtual Machine |
| 8 | +- **React**: Modern UI framework for building interactive interfaces |
| 9 | +- **Vite**: Next-generation frontend build tool |
| 10 | +- **Wagmi**: React hooks for Ethereum |
| 11 | +- **Tailwind**: Utility-first CSS framework for rapid UI development |
| 12 | +- **@reown/appkit**: Comprehensive toolkit for Web3 authentication including social logins and multi-wallet support |
| 13 | +- **@radix-ui**: Unstyled, accessible UI components for building high-quality design systems and web apps |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +- Node.js (v20 or higher) |
| 18 | +- npm, yarn, or pnpm package manager |
| 19 | +- MetaMask or another Ethereum wallet |
| 20 | + |
| 21 | +## Getting Started |
| 22 | + |
| 23 | +1. Fork the following repository: |
| 24 | + [https://github.com/zama-ai/fhevm-react-template](https://github.com/zama-ai/fhevm-react-template) |
| 25 | + |
| 26 | +2. Clone your repository: |
| 27 | + |
| 28 | +```bash |
| 29 | +git clone https://github.com/your-username/fhevm-react-template |
| 30 | +cd fhevm-react-template |
| 31 | +``` |
| 32 | + |
| 33 | +1. Install dependencies: |
| 34 | + |
| 35 | +```bash |
| 36 | +npm install |
| 37 | +# or |
| 38 | +yarn install |
| 39 | +pnpm install |
| 40 | +``` |
| 41 | + |
| 42 | +1. Configure environment variables: |
| 43 | + |
| 44 | +```bash |
| 45 | +cp .env.example .env |
| 46 | +``` |
| 47 | + |
| 48 | +Update `.env` with your specific configuration: |
| 49 | + |
| 50 | +- `VITE_ACL_ADDRESS`: fhevm specific |
| 51 | +- `VITE_KMS_ADDRESS`: fhevm specific |
| 52 | +- `VITE_GATEWAY_URL`: fhevm specific |
| 53 | +- `VITE_PROJECT_ID`: Obtain your project ID by signing up at [reown.com](https://reown.com/). This enables social login and multi-wallet support. |
| 54 | +- `VITE_CONF_TOKEN_ADDRESS`: The address of your deployed confidential ERC20 token contract on Sepolia testnet. You'll get this after deploying the smart contract. |
| 55 | + |
| 56 | +## Development |
| 57 | + |
| 58 | +Start the development server: |
| 59 | + |
| 60 | +```bash |
| 61 | +npm run dev |
| 62 | +# or |
| 63 | +yarn dev |
| 64 | +pnpm dev |
| 65 | +``` |
| 66 | + |
| 67 | +Visit [http://localhost:5173/](http://localhost:5173/) to view your application. |
| 68 | + |
| 69 | +## Production Build |
| 70 | + |
| 71 | +Create a production-ready build: |
| 72 | + |
| 73 | +```bash |
| 74 | +npm run build |
| 75 | +# or |
| 76 | +yarn build |
| 77 | +pnpm build |
| 78 | +``` |
| 79 | + |
| 80 | +## Development Options |
| 81 | + |
| 82 | +### Using the Mocked Coprocessor |
| 83 | + |
| 84 | +For faster development without testnet tokens, you can use a mocked fhevm: |
| 85 | + |
| 86 | +1. Check out the `ConfidentialERC20` example in the [`mockedFrontend` branch](https://github.com/zama-ai/fhevm-react-template/tree/mockedFrontend) |
| 87 | +2. Follow the branch-specific README for setup instructions |
| 88 | +3. Develop and test your dApp locally before deploying to Sepolia |
| 89 | + |
| 90 | +### Using Sepolia Testnet |
| 91 | + |
| 92 | +For testing with real network conditions, deploy your dApp to Sepolia testnet: |
| 93 | + |
| 94 | +1. Ensure you have Sepolia testnet ETH |
| 95 | +2. Configure your `.env` with Sepolia network details |
| 96 | +3. Deploy and test your contracts |
| 97 | + |
| 98 | +## Learn More |
| 99 | + |
| 100 | +- [fhevm Documentation](https://docs.zama.ai/fhevm) |
| 101 | +- [React Documentation](https://reactjs.org/) |
| 102 | +- [Vite Documentation](https://vitejs.dev/) |
| 103 | +- [Wagmi Documentation](https://wagmi.sh/) |
| 104 | + |
| 105 | +## Support |
| 106 | + |
| 107 | +For questions and support: |
| 108 | + |
| 109 | +- [fhevm Discord Community](https://discord.gg/zamaai) |
| 110 | +- [GitHub Issues](https://github.com/zama-ai/fhevm-react-template/issues) |
| 111 | + |
| 112 | +## License |
| 113 | + |
| 114 | +This project is licensed under the MIT License - see the LICENSE file for details. |
0 commit comments