Smart contract
Last updated
Last updated
Verification can be done directly from the smart contract using . This means that you don't need to setup any backend service.
Proofi supplies a solidity library for easy integration. It can be installed using NPM
The smart contract must implement the in addition to the Proofi Verification interface.
Use the Verification base contract of the Proofi library to implement all required logic, including calls through Chainlink Any API.
Before a wallet is allowed to participate and interact with a smart contract (mint, swap, etc) it should be verified with an identity provider.
The website that's connected with Metamask, should have checked that the wallet is known to the identity provider using the isKnown()
call, submitting a call to your smart contract.
When using the Verification
class, the smart contract will keep a list of approved and declined wallet addresses. If the wallet is in neither of these lists call verify()
, passing the message sending.
Verification is asynchronous. The Chainlink Any API request is an EVM event that's picked up by a Chainlink Oracle. This oracle does an HTTP request to the Proofi API and publishes the yes/no answer on the blockchain.
If the verify()
function is called with a different address than the message sender, Proofi will likely refuse to give a response. Proofi checks the blockchain transaction to ensure that the wallet owner is knowingly participating in the project.
There are two hooks that should be implemented in your smart contract: onApproved
and onDenied
. One of these functions will be called based on the response of the oracle.
To use Chainlink, you must transfer LINK tokens to your smart contract. You will not be able to transfer them back unless you add this functionality to your contract.
Krazy Kobe is a demo project where NFTs can only be minted by approved wallet owners.
There are costs involved in doing ChainLink Any API calls. Fees for these calls need to be paid in LINK tokens. For testnet these tokens can be obtained from the .
Costs differ per Oracle and network. You're free to use any Oracle you like, as long as it supports the Get > Bool
job. If you're unsure which oracle to use, have a look at .
Have a look at the or find the project on .