How zama-ai/httpz-solidity works
Main Architectural Components and Their Roles
• Smart Contract / Blockchain Layer: Represent the underlying confidential smart contracts (the “HTTPZ” logic) that integrate FHE directly into Solidity contracts. This is the core of the project.
• Code Generation Module: Based on the “codegen” folder, this component generates operator overloads, templates, and tests to support FHE operations in smart contracts. It automates the creation of boilerplate code to support encrypted integer operations.
• Deployment & Task Scripts: The “tasks” directory (with files like taskDeploy.ts and getEthereumAddress.ts) encapsulates scripts to deploy and interact with contracts. This part ensures that the smart contract functionality integrates with the development workflow.
• Testing & Validation Module: The “test” directory (with various tests such as blind auctions, encrypted ERC20 tests, reencryption tests, etc.) along with the “ci/tests” folder indicate a comprehensive testing strategy. This module tests encryption, decryption, and overall smart contract logic.
• Continuous Integration/Continuous Deployment (CI/CD) Environment: Using GitHub Actions (see workflows in .github/workflows) and the “ci” directory (including Dockerfile, docker-compose.yml, and preparation scripts), this component automates linting, testing, building, and publishing.
• Configuration & Developer Tools: Global configuration files (e.g., tsconfig.json, package.json, ESLint, Prettier, Hardhat config), along with environment and deployment settings, allow developers to configure and run the system reliably.
Interactions and Data Flows
• The Developer/Build Phase: Developers use environment configurations and tools (as defined in package.json, Hardhat, and tasks scripts) to generate code (via the codegen module) and compile/deploy the smart contracts.
• Testing / CI Flow: After code generation and deployment tasks, the testing module runs unit and integration tests to validate smart contract behavior (including FHE operations, reencryption, etc.). CI/CD pipelines are activated via GitHub Actions and Docker to ensure consistency.
• Deployment/Execution: Once deployed, the smart contracts operate on the Ethereum network (or a test network), ensuring that encrypted transactions and state updates occur. External FHE libraries or service providers (from Zama’s ecosystem) might be integrated at this level.
• Monitoring & Updating: The CI/CD infrastructure (including workflows that check for dependency updates, lint issues, etc.) keeps the software quality in check.
Relevant Technologies and Patterns
• Technologies: TypeScript, Node.js (for tasks, codegen, tests), Solidity (for smart contracts), Hardhat (for development and deployment), Docker, GitHub Actions, and standard configuration tools (ESLint, Prettier).
• Architectural Patterns: Modular separation of concerns (different directories for code generation, tasks, tests, and documentation), layered architecture (developer tools and build systems on top of the blockchain layer), and a CI/CD pipeline ensuring continuous integration and testing.