ATHERXPERIMENT
November 11, 2021
Step-by-Step: Verify Sipher NFT
Overview
This document will guide you to verify your NFT with public tools. We assume that you have read and understood the concepts of NFT data validation with the Merkle root.
The example in this document is using:
- Operate on Windows 10
- Latest Visual Studio Code (ver1.60)
- Latest Node.js (ver16.9.0)
- Latest Git (ver2.33.0)
We assume the user who follows this guide won't encounter any problems running the code when you have installed all required dependencies.
Step 1: Installation
You may skip these steps if you already installed these tools with the suitable version.
1. Install Git: Go to https://git-scm.com/, download & install the latest git for your Operation System 2. Install NodeJs: Go to https://nodejs.org/en/, download & install the latest NodeJS 3. Install Visual Studio Code: Go to https://nodejs.org/en/, download & install the latest VS Code
Step 2: Setup
This step will set up the working folder & file to run the code
1. Launch Visual Studio chooses "Clone Repository".
2. Input https://github.com/sipherion/merkle_sipher_inus to the Command Palette, make sure you have installed git properly. Choose "Open" when the git clone is finished.
3. Add a new file, you may name it whatever you want, I will name it "verify_SipherNFT.js" and double-click to open the file.
4. Copy the below code to verify_SipherNFT.js
const verifyProof = require("./merkleDist/parseData").verifyProof;
//Input data for NFT verification
const tokenID = 0; //replace 0 with your tokenID you want to verify
const randomizedStartIndex = 0; //replace 0 with smart contract's randomizedStartIndex
const merkleroot = ""; //place merkle root you find from the Sale smart contract between the ""
const nftData = {
//input your NFT metadata, you will find it in the JSON file download from sipher.xyz
};
const proofs = [
// input your NFT proofs, you will find it in the JSON file download from sipher.xyz
];
//the code below will verify the NFT with your input data
const verifyINU = verifyProof(merkleroot, tokenID, randomizedStartIndex, nftData, proofs);
console.log(verifyINU);
Now you are ready to input data and run the code
Step 3: Input data
1. Get tokenID from the SipherINU smart contract Visit SipherINU smart contract at https://etherscan.io/address/0x9c57d0278199c931cf149cc769f37bb7847091e7#readContract
You may consider tokenID as the order of token that you have purchased
Get your tokenID by input your address and index.
For example: If you purchased 3 tokenID 1800, 1802, 1806. The result of your query will be
index = 0 -> tokenID =1800
index = 1 -> tokenID = 1802
index = 3 -> tokenID = 1806
Input tokenID of the NFT you want to verify the code
const tokenID = 1800; //replace 1800 with your tokenID you want to verify
2. Get randomizedStartIndex from the SipherINU smart contract The randomizedStartIndex is a constant that is only available on the Smart Contract after the Sale end time (09:00AM Sep 11, 2021 UTC+7). Once the R constant is determined, all Sipher Inu NFTs will be revealed
Input randomizedStartIndex in the code
const randomizedStartIndex = 999; //replace 999 with the smart contract's randomizedStartIndex
3. Get the Merkel root hex The Merkle root has been made public so that the Sipher Sale smart contract can run. You can find it here
Input Merkle root to the code
Set Merkle root Transaction https://etherscan.io/tx/0x0e90c553e09c096f09b0a4348ca6b2ed6706eea99784979c9a795ec5cd360b70
const merkleroot = "0xac59814cf91b1d7886900dd01416d31f72407cb7ed5f592cbf5385d8097812f5";
4. Get nftData & proofs of the NFT you want to verify
With your tokenID & randomizedStartIndex, you could calculate your Sipher NFT ID with this formula
NFTSipherID=mod((tokenID+randomizedStartIndex−2),10000)+1NFT Sipher ID = mod((tokenID + randomizedStartIndex - 2),10000) +1 NFTSipherID=mod((tokenID+randomizedStartIndex−2),10000)+1
For example:
tokenID = 1800, randomizedStartIndex = 999 -> Your Sipher NFT ID = 2798
tokenID = 1800, randomizedStartIndex = 9999 -> Your Sipher NFT ID = 1798
tokenID = 1800, randomizedStartIndex = 99999 -> Your Sipher NFT ID = 1798
When all Sipher NFTs are revealed you can visit sipher.xyz, sign in with your wallet, and open Inventory to download data for verification
Click "Download JSON" and get your NFT data. Inside the file, you will file the nftData and proofs in JSON format. You can copy them and paste them into the code. You must paste them in the correct format in order to make the code run.
//Format of nftData
const nftData =
{
"id": #,
"attributes": [
{
"trait_type": "<string>",
"value": "<string>"
}
],
"image": "<hexMD5>",
"emotions": {
"DEFAULT": {
"image": "hexMD5"
},
"SAD": {
"image": "hexMD5"
},
"NERVOUS": {
"image": "hexMD5"
},
"ANGRY": {
"image": "hexMD5"
},
"EVIL": {
"image": "hexMD5"
}
},
"name": "<string>",
"origin": "Genesis",
"race": "INU"
};
//Format of proofs
const proofs =
[
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>",
"<hex256>"
];
After declaring all 5 types of data above, you are now ready to run the code.
Step 4: Verify
Open terminal by click on the top bar menu and choose New Terminal
Click on terminal and input
npm install
After the code has finished running, continue to input
node verify_SipherNFT.js //replace verify_SipherNFT.js with your file name
If the data is consistent the result will be "true". Otherwise, you should review how you did the previous steps or contact Sipher Dev Team for support.
SUBSCRIBE
Subscribe to our newsletter today and be the first to receive Sipher news, AtherXplorer weekly issues, and new AtherXperiment posts. Sign up now and get ahead of the game!