Skip to content

JustaName-id/pop-contracts

Repository files navigation

Proof of Passport Register

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.

Table of Contents

About

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.

Getting Started

Requirements

Quickstart

Clone the repository and build the project:

git clone https://github.com/yourusername/proof-of-passport-register
cd proof-of-passport-register
forge build

Usage

Start a Local Node

Start a local Ethereum node for testing using Anvil (included with Foundry):

anvil

Deploy

In a separate terminal, deploy the contract to your local node:

forge script script/DeployProofOfPassportRegister.s.sol:DeployProofOfPassportRegister --fork-url http://localhost:8545 --broadcast

Deploy to Other Networks

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

Setup Environment Variables

Create a .env file and set the following variables:

  • PRIVATE_KEY: Your private key (ensure it is for a test account). Alternatively you can use cast to store your account securely and use it for deployment.
  • SEPOLIA_RPC_URL or MAINNET_RPC_URL: RPC URL for the network.
  • ETHERSCAN_API_KEY(optional): For contract verification.

Testing

Run the tests using:

forge test

Test Coverage

Generate a test coverage report:

forge coverage

Interactions

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

Estimate gas usage:

forge snapshot

Formatting

Ensure code is formatted correctly:

forge fmt

Static Analysis

Run Slither for static analysis:

slither .

License

This project is licensed under the MIT License.

Author

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!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published