I wish to write a script that will automatically mint NFTs given payment to an address. Firstly, I haven't found anyone that has shown how to do this, but if anyone has, or is willing to share, please let me know.

I notice the tutorial here suggests using cardano-cli, however, this requires cardano-node to be running which seems very brittle to me, because if you have issues keeping up with the current state of the blockchain, then you'll miss out on payments. https://developers.cardano.org/docs/integrate-cardano/listening-for-payments-cli/

Would using cardano-wallet be a better or safer option to listen for transactions?

What would be the steps to automatically minting NFTs based on payment? And would anyone have any recommendations on how you'd host the script once you've written it? Would you have cardano-node constantly running in a virtual machine (e.g. EC2 instance).

6 Answers 6


setting up the cardano node is very simple, and once set-up, as long as your resource is available, the node stays up-to-date with the blockchain. The CoinCashew tutorial (https://www.coincashew.com/coins/overview-ada/guide-how-to-build-a-haskell-stakepool-node#14-configure-your-topology-files) is great for this & there are a number of YouTube videos that explain what do to do too (although tip from my experience, avoid DigitalOcean as a provider for VMs).

I then used this tutorial (https://developers.cardano.org/docs/native-tokens/minting/), to mint NFTs using the cardano-cli & it worked great. I would imagine that based on this, it shouldn't be too complicated to derive a script to do it automatically.

Unfortunately, I cannot help you on your "minting on payment" answer as I am also just beginning to look into this. Also, I'm sure the new smart contracts would have that functionality?


Code for minting Spacebudz is actually open-source, so you could probably use that with a bit of tweaking.

As far as I know this code should basically mint tokens in order for every new transaction back to the transaction sender.

Here's the link to source repo: https://github.com/Berry-Pool/nft-server


Look into dbsync as that is how you can actually look at transactions and not just the txhashes.

Basic setup would be dbsync server (postgres) + cnode (cli || wallet):


  1. query slot every couple seconds to see if new block (new block means new potential transactions)
  2. if new block, then grab any new transactions that meet your criteria (verify the amount of ada and grab the addr)

cli / wallet

  1. Send to minting script and mint and send in same tx :)

side notes

  • either mint 1 at a time, or do about 30 at a time in one tx.
  • If you need to do more then 30 you will need multiple addresses. To make this work the address you are sending too is different from the addresses you will be minting from. Assuming thousands of requests per block, you could mint 1200 NFTs, with 40 addresses, just need to keep track of them all
  • Instead of using db-sync and querying transaction data, why can't you just query for the UTxOs at the receiving wallet address? You could repeat this query on regular time interval. I'm just curious why you suggested using db-sync? Commented Feb 8, 2022 at 20:28

You can also use Bakrypt.io which is an API specially made for minting Cardano Tokens (NFTs and Fungible Tokens) individually or in bulk. Hence, creating collections of thousands of assets at once. Bakrypt.io also supports Royalties following CIP-0027 standards.

Opening an account is free, meaning you only pay for confirmed transactions. The free tier offers up to 1gb in IPFS storage for free.

  • If you have a connection to a commercial product mentioned in your post it should be declared or explicitly denied. See guidelines in help.
    – gRebel
    Commented Feb 23, 2022 at 3:12

this is what i have written,


my next step is to bring NFT auto minting. is not huge difference to mint from sending the NFT.

if you want, contact me and we can work together on this.


[REPOST: https://cardano.stackexchange.com/questions/4891/is-there-an-open-source-vending-machine-script-for-nft-minting]

We open-sourced one of these on GitHub here: https://github.com/thaddeusdiamond/cardano-nft-vending-machine

It's written in Python but requires no cardano-node (only cardano-cli and a Blockfrost key). There's also a sample script in main.py to show how to use it (or just invoke that script from CLI). Our PFP mint was done on my Macbook Pro. Hopefully that helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.