NFTS are powerful standard ERC 721 NFT's implemented in the Ethereum blockchain. NFTS protocol implemented on top of NFT standarts adds a Security layer (like https for http) allowing NFT usage when or where trustability is needed (authentication, shared secrets over public blockchain, …).
NFTS by NFT To ID are based on @OpenZeppelin ERC 721 contracts. As of now, any standart Web3 libraries is fully supported if you need to query some informations through an API. Here is the full list of NFTS functions implemented by NFT To ID Factory :
NFT to ID implemented web3/web3.js: Ethereum JavaScript API and NodeJS for it's own needs coupled with https://www.infura.io as service provider but you are free to explore and implement other frameworks.
Become a member of NFT To ID Network https://api-v1.nfttoid.com/.
Set of functions dedicated to NFT Security / Certification.
PKI service provider emitting the embeded public certificates (exemple “nfttoid.com” in the factory).
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "_NFTS_Issuer",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods._NFTS_Issuer().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
NFTS protocol version (exemple “v1.0” in it's most advanced version).
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "_NFTS_Version",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods._NFTS_Version().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Each certified company/website has its own public certificate for trustability checks (full certification chain validation, Domain Name certification, …).
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "_NFTS_CompanyCertificate",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods._NFTS_CompanyCertificate().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Each NFT has its own public certificate for trustability checks (full certification chain validation, Domain Name certification, …).
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "_NFTS_Certificate",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods._NFTS_Certificate().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Retrieve up to 5 cutom properties (ID from 1 to 5). These properties can contain text informations of your choice and are either encrypted (see CryptoJS.AES.encrypt() / Key and IV available through the factory) or not (1000 char max).
NB, Most people are using these properties to include links, references, secrets, … in relation with their applications needs and On Premise infrastructure. These fields are yours in the factory.
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "uint8",
"name": "PropertyID",
"type": "uint8"
}
],
"name": "_NFTS_CustomProperty",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "pure",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods._NFTS_CustomProperty(CustomPropertyID).call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Retrieve the encryption status of a cutom properties (ID from 1 to 5) = True or False.
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "uint8",
"name": "PropertyID",
"type": "uint8"
}
],
"name": "_NFTS_IsCustomPropertyEncrypted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "pure",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods._NFTS_IsCustomPropertyEncrypted(CustomPropertyID).call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Set of functions dedicated to NFT enumeration (Owners, Tokens, URIs, Creator, …).
Return a full list of NFT Owners (array of type ‘address’ / 500 owners max per call). Expected first call should look like ListOwners_Batch500(0), then ListOwners_Batch500(500), then ListOwners_Batch500(1000), …
Please refer to ownersBalance() in case you need to know where to start and stop.
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "uint256",
"name": "StepBegin",
"type": "uint256"
}
],
"name": "ListOwners_Batch500",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.ListOwners_Batch500('FirstID_0_500_1500_...').call().then((roundData) => {
for (var uri=0; uri<len; uri++) {
console.log(roundData[i]+'\n');
}
}).catch(function(err) { console.log(err)});
Return a full list of URIs belonging to a specific NFT Owner (array of type ‘string’ / 500 URI's max per call). Expected first call should look like ListTokenURIsFrom_Batch500(0), then ListTokenURIsFrom_Batch500(500), then ListTokenURIsFrom_Batch500(1000), …
Warning : By design, this function can return empty arrays for the ‘Creator’ Address which is treated as a special address inside the contract (enumeration has to loop from 0 to initialSupply instead of BalanceOf for others).
Please refer to balanceOf(), creatorAddress(), initialSupply() before calling this function in case you need to extract/exclude ‘Creator’ informations or need to know where to start and stop.
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "StepBegin",
"type": "uint256"
}
],
"name": "ListTokenURIsFrom_Batch500",
"outputs": [
{
"internalType": "string[]",
"name": "",
"type": "string[]"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.ListTokenURIsFrom_Batch500('OwnerAddress0x...','FirstID_0_500_1500_...').call().then((roundData) => {
for (var uri=0; uri<len; uri++) {
console.log(roundData[i]+'\n');
}
}).catch(function(err) { console.log(err)});
Return a full list of Token ID's belonging to a specific NFT Owner (array of type ‘string’ / 1000 ID's max per call). Expected first call should look like ListTokensFrom_Batch1000(0), then ListTokensFrom_Batch1000(1000), then ListTokensFrom_Batch1000(2000), …
Warning : By design, this function can return empty arrays for the ‘Creator’ Address which is treated as a special address inside the contract (enumeration has to loop from 0 to initialSupply instead of BalanceOf for others).
Please refer to balanceOf(), CreatorAddress(), initialSupply() before calling this function in case you need to extract/exclude ‘Creator’ informations or need to know where to start and stop.
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "StepBegin",
"type": "uint256"
}
],
"name": "ListTokensFrom_Batch1000",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.ListTokensFrom_Batch1000('OwnerAddress0x...','FirstID_0_1000_2000_...').call().then((roundData) => {
for (var uri=0; uri<len; uri++) {
console.log(roundData[i]+'\n');
}
}).catch(function(err) { console.log(err)});
initialSupply return the quantity of Tokens Minted by the contract creator/owner at the creation date.
Nb, Every tokens are minted over the NFT construction.
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "initialSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
]}, 'YourContractAddressHereOx1234'
).methods.initialSupply().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
“First Owner” of the contract or “Creator” address is by design special with particular behaviour.
This function return the creator address.
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "CreatorAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.initialSupply().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Owners Balance return the quantity of “unique” owners for the NFT (by default it return 1 after the contract creation).
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "ownersBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
]}, 'YourContractAddressHereOx1234'
).methods.ownersBalance().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Exemple of code powered by the "NFT Factory" ( Node, Web3, NodeJs, Javascript, npm, …).
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.name().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.symbol().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
totalSupply represent the quantity of Tokens in the contract at the time of the call.
totalSupply = initialSupply - “Quantity of Token Burned”
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
]
}], 'YourContractAddressHereOx1234'
).methods.totalSupply().call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.tokenURI(YourTokenIndexHere).call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256" }
],
"name": "ownerOf",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.ownerOf(YourTokenIndexHere).call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.balanceOf('WalletAddressHere0x4321').call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});
Burn function is an optional ERC721 function wich is transfering a token to a specific burn address (0x000000000000000000000000000000000000dEaD in our case).
import Web3 from 'web3';
import fetch from 'node-fetch';
var web3Provider = new Web3.providers.HttpProvider('https://mainnet.infura.io/v3/YOUR-API-KEY');
var web3 = new Web3(web3Provider);
const nfttoidToken = new web3.eth.Contract(
[{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}], 'YourContractAddressHereOx1234'
).methods.burn(YourTokenIndexHere).call().then((roundData) => {
console.log(roundData[0]);
}).catch(function(err) { console.log(err)});