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 build
Start a local Ethereum node for testing using Anvil (included with Foundry):
anvil
In a separate terminal, deploy the contract to your local node:
forge script script/DeployProofOfPassportRegister.s.sol:DeployProofOfPassportRegister --fork-url http://localhost:8545 --broadcast
To 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 --verify
Create a .env
file and set the following variables:
PRIVATE_KEY
: Your private key (ensure it is for a test account). Alternatively you can usecast
to store your account securely and use it for deployment.SEPOLIA_RPC_URL
orMAINNET_RPC_URL
: RPC URL for the network.ETHERSCAN_API_KEY
(optional): For contract verification.
Run the tests using:
forge test
Generate a test coverage report:
forge coverage
Interact 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_URL
Estimate gas usage:
forge snapshot
Ensure code is formatted correctly:
forge fmt
Run 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!