Commit via Nit module
Using the nit module to create asset commits is free, but there will still be a gas fee associated with the transaction. To ensure that the transaction can be completed, it is important to have Mainnet NUM or Testnet NUM in the wallet being used.
Before starting, make sure nit is installed in your working environment. Here are the basic steps to commit via the nit module.
Prepare nit
configGenerate
AssetTreeCreate
commit
Prepare nit config
In order to commit via nit module, you need to complete the following steps:
Follow Infura document and acquire
YOUR_INFURA_PROJECT_ID andYOUR_INFURA_PROJECT_SECRETCreate a wallet and set up
YOUR_PRIVATE_KEYin order to commit and create transactions. This wallet will appear as thecommitterin the Commit.Make sure there are Mainnet NUM in the wallet
[Option] Make sure there are Testnet NUM in the wallet
const config = {
"defaultNetwork": "jade",
"provider": "bafkreigrt5tepycewppysdwcjccdkdvvc2ztelqv64idgautq52g3vfh4i",
"infura": {
"projectId": YOUR_INFURA_PROJECT_ID,
"projectSecret": YOUR_INFURA_PROJECT_SECRET
},
"network": {
"jade": {
"url": "https://mainnetrpc.num.network",
"chainId": 10507,
"accounts": [
YOUR_PRIVATE_KEY
],
"contract": "0x7EC2F14ABE8b0Ea2F657bBb62b6fEfDe161c9001",
"explorerBaseUrl": "https://mainnet.num.network/tx"
},
"snow": {
"url": "https://testnetrpc.num.network",
"chainId": 10508,
"accounts": [
YOUR_PRIVATE_KEY
],
"contract": "0x02eFA51b583d03342687b585417e5A62cd8273a4",
"explorerBaseUrl": "https://testnet.num.network/tx"
},
}
};
//Set defaultNetwork to snow if testnet is enabled
if(testnet === true){
config.defaultNetwork = "snow"
}Create Commit
The following example is an example to create a commit for the asset on Numbers Mainnet using nit library. Before you start, follow the AssetTree spec to prepare the information for your asset and put them in the inputData.
Please replace the "YOUR_PRIVATE_KEY" with your own private key in the config. The following is the package.json used by this example:
Commit with NFT Records
If your asset has been minted as NFTs and you wish to include NFT records in the AssetTree, please follow the specifications outlined in the nftRecord documentation to prepare the nftRecord file. Then, add the following code to your AssetTree preparation process.
Last updated