Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a function create_world_id() that interacts with the World ID contract #1

Open
Dprof-in-tech opened this issue Dec 12, 2024 · 25 comments
Assignees
Labels
good first issue Good for newcomers NON-REWARDING This is a non rewarding issue ODHack 11

Comments

@Dprof-in-tech
Copy link
Contributor

This function should interact with the World ID contract to create an id for a given user.
Study how World ID works and integrate it in the function.
Write test for this function and ensure all scenarios and edge cases are covered

@Dprof-in-tech Dprof-in-tech added ODHack 11 NON-REWARDING This is a non rewarding issue good first issue Good for newcomers labels Dec 12, 2024
@BrunoAmbricca
Copy link

I would like to work on this issue

@ShantelPeters
Copy link

I'd like to handle this task.

@KoxyG
Copy link

KoxyG commented Dec 12, 2024

Hi i am koxy, a blockchain developer. I would work on this by first studying how World ID works and then create a function that interacts with the World ID contract to create an id for a given user. I will make sure i with test that will cover different scenerios.

@emmanueldindu
Copy link

Can I be assigned to this?

@olisaagbafor
Copy link

May I pick this up?

@Jagadeeshftw
Copy link

I’d like to resolve this.

@FrankiePower
Copy link

I am Super Franky, a software developer with 3+ years of experience, and I have worked with frontend technologies like React, NextJS, JavaScript/TypeScript. I'm a recent graduate of Web3bridge Africa, the foremost and premier blockchain developer community.I am very familiar with smart contracts, and have built dapps. I have made contributions to many open-source projects, and I look forward to contributing to this one.

ET: 12 hours

@emarc99
Copy link

emarc99 commented Dec 17, 2024

Can I try solving this issue?

@1nonlypiece
Copy link

I'd like to take this issue.

@FadhilMulinya
Copy link

I'd love to give this a go.

@Dprof-in-tech
Copy link
Contributor Author

@FadhilMulinya good day chief, whats the progress on this issue?

@FadhilMulinya
Copy link

@FadhilMulinya good day chief, whats the progress on this issue?

Hello still checkin on this siir :) i am checking how world id works ... we are good

@Dprof-in-tech
Copy link
Contributor Author

Dprof-in-tech commented Dec 18, 2024 via email

@Idrhas
Copy link

Idrhas commented Jan 23, 2025

Mind if I take this issue?

@devJaja
Copy link

devJaja commented Jan 29, 2025

Can I take care of this issue?

@Victordeleusse
Copy link

Let me handle this issue!

@TobieTom
Copy link

Could I take over this issue? I am relatively new and eager to add on to my current experience

@mnusurov
Copy link

mnusurov commented Feb 7, 2025

I’d love to work on this task.

@mnusurov
Copy link

mnusurov commented Feb 7, 2025

@Dprof-in-tech

Subject: Clarification on World ID Identity Registration in the Smart Contract

After reviewing your code and the documentation for World ID smart contracts, I’ve come to the conclusion that it is not possible to register a World ID identity directly from your smart contract. This is because the relevant method:

function registerIdentities(
    uint256[8] calldata insertionProof,
    uint256 preRoot,
    uint32 startIndex,
    uint256[] calldata identityCommitments,
    uint256 postRoot
) public virtual onlyProxy onlyInitialized onlyIdentityOperator { ... }

is restricted by the onlyIdentityOperator modifier:

modifier onlyIdentityOperator() {
    if (msg.sender != _identityOperator) {
        revert Unauthorized(msg.sender);
    }
    _;
}

This means that the method can only be called from an authorized identity operator address.

Additionally, I noticed that the interface IWorldID in your code includes a declaration for the method:

function verifyIdentity(address user) external view returns (bool);

However, this method does not exist in the current World ID smart contracts available in their repository: https://github.com/worldcoin/world-id-contracts.

Given this, I would like to clarify the task requirements. Is the goal to ensure, within specific methods, that a user has a valid World ID identity? If so, according to their documentation, this should be achieved using the following method:

/// @notice Verifies a WorldID zero knowledge proof.
/// @dev Note that a double-signaling check is not included here, and should be carried out by the caller.
/// @dev It is highly recommended that the implementation is restricted to `view` if possible.
///
/// @param root The root of the Merkle tree
/// @param signalHash A keccak256 hash of the Semaphore signal
/// @param nullifierHash The nullifier hash
/// @param externalNullifierHash A keccak256 hash of the external nullifier
/// @param proof The zero-knowledge proof
///
/// @custom:reverts string If the `proof` is invalid.
function verifyProof(
    uint256 root,
    uint256 signalHash,
    uint256 nullifierHash,
    uint256 externalNullifierHash,
    uint256[8] calldata proof
) external view;

All parameters required for calling this function can be obtained through their SDK on your frontend and then sent to the corresponding method in your smart contract. To prevent reuse of the same proof, it is recommended to store used nullifiers in a mapping on-chain, as suggested in their documentation: https://docs.worldcoin.org/world-id/reference/contracts.

Could you confirm if this approach aligns with your requirements, or provide further clarification on how you would like World ID integration to be handled?

@Dprof-in-tech
Copy link
Contributor Author

Dprof-in-tech commented Feb 7, 2025 via email

@mnusurov
Copy link

mnusurov commented Feb 9, 2025

Hey @Dprof-in-tech did you have any chance to look into this?

@Dprof-in-tech
Copy link
Contributor Author

Hey @Dprof-in-tech did you have any chance to look into this?

Hey chief, thank you for your patience. So i was able to take a look at this and i believe the World ID verification is already being done on the frontend, there is no use for this function , given that its also not possible to implement it because of the protected identity provider address.

we can either take the approach of verifying the user's world ID again on the contract (as you suggested) or we can forego this entirely. which do you suggest right now?

@mnusurov
Copy link

Hey,
I think this depends on your goals. From what I understand, you want certain methods to be callable only by World ID-verified users (like transfer() using the onlyVerified() modifier).
If that's the case, I believe the modifier needs to be modified to call the verifyProof() method on the World ID contract. In this scenario, the frontend would need to make the appropriate SDK method call that returns the required parameters for verifyProof(), which would then be passed to your contract's methods. I can handle the smart contract part – let me know if this approach works for you.

Hey @Dprof-in-tech did you have any chance to look into this?

Hey chief, thank you for your patience. So i was able to take a look at this and i believe the World ID verification is already being done on the frontend, there is no use for this function , given that its also not possible to implement it because of the protected identity provider address.

we can either take the approach of verifying the user's world ID again on the contract (as you suggested) or we can forego this entirely. which do you suggest right now?

@Dprof-in-tech
Copy link
Contributor Author

Dprof-in-tech commented Feb 10, 2025 via email

@mnusurov
Copy link

Hey @Dprof-in-tech please review PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers NON-REWARDING This is a non rewarding issue ODHack 11
Projects
None yet
Development

No branches or pull requests