Open TheGateKeeper1995 opened 1 year ago
Hi gatekeeper,
Im afraid not, because it requires your own node to be running in order to access your wallet your trying to mint from.
You can use (down below) to mint your own cardano nfts from a website with a nice user interface. https://www.nmkr.io/
Hope this helped : )
On 2 Feb 2023, at 17:34, TheGateKeeper1995 @.***> wrote:
I was just wondering is there a frontend version to this site where a user can come to, connect their wallet and mint my NFTs?
— Reply to this email directly, view it on GitHub https://github.com/duongpham17/cardano-nft-generator/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJQD4QQB23MCDF53ICYXT3WVPV4FANCNFSM6AAAAAAUPJ7J5I. You are receiving this because you are subscribed to this thread.
Hey,
You will need to follow the read me first, then use your command line interface and run “npm run dev”,
You would have generated a wallet address. where users can send funds to, once that wallet gets a utxo with the correct amount, a nft will be generated and returned to that users address and the funds will go to another address of your choosing.
On 2 Feb 2023, at 17:40, TheGateKeeper1995 @.***> wrote:
Oh right so how do I actually mint an nft? Is it all through the command line?
— Reply to this email directly, view it on GitHub https://github.com/duongpham17/cardano-nft-generator/issues/1#issuecomment-1414125059, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJQD4WHSD4FM7J4M7FEZTLWVPWSXANCNFSM6AAAAAAUPJ7J5I. You are receiving this because you commented.
in the index.ts file, you have all the functions to do everything :)
have you tried doing "npm install" ?
i cant seem to get that issue
Maybe its because of dotenv not being configured correctly, i made an update this seems to have worked. Tell me if this helped :)
go to the file variables.ts and locate COST_OF_NFT, the price is based on lovelace, just change the 50 to whatever amount you want
you need to run your own cardano node for this nft generator to work, because you will be creating and storing the metadata of your nft on to the cardano testnet blockchain
i havent updated this script since last year and the current cardano era might be different.
Oh right perfect thank you, I am also getting this "WARNING: Old token was used without isTestnet parameter switching to mainnet network" I don't know if it's relevant to anything.
i havent updated this script since last year and the current cardano era might be different, not sure whats happening there.
you need to run your own cardano node for this nft generator to work, because you will be creating and storing the metadata of your nft on to the cardano testnet blockchain
What if I want to run it on the mainnet though?
You will need to go inside the variables.ts and change: CARDANO_NETWORK_TYPE = --testnet-magic 1097911063 to --mainnet CARDANO_ERA = to the current era this will be given to you when you sync your own cardano node
Also if I send 100 instead of 50 to the address, will it mint 2 nfts?
This script is for minting only one nft at a time, if the amount if below or above the user will get a refund - fees
Yes, you will need your own cardano running for testnet and mainnet, because in order to mint your own nft projects or tokens you will need
You should head to this website https://demeter.run/
This might help you.
https://developers.cardano.org/docs/get-started/installing-cardano-node
The cardano node should be running locally on your network.
These command line are specific to each case.
Check out the cardano documentation, for setting up the cardano node and running the command lines to interact with the node.
https://developers.cardano.org/docs/get-started/installing-cardano-node
you should generatePayment first, then generatePolicyid.
Make sure the cardano node is fully synced.
Then send some ada to the address which can be found inside -_account/keys/payment.addr
ah my bad, you need to create a tracker document in mongodb first.
inside the index.ts file copy this to create the tracker document.
import {trackerCreate} from “./_utils/controller”
then run trackerCreate()
you should see tracker file created in the command line or check inside your mongodb database.
hope this helps
Hey sorry, i was at work. Let me get the node up and running and see what updates need to be done :)
I dont see any issue in that, because everything is stored within the cardano blockchain.
The keys that you generate is the most important part, because it means you are the owner and you can set the amount you want to mint and burn.
The generated wallet address, is where all the users will be sending money to. This wallet address is your main source of knowing who is paying you. The mongodb database tracks who has been paid and what has been minted so far.
I think you should test it out with the testnet for a bit and get to understand what the script does.
Once your ready you can do the same on the mainnet, it should be exactly the same.
your going to have to check the api for wallets like nami.
You could always let users copy the address and let them send manually.
You could always let users copy the address and let them send manually.
Let me check the api for you.
The refund side of the script works perfectly by the way but for some reason the transaction building, signing or submitting for the minting side of things doesn't work.
Probably because of the updates over the year. Im going to get my own node running, its taking time to sync :( I will make updates for you :)
The refund side of the script works perfectly by the way but for some reason the transaction building, signing or submitting for the minting side of things doesn't work.
Probably because of the updates over the year. Im going to get my own node running, its taking time to sync :( I will make updates for you :)
Its mostly updates over the past year. When i minted my own project for fun it worked fine :)
from the nami api you have these options
getBalance: ƒ () getChangeAddress: ƒ () getNetworkId: ƒ () getRewardAddresses: ƒ () getUnusedAddresses: ƒ () getUsedAddresses : ƒ () getUtxos: ƒ (t,e) signData: ƒ (t,e) signTx: ƒ (t,e) submitTx: ƒ (t)
You might need a node.js backend to sign data because you need to decrypt and encrypt data using the @emurgo/cardano-serialization-lib-nodejs
Imo i think its alot easier if you let users mint via copy and pasting :)
I dont mind doing it when i mint projects
hope that helps
Oh theres 3 different nodes, preview, prepod and mainnet now, this might take a while :/ to sync and test
Hey good news. ive updated everything and made it much easier now to jump straight in.
I hope this helps with your nft project :)
I also have a few questions regarding the creation of a policy ID and policy script. How exactly does that work? I know I created one using the command line but I didn't do it properly. How do I create the set of rules attached to said policy script and then how does that policy ID and script get attached to the NFT?
policy ID and policy script is all created using the command line tools cardano has provided us. If you want to see the code behind this go to _account/keys and _account/policy
to set the rules attached to said policy you need to know the nft standards which can be found here https://cips.cardano.org/cips/cip25/ To find it in the code navigate to _/generate_nft/index.js and scroll down to line 81
"then how does that policy ID and script get attached to the NFT?" First you need to mint the nft image and a metadata which contains all the information about the nft. These can be found when you generate you'r own nft under _nft/metadata and _nft/nft. Note this is not on the blockchain yet. Its only on your local machine. To create the nft, we run the cardano command lines they have provided us in the documentation - https://developers.cardano.org/docs/native-tokens/minting-nfts This is what makes the nft a nft. You can view the code for this by navigating to the folder payment_mint/index.ts
Hope this was helpful.
i've just tested the minting process and refunding process, it refunds and sends to the correct address :)
From my knowledge i don’t think so.Sent from my iPhoneOn 4 Feb 2023, at 01:04, TheGateKeeper1995 @.***> wrote: Also how do I go about adding a function to mint more than one NFT per transaction. Is this even possible?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
there would be no button just an address that users can copy and send to Sent from my iPhoneOn 3 Feb 2023, at 22:19, TheGateKeeper1995 @.***> wrote:
i've just tested the minting process and refunding process, it refunds and sends to the correct address :)
Yeah I've just minted an nft and tested a refund as well, it works perfectly. Thank you so much bro! I just have to figure out how to attach it to a button and also how to add more parameters to the policy script. How would I be able to attach this script to a web domain, would I have to run npm export or something or how would you suggest I go about doing it please?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
I was talking to a developer on the Cardano forum and he was saying that I just need to edit the script to send 2 nfts if say 20 ada was sent instead of 10 ada. (https://forum.cardano.org/t/how-to-burn-testnet-nft/113967/11)
But he said something about making sure the metadata was separated or else I would be minting the same metadata for 2 nfts
And I am trying to have a button though, I want people to be able to come to my website and select how many nfts they want to mint and then click the button, sign the transaction and then in the background, the amount of nfts that they chose and the amount that they paid gets sent to the address that I have set up using your script and then your script receives that amount and then mints the user 2 nfts for example and sends them to the user who connected their wallet on my frontend site.
Also there is another little bug, I sent the correct amount of ADA and I sent an asset with it to see how it responds and I am getting the following error:
Command failed: transaction build Error: Non-Ada assets are unbalanced: 6628826 lovelace + 1 72947c78d28d4bec6408e0ab25363f585d10690d948fe920410e4bc6.74657374657231
Command failed: transaction submit Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [UtxowFailure (UtxoFailure (BabbageOutputTooSmallUTxO [((Addr Testnet (KeyHashObj (KeyHash "83183887eafd125cfb2002f977ea0967df37b98bdcc65500797caef0")) (StakeRefBase (KeyHashObj (KeyHash "154610e30b81988257fc98babb1f854dfb3d3910135f0847f993d6de"))),Value 0 (fromList [(PolicyID {policyID = ScriptHash "beef386c1d293289bf4261640e08d4a8dd16614d8d167cd2bbb09abf"},fromList [(4661746475636b32,1)])]),NoDatum,SNothing),Coin 1146460)])),UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (ValueNotConservedUTxO (Value 10000000 (fromList [(PolicyID {policyID = ScriptHash "72947c78d28d4bec6408e0ab25363f585d10690d948fe920410e4bc6"},fromList [(74657374657231,1)])])) (Value 0 (fromList [(PolicyID {policyID = ScriptHash "beef386c1d293289bf4261640e08d4a8dd16614d8d167cd2bbb09abf"},fromList [(4661746475636b32,1)])]))))),UtxowFailure (UtxoFailure (FromAlonzoUtxoFail (FeeTooSmallUTxO (Coin 171309) (Coin 0))))])
hey been busy, i've fixed the issues of people sending: tokens with the correct ada - mint nft and return tokens tokens with more than mint price - refund amount - fees and tokens tokens with amount under 5 ada - this will be considered a gift because theres not enough fees to send the tokens back.
Perfect thank you so much, no need to apologise, I fully understand :) I will onboard your changes right now. I was able to code the function of not refunding if you send too little but I will use your updated code as I'm sure it's more concise. I had it set that if you sent less than 3 ADA it wouldn't get refunded.
There's a couple of things I wanted to ask you.
The minimum_utxo_lovelace_required
variable is set to 2000000, but I was able to get away with setting it to 1000000, is there a particular reason why you set it to 2000000? Because I would like to get the maximum amount of ADA per each transaction.
Also, I am still trying to implement the ability to mint multiple NFTs per transaction and I came across this link: https://cardano.stackexchange.com/a/4430 and I was wondering could something like this be implemented? I was trying to find a way to combine the metadata files somehow and then somehow passing the combined end result into the metadata_pathname
variable but I am having no luck as of yet as I am not that experienced with Typescript just yet. I was hoping you'd be able to help me with al your infinite wisdom 👀😊
“minimum_utxo_lovelace_required” that’s perfectly fine, change that to your liking. i set 2000000 because it looks nicer that’s all :)
To be able to do multiple minting. You would need
that’s what i can come up with, but i’m sure there’s a proper way to do it.
i have tested up multiple mint a while back but the metadata was conjoined and the assets where under one metadata.
if you find some examples send it my way i’ll have a look and see if i can help you :)
Thank you, I will attempt to do this but I'm afraid I won't get very far as I am not that well versed in typescript
Here is an example of the method I am talking about: https://cardano.stackexchange.com/a/4430
this method is weird i’ve tested this one before. It batches the 2 nft under one metadata.
Oh right so that's a dead end then?
I wanted to ask your professional opinion about whitelists and airdrops. Are the rules for whitelists or airdrops tied to the policy id and policy script or how would you do airdrops and whitelists with your script or just in general?
“minimum_utxo_lovelace_required” that’s perfectly fine, change that to your liking. i set 2000000 because it looks nicer that’s all :)
To be able to do multiple minting. You would need
- atleast one utxo setup which will act as the main utxo that everything will get minted from.
- when a user sends ada that can be a multiple mint, you need to store this data in the database. Then send the user utxo funds to your receive address.
- use the setup utxo to then mint the correct amount of nft and send it one by one to the user.
- remember to update the database of the user utxo when the correct amount of minting is done.
Would it take long to code something like this? What files would need to be edited please?
for airdrops you need to get the sender address of the nfts at the time of your snapshot and save their address in the database. i’m sure there’s an api on blockfrost to track where all of your nfts are based on the policy id.
whitelist is simply just store the users stake key or wallet address in your database and query from that.
if someone tries to mint without being whitelisted, simply create a function that query from the database for the correct whitelisted wallet, if it’s not a whitelisted send a full refund and if it’s under the ada threshold take it as a gift.
“minimum_utxo_lovelace_required” that’s perfectly fine, change that to your liking. i set 2000000 because it looks nicer that’s all :) To be able to do multiple minting. You would need
- atleast one utxo setup which will act as the main utxo that everything will get minted from.
- when a user sends ada that can be a multiple mint, you need to store this data in the database. Then send the user utxo funds to your receive address.
- use the setup utxo to then mint the correct amount of nft and send it one by one to the user.
- remember to update the database of the user utxo when the correct amount of minting is done.
Would it take long to code something like this? What files would need to be edited please?
not sure what files it will require, but i’m sure you will have to manually turn off and on different functions for each phase of your drops.
Ok I get you, just so I fully understand, once the whitelist is done and I then want to switch to public mint, how do I do that? Will I have to manually do that or what way would it work?
not sure what files it will require, but i’m sure you will have to manually turn off and on different functions for each phase of your drops.
I'm not too entirely sure what you mean by each phase of my drops. I want this option to be available throughout the entire mint process.
I was just wondering is there a frontend version to this site where a user can come to, connect their wallet and mint my NFTs?