I’m writing some code to process payments and mint NFTs in return. I’m currently trying to determine the best architecture to efficiently mint the NFTs when receiving a high volume of payments.
Once a minute minute my software wakes up to collect all the incoming UTXOs received. Then it determines how many NFTs to mint for each UTXO received, submits a single transaction with all the UTXOs as input and delivering the minted NFT along with min ADA to the corresponding address for each UTXO. On testnet this has been working well, minting up to 50 NFTs to 10 recipients in a single transaction.
However, for some of the big projects that have recently been minted I noticed that each NFT is minted in a single transaction. Am I missing something? Is there a reason they choose to process only a single UTXO at a time?
No, you’re not missing anything. It is less costly to bundle several mintings into a single transaction. Even with long names and the 721 metadata, fifty NFTs should fit in a single transaction.
The other projects might use single-UTxO transactions because (1) they can mint right away (not wait up to a minute), (2) their software can have simpler logic, or (3) users can easily see the relationship between their UTxO and their receiving the NFT.
It may depend on the purpose of the token.
Batching makes sense for uniform token format in high demand and/or high volume.
In contrast I’ll use myself as an example.
My project will generate one token per transaction as the token confers both identity and access to the other features of the application. In short, the token is the player character for an edutainment game.
In long, most users will only ever need one token at the cost of roughly 2 ADA. There is no reason for me to batch this and make any single user artificially wait as I doubt I will have more than one registration per minute anyway (using your ingestion schedule). I would rather have a better user experience than saving a marginal amount of ADA in transaction fee reduction. If for some bizarre reason my project to teach myself about Cardano while teaching others about Cardano becomes ludicrously popular then that’s a problem I would love to solve at that time.
Solve problems when present. Plan to have problems. Write code for plans that change.
how do you get the transaction details and the address of the wallet that paid the amount so you can send them the NFT after minting?
I am working on an NFT minter page and I am having some trouble finding the best commands to do this or I am missing something.
Did you use anything other than cardano-cli?
I use cardano-db-sync to query the transaction inputs of the UTXO. There is a sample query to do this here: cardano-db-sync/interesting-queries.md at master · input-output-hk/cardano-db-sync · GitHub
I imagine some of the online API providers such as blockfrost and dandelion would also have a function to return this data but I haven’t looked at them.
I recommend using smart contracts now that they are available mainnet as well as developing better solutions. cardano-db-sync still has use cases (Oracles, Scanners, etc) and I also prefer Postgres over proprietary SQL databases but it should not be needed with PAB integration.
We can applaud projects like SpaceBudz for discovering clever workaround hacks for minting native tokens in creative ways but that was never intended to be a long term or scalable solution for creating or selling tokens.
It looks like all projects are still minting NFTs as native tokens outside a smart contract. I would like to transition over to using a smart contract though. Is there any proposal, standard, or template for minting NFTs inside a smart contract?
I’m a little confused with your comment about cardano-db-sync. Is there a different, preferred way to extract the address inputs to a UTXO? Sorry, what is PAB integration?
PAB = Plutus Application Backend
I believe Week 5 of the Plutus Pioneer Program (PPP) has a very rough example of minting NFT
Of course you are welcome to use Marlowe, Glow, or other higher level abstractions if you are willing to wait a year or two more. Plutus is the core smart contract language of Cardano and it is based on Haskell programming language but obviously has a limited set of blockchain specific functionality instead of full compatibility.
As far as most existing projects I am extremely biased and have a hard time being objective. Suffice to say I do not believe very many real NFT have been minted as yet. There is nothing inherently wrong with verbatim copying Ethereum meta data formats or trying to capitalize on trending fads but there is also nothing exciting or interesting about this greed fueled frenzy.
We are only human …
How many wallets do you all recommend in this pipeline?
Do you separate into 2 wallets:
- receiving ADA wallet from buyers
- mint and send it out
The reason is, I realized, if having only 1 wallet, some UTXO might get consumed (buyer paid) during the minting and sending out process.
I use two wallets. The first to receive payment, and the second is the purchasers wallet. When I receive a payment I take that UTXO and when minting the NFT split it up into two outputs. One output goes to the purchasers wallet with the NFT and minimum ada amount. The second output goes back to myself with the remaining ADA.
Can someone possibly give me a chronological timeline of the process from having the layers to getting them onto your own minting https domain. I am very new to this and to say this forum helped would be an understatement. I did comprehend getting a user off fivver to do the coding part for me but have since fell in love with Cardano and would love to learn for myself.
Say i have 4 sets of 10 unique layers already made up, and was looking to produce a set of 10,000 NFT’s. would I be the one that mints all 10,000 into my wallet, then distributes them to the correlating address once a purchaser “mints” one of the website, so essentially all 10,000 are minted before the minting process begins. Or is it a case of they mint off the website and there is code in place that generates one to their address simultaneously with the ADA payment. If the latter is correct what would be the most practical way of doing this ?
I know i may be getting ahead of myself as i’ve still not fully comprehended basic code, how to run the cardano node or generate 10,000 unique images but i am very appreciative of any guidance from this amazing community.
many thanks, Marky.
I can’t comment how other projects run but the way I’ve done it is:
- Generate the set of images (10K or whatever amount) and corresponding metadata
- Upload the images to IPFS
- Monitor a wallet for incoming payments
- Mint a random NFT from the previously generated set to the sender of the payment
This method requires little to no investment up front. If you were to for example mint all 10K NFTs to your project wallet you’re looking at paying a significant amount of ADA up front to cover gas fees.
I have code written in python that is a wrapper around cardano-cli to manage all this as well as code that can generate a set of layered NFT images and corresponding metadata and upload to an IPFS server. If you’d like, I can share the code with you. Feel free to send me a pm to discuss ways we can collaborate.
Thank you so much for your reply Kris, you have no idea how much i appreciate you taking time to respond to that !
If i may, Did you use the Hashlips Github tool to make the unique images and metadata ? that is what i’m currently looking at.
I hadn’t heard of IPFS until this message, Reading the introduction to their page from what I gather you run an IPFS node and upload your NFT’s from that ? is this the same, or at least similar process to running the cardano node. (still trying to understand what a node is and how to complete the download of it)
lastly, did you have code in place to mint an NFT to the buyers wallet simultaneously with the ADA payment ? as i imagine doing it manually may be flawed for when you’re asleep.
Apologies for the blockhead questions, this is my second day of trying to immerse myself in this space and I am honoured to receive advice from people that are ahead of me technically like yourself.
Again, Many thanks for any reply
I’m using all custom software that I wrote myself. I’ve heard of the hashlips tool and understand it’s pretty popular. It should do what you want.
There are several IPFS pinning services available if you don’t want to run your own IPFS node. Storage is quite cheap. You could look at blockfrost, pinata, and infura. I’m sure there’s others.
Yes, I have some code that runs alongside a cardano node to mint directly into the buyers wallet.
Do you have a tutorial / repo you could share for your setup? I work with some artists and we are interested in creating an NFT project. We have no experience in this area, but if there were a set of instructions we could follow, I think would be able to get started. I realize this is quite an ask, so please feel free to decline. Thanks for all the info you have shared so far!
I’m happy to share the code I have. Here it is on github: GitHub - kris-76/thecardroom
I have instructions and examples up there. It’s not very user friendly and still in “alpha” stage. However, it does work and successfully mints tokens. Take a look. If you’d like, we can work out a way to collab with me providing the backend support.
Sweet, I will check and star right now. Thanks so much!
That’s a nice contribution you are providing to the scene. I am also a NFT enthusiast and working on my first project. It would be great to collab with you.
Welcome! Just sent you a DM.
Me and my team are working on an NFT project we have been working on for a couple of months now.
I have been searching the internet for ways to do this efficiently, and your project seems to be exactly what we are looking for. Would you be up for assisting us for our drop?