8

Just want to foresee if we'll run into any issues sending/consuming thousands, or tens of thousands of UTXO's at a script address.

5

Is there any limit to the number of UTXO's sitting at a script address?

There shouldn't be any practical limit.

UTxOs aren't stored in some memory at an address. The address determines who can spend a UTxO, not where it resides. And that address is included on the UTxO, not vice versa.

In other words, when you send UTxOs to an address there is no check on which/how many UTxOs are owned by that address. You are just adding a new UTxO to the blockchain that the intended recipient can identify as their own and spend.

Check out my answer here for more details on how UTxOs are associated with addresses.

1
  • 1
    Thank you! This is exactly the answer I was looking for :) Nov 1 '21 at 21:37
3

This sounds like a two part question:

  1. Is there any limit to the number of UTXOs stored at a script address
  2. Is there any limit to consuming UTXOs stored at a script address

For the first one, yes and no. While you can theoretically store as many UTXOs as you like at a script address, there are some resource constraints you're likely to run into:

  • The size of a single transaction is currently limited to 16k and the max size of a single block is 64k. And while these numbers are adjustable, this puts an upper limit on the rate of ingestion.
  • The same issue will apply when you wish to spend the UTXO as well. 16k is the limit for the entire transaction, inputs, outputs, witness, all of it.

For the second question, yes, there are a number of limits on consuming UTXOs:

  • Within the 16k transaction size limit, the smart contract (currently) needs to fit into that space, significantly reducing the amount of space available for UTXO
  • Odds are, you'll probably want to do some verifications as well on the UTXOs so cpu and memory execution limits may also play a factor
  • Like the 64k block size limit, there are also block limits for cpu and memory
1

Official documentation is silent about it.

Since many UTxOs can exist within one wallet address, the same way they can exist within a script address. You can potentially have even 10,000 Tx inputs per script address, but in reality, I'm sure, their number is below 1000, because it'll take a fair amount of network power to scan all inputs and outputs of each such an address. The only way to find out the exact number of tx-ins is to experiment in testnet.

However, the max number of UTxOs processed per transaction is known.

The maximum number of UTxOs per single transaction is about 70. Going higher will likely result in the network rejecting the transaction and defrag-ops.py will warn about this if --max is set higher than 70.

In addition to the above, I think everyone will be interested in reading this post.

3
  • 1
    This is per transaction, not per script address, right? Oct 31 '21 at 21:46
  • I've updated my answer.
    – Andy Jazz
    Nov 1 '21 at 8:37
  • 1
    Thanks for adding more details! Gave an upvote, but I still don't think this definitively answers the original question of max # of UTXO's allowed to sit at a script address. Nov 1 '21 at 17:37
0

I am failing to spend even 10 utxos from the script address because of CPU and memory limits, using AlwaysSucceeds validator. More info: Transaction memory and cpu usage limits

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.