Website

The actual verification process will happen through your smart contract. However some logic must be done by the website that connects to the web3 (Metamask, etc) wallet.

Is known?

To prevent executing calls that can't be processed and wasting users' gas fees, the website should check if the wallet is known by the identity provider.

Each identity provider will deploy a smart contract on each network they support. During the beta, proofi.com is the only available provider. It has published the following contracts:

ethereum = "0x11B42Ca67d52Ef145b5b84Ba042a1859C8aeb376"
goerli = "0xbBA38836dca7173a4B66D24E48dd0993b0d9Bf17"

Other networks can be supported on request. Please send an email to support@proofi.com.

Get the user's wallet address from the web3 wallet and call the isKnown() function on the contract. This is an external view function, calling it doesn't cost any gas.

const provider = new ethers.providers.Web3Provider(window.ethereum, "any");
const address = await provider.getSigner().getAddress();
const identityProviderContract = new ethers.Contract("0xbBA38836dca7173a4B66D24E48dd0993b0d9Bf17", abi, provider);

if (await identityProviderContract.isKnown(address)) {
  mint();
} else {
  redirectToProofi();
}

If the isKnown() function returns true, continue with the call to the smart contract. If the address is not known, the user should be redirected to Proofi.

Redirection to Proofi

Users that have never gone through a KYC process with one of the identity providers should be redirected to Proofi.

They will be led through a simple and streamlined procedure, after which they are redirected back to your website.

window.location.href = `https://app.proofi.com/accounts/participate?redirectUrl=
${encodeURIComponent(window.location.href)}&network=testnet`;

The redirectUrl parameter is set to the current page. Once the user is finished, they will be sent back to the specific page he/she left from.

Example

Krazy Kobe is a demo project where NFTs can only be minted by approved wallet owners.

Have a look at the JavaScript code of the website in the repository.

Last updated