diff --git a/README.md b/README.md index a8e3d20..af5dd71 100644 --- a/README.md +++ b/README.md @@ -19,5 +19,6 @@ Those proposing changes should consider that ultimately consent may rest with th | [9](qip-0009.md) | Consensus (hard fork) | Interlinks | gameofpointers | standard | Draft | | [10](qip-0010.md) | Consensus (hard fork) | Network Object Identifiers | wizeguyy | standard | Draft | | [11](qip-0011.md) | Consensus (hard fork) | Paying for Account State Usage | wizeguyy | standard | Draft | +| [12](qip-0012.md) | Consensus (hard fork) | Qi UTXO Pruning | wizeguyy | standard | Draft | diff --git a/qip-0012.md b/qip-0012.md new file mode 100644 index 0000000..9f40635 --- /dev/null +++ b/qip-0012.md @@ -0,0 +1,51 @@ +``` + QIP: 12 + Layer: Consensus (hard fork) + Title: Qi UTXO Pruning + Author: wizeguyy + Comments-Summary: No comments yet. + Comments-URI: https://github.com/quainetwork/qips/wiki/Comments:QIP-0012 + Status: Draft + Type: Standards Track + Created: 2024-04-02 + License: BSD-2-Clause +``` + +## Abstract +This QIP proposes a mechanism to prune dust UTXOs from the ledger. + +## Motivation +Transaction outputs in the Qi UTXO ledger, occupy space and impose a burden on +UTXO transaction processing, from the set root recomputations. This is not a +problem under normal usage, but can become a problem if any users/wallets are +lazy or irresponsible with UTXO reconsolidation, or worse if the network +undergoes a spam attack. This QIP describes a protocol change to disincentivize +UTXO state pollution without meaningfully impacting normal transactional +behavior. + +## Rationale +Normal Qi wallet behavior will involve some amount of UTXO splitting, to create +change outputs for payments, as well as UTXO reconsolidation as the wallet +acquires too many small change outputs. This QIP should not negatively impact +this expected user behavior, but should provide a cost to lazy wallets that do +not reconsolidate change outputs. + +## Specification +We achieve this simply, by limiting the size of the UTXO set. If a transaction +creates new UTXOs which would exceed the UTXO set capacity, we destroy the +smallest UTXOs in the ledger. This is practical to do thanks to the fixed +denominations in the Qi ledger. + +Since the network cost we are trying to control is related to the construction +of the UTXO set root, it is sensible to choose a capacity that reflects a +particular depth of the state tree. Since we use a Patricia Merkle trie, the +state root recomputation is bounded by the radix-16 update cost bound: +$O(log_{16}(N))$, where $N$ is the number of UTXOs in the set. + +We set a max trie depth size of 10, which corresponds to a max UTXO set size of +$16^{10} \approx 1 trillion$ UTXOs. If a transaction mints new UTXOs which exceed +the $16^10$ limit, the node shall prune all of the smallest UTXOs from the UTXO +set, repeating this process until the UTXO set size is back within the limits. + +## Copyright +This QIP licensed under the BSD 2-clause license.