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

Build a BrightID Verified User Registry contract #26

Closed
spengrah opened this issue Apr 16, 2020 · 9 comments
Closed

Build a BrightID Verified User Registry contract #26

spengrah opened this issue Apr 16, 2020 · 9 comments
Assignees
Labels
Projects
Milestone

Comments

@spengrah
Copy link
Member

spengrah commented Apr 16, 2020

Build a BrightID Verified User Registry contract

Prize Bounty

500 DAI

Challenge Description

Clr.fund is building a permissionless and credibly neutral quadratic funding protocol and application that is built with zk-snark magic, courtesy of the Minimal Anticollusion Infrastructure MACI.

A critical property of quadratic funding is the assurance that each contributor is in fact a unique individual. We would like to use BrightID to ensure this.

To earn this bounty, you should implement a VerifiedUserRegistry contract that ensures only BrightID verified users can sign as contributors to each round of clr.fund.

Submission Requirements

A valid submission should include a demonstration and source code of working contract that Verified User Registry contract that allows only BrightID verified users to sign up as contributors to each clr.fund round.

To add BrightID support we need to create a contract which will conform to the VerifiedUserRegistry interface:

pragma solidity ^0.5.8; 
 pragma experimental ABIEncoderV2; 
  
 /** 
  * @dev Interface of the registry of verified users. 
  */ 
 interface IVerifiedUserRegistry { 
  
   function isVerifiedUser(address _user) external view returns (bool); 
  
 }

Judging Criteria

This bounty will be awarded to the participant who submits the best version of this contract as judged by the clr.fund contributors.

Winner Announcement Date

Shortly after the event.

@adamstallard adamstallard self-assigned this Apr 21, 2020
@spengrah spengrah transferred this issue from clrfund/web Apr 21, 2020
@adamstallard adamstallard moved this from MVP must-have: To do to In progress in MVP Apr 28, 2020
@xuhcc
Copy link
Contributor

xuhcc commented Jun 11, 2020

MACI uses SignUpGatekeeper contract to determine who can sign up for voting. We need to create our own signup gatekeeper integrated with BrightID contract.

@adamstallard
Copy link
Contributor

adamstallard commented Jun 11, 2020

We will create a smart contract for the clrfund context that implements this interface https://github.com/BrightID/BrightID-SmartContract/blob/master/v4/IBrightID.sol

When someone uses the /verifications endpoint from a BrightID node, they will get a signed verification that they can use to register with that contract.

We can add a register function in our contract that matches the signature of what is called in the MACI signUp function . Our register function would check that they have a verification. We can also look through their history to make sure they haven't signed up already using a different address.

@xuhcc xuhcc moved this from In progress to MVP must-have: To do in MVP Jul 18, 2020
@xuhcc xuhcc added good first issue Good for newcomers contracts labels Jul 31, 2020
@xuhcc xuhcc added this to the Milestone 4 milestone Aug 24, 2020
@xuhcc xuhcc moved this from Milestone 4 to TODO in MVP Aug 24, 2020
@xuhcc
Copy link
Contributor

xuhcc commented Sep 30, 2020

We need to create our own signup gatekeeper integrated with BrightID contract.

Currently the FundingRound contract acts as a MACI gatekeeper (https://github.com/clrfund/monorepo/blob/v0.1.0/contracts/contracts/FundingRound.sol#L137-L155). User verification is handled by a separate contract, VerifiedUserRegistry. The registry contract must implement isVerifiedUser(address _user) method and in the near future clr.fund admin will be able to choose the registry at deployment (I've just published a new pull request allowing this: #131).

To add BrightID support we need to create a contract which will conform to the VerifiedUserRegistry interface:

pragma solidity ^0.5.8;
pragma experimental ABIEncoderV2;
/**
* @dev Interface of the registry of verified users.
*/
interface IVerifiedUserRegistry {
function isVerifiedUser(address _user) external view returns (bool);
}

@adamstallard
Copy link
Contributor

We can make a contract that implements both the IVerifiedUserRegistry interface @xuhcc showed above and the IBrightID interface from here: https://github.com/BrightID/BrightID-SmartContract/blob/master/v4/IBrightID.sol#L3-L7

An example implementation that accepts signed verifications from a BrightID node is here: https://github.com/BrightID/BrightID-SmartContract/blob/master/v4/BrightID.sol

@auryn-macmillan auryn-macmillan changed the title BrightID verification Build a BrightID Verified User Registry contract Oct 3, 2020
@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 500.0 DAI (500.0 USD @ $1.0/DAI) attached to it.

@adamstallard
Copy link
Contributor

adamstallard commented Oct 6, 2020

Here's an example deep-link to allow someone to link their BrightID to the clr.fund context
https://app.brightid.org/link-verification/http:%2f%2fnode.brightid.org/clr.fund/0xdc0046b52e2e38aee2271b6171ebb65ccd337518/

This is the version of it that you should turn into a QR code:
brightid://link-verification/http:%2f%2fnode.brightid.org/clr.fund/0xdc0046b52e2e38aee2271b6171ebb65ccd337518/

This is how you see all verified users in the context: https://app.brightid.org/node/v5/verifications/clr.fund

This is how you check one user by contextid: https://app.brightid.org/node/v5/verifications/clr.fund/0xdc0046b52e2e38aee2271b6171ebb65ccd337518

This is how you allow a user to get signed verification for the ethereum contract mentioned above
contextid:https://app.brightid.org/node/v5/verifications/clr.fund/0xdc0046b52e2e38aee2271b6171ebb65ccd337518?signed=eth

Producing these is outside of the scope of this issue / bounty, but these calls may be useful for testing.

@gitcoinbot
Copy link

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 500.0 DAI (500.00 USD @ $1.0/DAI) has been submitted by:


@gitcoinbot
Copy link

gitcoinbot commented Oct 10, 2020

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 500.0 DAI (500.00 USD @ $1.0/DAI) has been submitted by:

  1. @rezahsnz
  2. @siftal

@auryn-macmillan please take a look at the submitted work:


@xuhcc
Copy link
Contributor

xuhcc commented Oct 31, 2020

Implemented in #157

@xuhcc xuhcc closed this as completed Oct 31, 2020
MVP automation moved this from TODO to Done Oct 31, 2020
daodesigner pushed a commit that referenced this issue Sep 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
MVP
  
Done
Development

No branches or pull requests

4 participants