2

In my example (same as in the lecture) the wallet 1 starts the auction and wallet 3 wins it. As the contract always has to have some ADA as Lars explains it looks like Wallet 1 pays 2 ADA to the contract in slot 1 to satisfy this rule as it has 2 ADA less (minus fees) in the UTxO. See: start of the auction

But in the end Wallet 3 who wins the auction gets this 2 ADA. I guess those 2 ADA have to be there to cover some fees in some special cases. But why does Wallet 3 and not Wallet 1 gets the 2 ADA in the end? end of the auction

2 Answers 2

4

As the contract always has to have some ADA

All UTxOs must have the minLovelace amount of ADA attached to it. That includes UTxOs at script addresses and in wallets. A transaction couldn't output the T token to Wallet 3 without including the minLovelace ADA (both are included in the same UTxO).

This is so bad actors don't just mint tons of new UTxOs and bloat the network. There is a maximum number of UTxOs that can exists since ADA is capped.

5
  • Isn't that what fees are for?
    – Sandro
    Jan 13 at 19:04
  • Fees are to pay the network for validating your transaction. Jan 13 at 19:39
  • Oh, you mean to prevent bloating of the chain? Fees are great to prevent spamming the network, but it's not sufficient to prevent someone from doing permanent damage to the chain. Every time someone spins up a new node, they need to validate every transaction in the history of the chain. Without a minLovelace amount, someone could mint 1,000,000,000 tokens, each with their own output. That would take up a lot of storage on the node machine. Sure, that would be an expensive transaction, but it would permanently bloat the chain. minLovelace protects against that attack vector. Jan 13 at 19:50
  • I understand that fees are also for paying the platform. But I don't understand why it needs fees and the additional mechanism you mention to prevent that someone spams the network. I thought it is rather a collateral. If someone forces to send an invalid transaction then this collateral would be used. See docs.cardano.org/plutus/collateral-mechanism
    – Sandro
    Jan 13 at 20:05
  • 1
    The minLovelace mechanism isn't the collateral. That is, again, separate. The collateral is related to transaction validation on Cardano being deterministic, which is awesome, but requires the safety measures mentioned in the link you included. Jan 13 at 21:57
2

Due to my low rep score, I cannot comment in Mitchell Turner's answer, so I answer here instead :)

As Mitchell said, all UTxOs must have the minLovelace amount of ADA attached to it. I just want to add a couple points to it

  1. The amount of minLovelace (in the EnglishAuction) is hardcoded by Lars to 2 ADA - https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs#L54

  2. When Wallet1 closes the Auction, token T is sent to Wallet3 -> so the 2 ADA stored alongside token T is send to Wallet3 as well (See this https://github.com/input-output-hk/plutus-pioneer-program/blob/main/code/week01/src/Week01/EnglishAuction.hs#L323)

  3. This min-ada-value requirement will set size bound to both max number of UTxO and max UTxO size. Main reason is: A ledger without a size bound is vulnerable to being populated by so much data that users will unable to process it (or run a node) with machines meeting the recommended specifications for running a node.

  4. min-ada-value is adjusted and calculated values depending on size of UTxO (note: 1 UTxO can contains multiple different types of Tokens including ADA)

You can see this for more information https://docs.cardano.org/native-tokens/minimum-ada-value-requirement

If the address is not spendable by the user sending the tokens, the ada sent alongside the tokens no longer belongs to the sender

Before transferring custom tokens, users may choose to use off-chain communication to negotiate who supplies the ada to cover the min-ada-value in the output made by the transferring transaction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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