DustToken
Represents a Dust UTXO (Unspent Transaction Output) in the wallet.
What is a Dust Token? Dust is Midnight's fee payment mechanism. When you register a Night UTXO for dust generation, it creates a Dust token that accumulates value over time. This accumulated dust is used to pay transaction fees.
Dust Generation:
Time →
│
├─ Creation (ctime): initialValue Specks
│
├─ Generation Phase: Value increases linearly
│ Rate: backing Night value × generation_decay_rate
│ Cap: backing Night value × night_dust_ratio
│
├─ Full Phase: Value stays at cap
│
├─ Decay Phase: Value decreases linearly (if backing Night is destroyed)
│
└─ Empty: Value reaches zeroLedger Mapping: Mirrors the ledger's dust wallet UTXO state: the qualified dust output plus an optional "pending until" timestamp for when it becomes available.
Usage:
val token = DustToken(
initialValue = BigInteger("1000000"), // 1 Dust = 1,000,000 Specks
owner = dustPublicKey,
nonce = randomNonce,
sequenceNumber = 0,
creationTime = System.currentTimeMillis(),
backingNight = nightNonce,
merkleTreeIndex = 0,
pendingUntil = null // Available immediately
)
// Calculate current value
val currentValue = token.calculateValue(
now = System.currentTimeMillis(),
params = dustParams
)Constructors
Properties
The Night UTXO that backs this dust generation
Unix timestamp in milliseconds when created
Initial dust value in Specks when created
Index in the Merkle tree
If set, this token is pending until this time (milliseconds)
Sequence number for ordering
Functions
Calculates the commitment for this dust token.
Calculates the nullifier for this dust token.
Calculates the current value of this dust token at a specific time.
Checks if this dust token is available for spending.