How do I make sure I always have utxos when I’m sending native tokens to users. I am trying to create a mechanism where a user can claim rewards in the form of my native token and I am trying to build a transaction on the frontend using Lucid, but I am wondering how do I always make sure I have enough utxos to be able to properly make the transactions. I realise this may be a dumb question but I am new to all this so I’m not entirely sure how it works.
UTXO literally stands for “unspent transaction output” so maybe check out these IOHK “official” sources before expanding your search to learn more:
Oh right ok thank you for your response. so as long as the wallet has some amount of ADA I could theoretically keep sending tokens out of it forever? Will I need to keep updating it with ADA or what?
You’ll find the minimum ADA requirement will likely prevent “spamming” of tokens as designed.
Most platforms construct the transactions to take a “covered cost” UTXO from the user input and then return it with the output token(s) minus network fees making it as close to a “zero sum” game as possible. Of course you are more than welcome to send the minimum ADA and pay the transaction fees to distribute your tokens but that could get cost prohibitive in an automatic vending script depending on the use case
Since you also mentioned Lucid maybe look for examples on their GitHub. I do not use this for my project so I am not sure if it supports exactly what you are attempting or if it’s just one of the tools you may want to leverage to simplify integration.
Right so let me get this straight, you are saying use the user’s utxos to cover the transactions, is that correct?
Also how would you write the code to achieve what I am trying to achieve or what you’re describing please? Like I said I’m a complete noob and I need as much help as I can get
But I appreciate you getting back to me
Looks like JavaScript / TypeScript so try some of the resources listed: Resources - Lucid
Cursory review it helps to create transactions using a builder pattern and integrates with a CIP-30 wallet like Nami made by same people who made Lucid. You likely will need to provide some sort of back end as well but for experimenting a free Blockfrost account may work for learning.
Yeah I’m basically trying to achieve automated transactions without using a node. I have been looking into Lucid but I can’t seem to find a clear cut example on how to achieve what I’m trying to do. Can you please point me in the direction of a functioning solution?
One of the resources was basic usage and their documentation looked decent from what I saw briefly yesterday.
Would you be able to construct an example query of what this looks like please, either using the cli or what ever language you use? Thank you in advance