GoodDocs
  • Welcome to GoodDocs!
  • GoodDollar Ecosystem Vision
  • About the Protocol
    • Usage
    • Tokenomics
    • Sybil-Resistance
    • Protocol V3 Documentation
      • Architecture & Value Flow
      • System's Elements
      • Core Contracts & API
        • GoodDollar
        • GoodCompoundStaking V2 (DAI)
        • GoodAaveStaking V2 (USDC)
        • GoodReserveCDai
        • GoodFundManager
        • GoodMarketMaker
        • ContributionCalculation
        • UBIScheme
        • Identity
        • FirstClaimPool
        • AdminWallet
        • OneTimePayments
        • DonationsStaking
        • NameService
        • GReputation
        • CompoundVotingMachine
        • StakersDistribution
        • UniswapV2SwapHelper
        • Invites
        • GovernanceStaking
        • ClaimersDistribution
        • CompoundStakingFactory
        • AaveStakingFactory
        • ExchangeHelper
        • FuseFaucet
        • GoodDollarMintBurnWrapper
      • Previous Protocol Versions
        • Protocol V1
          • Architecture & Value Flow
          • Core Contracts & API
        • Protocol V2
          • Architecture & Value Flow
          • System's Elements
            • 1. The token (G$)
            • 2. The Reserve
            • 3. The Trust
            • 4. Staking rewards (APR)
            • 5. The Fund Manager
            • 6. The Distribution Contract (DisCo)
            • 7. Governance (DAO)
          • Core Contracts & API
            • GoodDollar
            • GoodCompoundStaking V2 (DAI)
            • GoodAaveStaking V2 (USDC)
            • GoodReserveCDai
            • GoodFundManager
            • GoodMarketMaker
            • ContributionCalculation
            • UBIScheme
            • Identity
            • FirstClaimPool
            • AdminWallet
            • OneTimePayments
            • DonationsStaking
            • NameService
            • GReputation
            • CompoundVotingMachine
            • StakersDistribution
            • UniswapV2SwapHelper
            • Invites
            • GovernanceStaking
            • ClaimersDistribution
            • CompoundStakingFactory
            • AaveStakingFactory
            • ExchangeHelper
            • FuseFaucet
  • User Guides
    • Buy & Sell G$
    • Stake to create UBI
    • Claim GOOD and G$X
    • Bridge GoodDollars
    • Connect another wallet address to identity
  • Liquidity
  • Wallet and Products
    • GoodWallet
    • GoodDapp
    • New GoodWallet
    • GoodCollective
    • GoodID & GoodOffers
    • 3rd Party Partners and Integrations
  • Frequently Asked Questions
    • Web3 basic knowledge and security tips - by Consensys
    • About GoodDollar
    • GoodDollar Protocol & G$ Token
    • Using GoodDollar
    • GoodDollar Community
    • Troubleshooting
  • For Developers
    • Contributing to GoodDollar
    • GoodDapp Developer Guides
      • Deploy your own GoodDapp UI
    • APIs & SDKs
      • Claim UBI
      • React Hooks Setup
      • Login With GoodDollar
      • Sybil Resistance
        • Identity (Ethers v5 / React)
        • Identity (Viem/Wagmi)
  • Useful Links
    • GoodDollar.org
    • GoodDapp
    • GoodWallet
    • GoodDollar User Guides
    • Statistics Dashboard
    • GoodDollar Whitepaper
    • GoodDollar Litepaper
    • GoodDollar Litepaper - Español
Powered by GitBook
On this page
  • Install the javascript/react SDK
  • Register and verify a new wallet address
  • Query the status of a wallet address
  • Delete an identity record and unregister a wallet
  • React hooks

Was this helpful?

  1. For Developers
  2. APIs & SDKs
  3. Sybil Resistance

Identity (Ethers v5 / React)

Follow below steps to integrate the Identity flow into your dapp!

Install the javascript/react SDK

yarn install @gooddollar/web3sdk-v2

Register and verify a new wallet address

First, create the SDK: The first argument should be an ethers Web3Provider, since the user will need to sign his Identifier. Second argument is which environment and chain contract set to use.

import { ClaimSDK } from "@gooddollar/web3sdk-v2"

const sdk = new ClaimSDK(web3provider, "production" | "production-celo")

Then, trigger the signing request and get the link to redirect the user to the FaceVerification process and either open the link in a popup or redirect the user.

const firstName = "John"
const callbackUrl = "https://mywebsite.com/redirectBackAfterFV" // for native mobile this should be a deeplink
const popupMode = false
const chainId = 42220 // or 122 for fuse. 
try {
 const link = await sdk.generateFVLink(firstName,callbackUrl,popupMode, chainId)
 if(popupMode)
  window.open(link)
 else window.location = link
}
catch(e) {
  console.log("User didn't sign his identifier")
}

Options

function generateFVLink(firstName: string, callbackUrl?: string, popupMode = false, chainId?: number)
  • firstName - Display only. Used to greet user on the face verification screen.

  • callbackUrl (optional defaults to current window location) - In case of popupMode is true, then a POST call will be made to the callbackUrl. Otherwise, the user will be redirected to the callbackUrl.

  • popupMode (optional defaults to false)

    • If false, it is assumed user was redirected to the FaceVerification process and he will be redirected back to the callbackUrl with result params encoded in query string.

    • False should be used for mobile together with a deeplink callback.

    • If true it is assumed a popup window/tab was opened with the FaceVerification link. Once user finishes FV it will try to close the popup and make a POST call to the callback url with JSON encoded params in body.

  • chainId (optional) - Addresses will always be registered on all active chains. This simply marks on which chain the user was originally from. It can be used for invite campaigns and to prevent claiming invite rewards on multiple chains.

Callback Params

The callbackUrl will be called with two params containing the result of the FV process.

  • isVerified - true if user passed FV, false otherwise

  • reason - If isVerified is false this can contain an error message.

Query the status of a wallet address

const isVerified = await sdk.isAddressVerified("0x66582D24FEaD72555adaC681Cc621caCbB208324")

Delete an identity record and unregister a wallet

Since no connection is kept between the identity record and a user's wallet in our database, to delete an identity the user has to send to our server his unique identifier (generated by signing a message). The backend will then unregister the wallet from the Identity contracts on all active chains. info

The user identity record will be deleted after 24 hours to prevent fraud. After 24 hours the user will also be able to register again.

const { success, error } = await sdk.deleteFVRecord()

React hooks

You can also use our react hooks to manage identity.

PreviousSybil ResistanceNextIdentity (Viem/Wagmi)

Last updated 1 month ago

Was this helpful?

Use the isAddressVerified method to query the status of a wallet directly from the smart contract.

See the Claim/Identity react hooks code . Storybook examples . You will need to first setup our context provider as explained .

Identity
here
here
here

Win Rewards: Building something on GoodDollar!

Share your ideas, or ask for development support. Be sure to check out the For discussion on Discord or various program events: We are also on Telegram:

GoodBuilders Program!
GoodDollar Discord Development
GoodDollar Builders