Skip to main content

Structures

Here you can find the structure of the project, including the smart contracts, frontend, offchain, docker services, and CI/CD workflow. ๐Ÿ—๏ธ

High Level Overview of user interaction ๐ŸŒโ€‹

A user interaction diagram that shows the flow of the user interaction with the system. The user can register, create an event, check-in to an event, and validate the check-in.

Overview technology architecture ๐Ÿ—๏ธโ€‹

Folders ๐Ÿ“โ€‹

  • .github: Github actions for the project, with the tests and autodeploy of the frontend and offchain services. ๐Ÿ› ๏ธ
  • docs: Documentation of the project with docusaurus. You are here ๐Ÿค“.
  • frontend: The Next.js application for the frontend of the project with rainbowkit, wagmi for integration on the blockchain and iExec SDK for the confidential computing. ๐Ÿ’ป
  • offchain: Offchain python service for the project, with the web3 package to listen to events on the blockchain and validate the face recognition and geo-location of the users. ๐Ÿ
  • smartcontracts: Repository of Scaffold-eth-2 with the smart contracts and tests for the project. ๐Ÿ“œ
  • Dockerfile.* and docker-compose-*.yml: Docker containers for the services of the project, with docker-compose for the development, production, and test environments. ๐Ÿณ
  • Procfile: Heroku file to run the offchain service in the cloud. โ˜๏ธ
  • .env.example: Example of the environment variables file for the project. ๐Ÿ”

Contracts ๐Ÿ“„โ€‹

You can find the smart contracts in the contracts folder and the tests in the test folder of the repository. The contracts are written in Solidity and are used to manage the user registry, event management, and check-in processes. The tests are written in TypeScript and are used to ensure the contracts are functioning as expected with different scenarios.

UserRegistry ๐Ÿ“šโ€‹

Manages user registrations and their facial identifiers, ensuring added security through encapsulation. Users are identified by addresses, and their data includes names and IPFS hashes of facial images. The contract employs modifiers to validate user existence, name, and face hash integrity. Features functions for registering, updating, and retrieving user information, with events logged for new registrations and updates.

EventManager ๐ŸŽ‰โ€‹

Manages event creation and details, tailored for use with a decentralized platform. It defines an Event struct to store comprehensive event details, including name, description, image hash (stored as an IPFS hash), location (latitude and longitude), owner, start and end times, and an activity status. The contract supports creating new events, updating existing events, and retrieving event information, ensuring actions such as updates are restricted to the event's owner. Modifiers validate event data, including time ranges, locations, and IPFS image hashes. Events for creation are emitted to log activity.

CheckInManager ๐Ÿ“Œโ€‹

Manages check-in requests and validations for events, integrating with external EventManager and UserRegistry contracts. It supports functionalities including request submission, off-chain validation, and check-in status management. Structs and enums define check-in data and status. Features include limiting check-in attempts, validating event existence and timing, and ensuring actions are performed by designated roles such as the off-chain validator. The contract emits events for different stages of the check-in process, enabling transparency and traceability. It allows users to retrieve their check-in statuses and provides functionalities for the off-chain validator to approve or reject check-ins based on external validations.

Internal Interaction Sequence ๐Ÿ”€โ€‹

This diagram illustrates the sequence of interactions between the contracts, including the UserRegistry, EventManager, and CheckInManager. It shows the flow of actions such as check-in request submission and off-chain validation. The sequence diagram provides a high-level overview of the interactions and the order of operations between the contracts. You can see the CheckInManager is the central contract that interacts with the other two contracts, and the sequence of actions for check-in requests and validations.

Offchain ๐Ÿโ€‹

The offchain service is a Python application that listens to events on the blockchain and validates the face recognition and geo-location of the users. It uses the web3 package to interact with the Ethereum blockchain, the face_recognition library to validate the facial recognition of the users and the geopy library to validate the geo-location of the users. The offchain service is used to validate the check-in requests and ensure the integrity of the data.

Docker ๐Ÿณโ€‹

Services ๐Ÿ› ๏ธโ€‹

List of all services that are in the project and their respective details.

Environments ๐ŸŒโ€‹

Here you can see the environments of the project and the services that are running in each one, with details of the command and the extended services.

Dependencies ๐Ÿ“Šโ€‹

In this diagram you can follow the dependencies of the services and dockerfiles of the project.

CI/CD Actions ๐Ÿ”„โ€‹

