Elven Mint v4 (Work in progress)
NFT minting on the Elrond blockchain using erdjs SDK. It requires deployed smart contract which implements esdt_nft_create
.
Be aware that it automatically mints in a loop Its purpose is to test stuff or for private use, not for NFT launches for sale. If time permits, there will be more valuable tools and adapted smart contracts for that.
Smart Contract example which works well with current version of the tool: elven-nft-minter-sc
This is a documentation for v4
Please always check and try to understand the code and possible limitations and bugs before using it for actual products
The script relays on nft-art-maker output metadata.json file. Check out the repo, and you'll find more info about it.
It would also be possible to use it without the nft-art-maker, but you need to prepare a similar metadata.json file as here; you would also need to pack the files into ipfs car file and upload them. Files in the car archive example: 1.png, 1.json, 2.png, 2.json ....
.
How it works
First of all elven-mint script assumes that you have deployed a smart contract which implements the esdt_nft_create
. (See the link to example!) The createNft function should look like:
It also requires that you have your ESDT token (collection token/id), which it will use for NFT minting. It should also have proper roles assigned, and you'll be able to add these in the config file. Read more about the configuring ESDT for NFT minting here.
You would also need to have a couple of files to be able to start:
- Wallet Keystore JSON file. The one you'll get when creating a web wallet - it would be best to create a new one for the Smart Contract. But you can always recover and download the JSON file using https://devnet-wallet.elrond.com/recover and your seed phrases. (There is no support for the PEM files here, but I plan to add it).
- You would also need to have the
metadata.json
generated using mentioned above nft-art-maker. - Finally, you would need a config file
.elvenmintrc
where you need to provide a couple of crucial pieces of information. Below you'll find an example.
Important! Keep the files private, especially password and Keystore wallet files. To avoid any mistakes, you would need to write a wallet password with every script usage.
So your directory should look similar to this:
metadata.json
wallet.json
.elvenmintrc
In this place, you will call the npx elven-mint
command. Or you can also install it globally npm install -g elven-mint
and then call elven-mint
.
Configuration example
.elvenmintrc file with examples:
{
"smartContractAddress": "erd1qqqqqqqqqqqqqpgqqfxkus66fkjpjuxlqnhzqwk5ru9h5smwvafsy9p3g0",
"collectionTokenId": "ELO-5f0be3",
"initialPriceOfNFT": "100000000000000000",
"royaltiesCut": '10',
"currentChain": "devnet",
"walletFileName": "wallet.json",
"createNftFunctionName": "createNft",
"metadataSummaryFileName": "metadata.json",
}
-
smartContractAddress
- Smart Contract which mints NFTs [default: undefined] -
collectionTokenId
- Your created ESDT token for NFT collection - should also have all required roles [default: undefined] -
initialPriceOfNFT
- Price after mint (1 egld has 18 zeros) [default: undefined] -
royaltiesCut
- royalties cut (format is a value between '0' an '10000' (0 meaning 0% and 10000 meaning 100%) [default: '0'] -
currentChain
- Chain to be used (local, devnet, testnet, mainnet) [default: devnet] -
walletFileName
- Your wallet json file name [default: wallet.json] -
createNftFunctionName
- Create NFT function name in your smart contract [default: createNft] -
metadataSummaryFileName
- Your metadata.json file name (generated by nft-art-maker) [default: metadata.json] -
claimTokensAfterMint
- This option will allow claiming tokens after minting. They will be sent to the caller's wallet after Smart Contract mints them. When false, they will stay on the Smart Contract [default: false]
Handling unexpected termination of the minting process
It is crucial to be able to resume minting from the place where the process ended. It isn't possible yet. But there is a manual way of doing that. There is a helper which will console log the last sent transaction on every exit, and it looks like:
elven-mint finished!
Last sent transaction: {
no: 2,
name: '#2',
txHash: '640232838d50e02102e279ec71b892e9d12aaddc85476a094001af38942fb628'
}
With this info, you can double-check all in the blockchain explorer, and you can modify your metadata.json file accordingly. So, for example, you can remove all first editions for which transactions are already on-chain and then restart the script.
I plan to implement a resume script, but this isn't so crucial for now.
Updates
You can always install it globally if you are not sure which version you use. Do: npm install elven-mint -g
You can always check which version you have by: elven-mint -v