How it works?
Last updated
Last updated
In this last section, we will show you how to run dApp in order to mint an NFT.
Verifier Backend
First you need to run the verifier backend, our dApp will be communicating with it to get the statement, challenge and post the proof and get the signature back. It expects parameters from the terminal but you are free to use all of them from a JSON file. We will use a mixture by giving the keys (verify and sign) as a parameter from the terminal and the statement from a JSON. In order to create a custom statement, you can check this link. For this tutorial scenario, we will use age proofs to be able to verify if a person is older than 18 or not but you can also check if he is from a certain country or not.
When you have the statement JSON file, run the application inside of your executable path. If you are using your own node change the node IP to localhost but since we are going to use the testnet node keep it as below.
Running the dApp & Asking a proof
In the mint-ui directory start the dApp by:
We will create a new instance of the cis2-multi contract and try to mint an NFT with another account. Click âDEPLOY NEWâ to create a new instance as you notice, it sends the verify_key as an initiation parameter.
Click âGET SIGNATUREâ and accept the request. Wait for the proof verification, if itâs verified you have a signature signed by the private key (signKey) given when running the application.
If everything goes well, we should have a signature like the one below.
We are almost there, since we have now the signature we will be able to mint a token because we have proven that we are older than 18! Letâs provide the metadata and the contract index to mint our token!
When the transaction is finalized, we will have an alert notifying our minting is successful!