Smart contract designed to store and verify proofs of passport. This contract allows for the registration of recipients after validating provided proofs, management of signers and verifiers, and validation of proofs. This contract was developed based on the circuits implementation of OpenPassport
This project uses the Foundry framework for testing and deployment.
- About
- Getting Started
- Usage
- Testing
- Interactions
- Estimate Gas
- Formatting
- Static Analysis
- License
- Author
The Proof of Passport Register contract is designed to store and verify proofs of passport. It allows registered signers to register recipients after validating proofs. The contract also supports adding and removing signers and verifiers, as well as validating proofs.
- Git: Download
- Verify installation:
git --version
- Verify installation:
- Foundry: Installation Guide
- Verify installation:
forge --version
- Verify installation:
Clone the repository and build the project:
git clone https://github.com/yourusername/proof-of-passport-register
cd proof-of-passport-register
forge buildStart a local Ethereum node for testing using Anvil (included with Foundry):
anvilIn a separate terminal, deploy the contract to your local node:
forge script script/DeployProofOfPassportRegister.s.sol:DeployProofOfPassportRegister --fork-url http://localhost:8545 --broadcastTo deploy to networks like Sepolia or Mainnet, specify the network in the deploy script and provide the necessary RPC URLs and private keys.
Example for Sepolia:
forge script script/Deploy.s.sol:DeployProofOfPassportRegister --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --broadcast --verifyCreate a .env file and set the following variables:
PRIVATE_KEY: Your private key (ensure it is for a test account). Alternatively you can usecastto store your account securely and use it for deployment.SEPOLIA_RPC_URLorMAINNET_RPC_URL: RPC URL for the network.ETHERSCAN_API_KEY(optional): For contract verification.
Run the tests using:
forge testGenerate a test coverage report:
forge coverageInteract with the deployed contract using cast commands.
Examples:
- Check if an address is a signer
cast call <contract_address> "checkIfAddressIsSigner(address)(bool)" <signer_address> --rpc-url $RPC_URL- Register a recipient with proof:
cast send <contract_address> "registerWithProof((uint256[2],uint256[2][2],uint256[2],uint256[45]),address)" <proof> <recipient_address> --private-key $PRIVATE_KEY --rpc-url $RPC_URLEstimate gas usage:
forge snapshotEnsure code is formatted correctly:
forge fmtRun Slither for static analysis:
slither .This project is licensed under the MIT License.
Developed by JustaLab.
Note: For detailed implementation and advanced usage, please refer to the contract's source code and documentation.
Thank you for your interest in the Proof of Passport Register contract. If you have any questions or need assistance, feel free to reach out.
Happy coding!