1

I've been following this guide https://developers.cardano.org/docs/native-tokens/minting to mint some native tokens but the process of sending native tokens to an address that has multiple UTXOs when I also have multiple UTXOs at my address is unclear to me.

  1. I want to send my native tokens to some foreign address but my wallet has 2 UTXOs instead of just 1 as seen in the guide https://developers.cardano.org/docs/native-tokens/minting#:~:text=Here%E2%80%99s%20what%20the%20raw%20transaction%20looks%20like%3A. For multiple UTXOs, are you supposed to add all of your txhash and txix values for each UTXO to --tx in? What is the syntax/formatting?

  2. I need to set the 'funds' variable here https://developers.cardano.org/docs/native-tokens/minting#:~:text=Copy-,Again,-%2D%20here%20is%20an but there is multiple UTXOs in my wallet. Is 'funds' the total lovelace in all UTXOs in my wallet?

  3. I need to set the 'receiver_output' variable here https://developers.cardano.org/docs/native-tokens/minting/#:~:text=Copy-,Again,-%2D%20here%20is%20an and there are multiple UTXOs at the receiver's address. Is 'receiver_output' the total amount of lovelace at all UTXOs in the receiver's wallet?

Thanks, Myles

1 Answer 1

1

A UTXO is an unspent transaction output. That UTXO is tied to an address, and that address is made up of hashes of keys that are tied to payment keys for that address. You can spend a single UTXO, or multiple. It's up to the design of your application. To simplify things, we'll ignore native tokens first.

Lets start with an assumption my wallet has received 2 transactions from others. One is for 1 ada and another one is for 1000 ada. If I try to make a transaction using just the 1 ada one, all I can do is pay the full ada as a fee with no output. If I make one just using the 1000 ada one, i can pay my 0.7 fee in ada and send the remaining of the 1000 ada to another address, the same address, or multiple addresses.

Now, once that transaction is added to a block, the old txins are "spent" and a new utxos are created based on the hash of the transaction you just made and the index.

When we add transactions sending native tokens (not minting yet), things get a little more complicated. For one, every UTXO containing a native asset has a minutxo greater than 1. So every UTXO holding a native asset must have some Ada in the same UTXO. This means you can't just send SANTA tokens without also sending some ada with them. The same rules apply, except you can't spend a native asset as a fee. So all outputs of native assets must add up to all inputs in the TXIN's defined in the transaction.

Earlier I mentioned that you can send to one or multiple addresses as outputs in a transaction. Well, you can also send multiple times to the same address! So I can take that 1000 ada I had in a UTXO and say 100 SANTA tokens in the same UTXO and then send them to the same address in 1.5 ada + 1 SANTA UTXOs to split it up. In this case I'd have 100 outputs to the same address, with a 101st output sending the change of 849 ada and say a 1 ada fee. Each of these new utxos can be spent individually, so now I could individually send out SANTA tokens to people spending 1 of those UTXOs every time.

So now, we finally arrive minting that you were asking about When you mint assets in a transcation, you specify the policy hash and asset name making new assets out of thin air based on a policy you set in your policy script. Those newly minted assets need to be sent totaling the amount minted + any assets consumed from the txins for the minting transaction. So if we take the same example above and say we have 500 SANTA and 1000 ada in a single UTXO. We now mint 10000 SANTA, and we want to output this to a single address in a single UTXO. Now we sent 999 ada + 10500 SANTA to our address. The same goes with burning, but in this case, we mint a negative value and subtract that from the outputs. So if I have that above UTXO and I want to burn 500 SANTA tokens, the output would be 998 ada + 10000 SANTA. I'm using 1 ada fees in these examples for simplicity.

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.