Here you can see the CI/CD actions that are running on the project, with the tests, build and deploy of the frontend and offchain services. You can access the Docker auto-tests with the Github Actions on the workflow CI.

Latest docker tests artifacts logs from the workflow CI.โ€‹

scaffold-test-1  | Downloading compiler 0.8.17
scaffold-test-1 | Compiled 3 Solidity files successfully (evm target: london).
scaffold-test-1 |
scaffold-test-1 | CheckInManager
scaffold-test-1 | Check-in Request Submission
scaffold-test-1 | โœ” Should allow a user to request a check-in
scaffold-test-1 | Check-in Approval and Rejection
scaffold-test-1 | โœ” Should allow the offchain validator to approve a check-in
scaffold-test-1 | โœ” Should allow the offchain validator to reject a check-in
scaffold-test-1 | Check-in Information Retrieval
scaffold-test-1 | โœ” Should allow a user to retrieve their check-in requests
scaffold-test-1 | โœ” Should allow retrieval of all user check-ins for an event
scaffold-test-1 | โœ” Should allow retrieval of all check-ins for an event
scaffold-test-1 |
scaffold-test-1 | EventManager
scaffold-test-1 | Event Creation
scaffold-test-1 | โœ” Should allow creating a new event
scaffold-test-1 | Event Updates
scaffold-test-1 | โœ” Should allow the owner to update the event
scaffold-test-1 | โœ” Should prevent non-owners from updating the event
scaffold-test-1 | Event Retrieval
scaffold-test-1 | โœ” Should allow anyone to retrieve event information
scaffold-test-1 | โœ” Should allow retrieving all events
scaffold-test-1 | Event Validation
scaffold-test-1 | โœ” Should prevent creating events with invalid details
scaffold-test-1 |
scaffold-test-1 | UserRegistry
scaffold-test-1 | User Registration
scaffold-test-1 | โœ” Should allow a new user to register
scaffold-test-1 | โœ” Should not allow registering with an existing address
scaffold-test-1 | โœ” Should reject registration with invalid name
scaffold-test-1 | โœ” Should reject registration with invalid IPFS hash
scaffold-test-1 | Data Retrieval
scaffold-test-1 | โœ” Should allow fetching user information by address
scaffold-test-1 | โœ” Should allow users to fetch their own information
scaffold-test-1 | โœ” Should revert when fetching non-existent user info
scaffold-test-1 | Data Update
scaffold-test-1 | โœ” Should allow a user to update their name
scaffold-test-1 | โœ” Should allow a user to update their face hash
scaffold-test-1 |
scaffold-test-1 | ยท-------------------------------------------|---------------------------|-------------|-----------------------------ยท
scaffold-test-1 | | Solc version: 0.8.17 ยท Optimizer enabled: true ยท Runs: 200 ยท Block limit: 30000000 gas โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | Methods โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | Contract ยท Method ยท Min ยท Max ยท Avg ยท # calls ยท eur (avg) โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | CheckInManager ยท replyCheckIn ยท 68620 ยท 113034 ยท 90827 ยท 4 ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | CheckInManager ยท requestCheckIn ยท 269968 ยท 287068 ยท 281368 ยท 3 ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | CheckInManager ยท setOffchainValidator ยท - ยท - ยท 26712 ยท 1 ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | EventManager ยท createEvent ยท 274705 ยท 274957 ยท 274873 ยท 3 ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | EventManager ยท updateEvent ยท - ยท - ยท 62755 ยท 1 ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | UserRegistry ยท registerUser ยท 117419 ยท 117467 ยท 117435 ยท 3 ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | UserRegistry ยท updateUserInfo ยท 40895 ยท 43611 ยท 42253 ยท 4 ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | Deployments ยท ยท % of limit ยท โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | CheckInManager ยท - ยท - ยท 1150202 ยท 3.8 % ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | EventManager ยท - ยท - ยท 1036111 ยท 3.5 % ยท - โ”‚
scaffold-test-1 | ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท|ยทยทยทยทยทยทยทยทยทยทยทยทยทยท
scaffold-test-1 | | UserRegistry ยท - ยท - ยท 692525 ยท 2.3 % ยท - โ”‚
scaffold-test-1 | ยท-------------------------------------------|-------------|-------------|-------------|---------------|-------------ยท
scaffold-test-1 |
scaffold-test-1 | 21 passing (2s)
scaffold-test-1 |