-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
``` | ||
QIP: 12 | ||
Layer: Consensus (hard fork) | ||
Title: Qi UTXO Pruning | ||
Author: wizeguyy <[email protected]> | ||
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. |