DustParameters

data class DustParameters(val nightDustRatio: Long, val generationDecayRate: Int)

Parameters for Dust generation and decay.

What are Dust Parameters? These control how Dust tokens generate and decay over time:

  • Night Dust Ratio: Maximum dust a Night UTXO can generate (capacity)

  • Generation/Decay Rate: How fast dust accumulates and decays

Dust Generation Formula:

max_capacity = night_value × night_dust_ratio
generation_rate = night_value × generation_decay_rate
decay_rate = night_value × generation_decay_rate (same as generation)

Example:

Night value: 100 NIGHT
night_dust_ratio: 1000
generation_decay_rate: 10

→ Max capacity: 100 × 1000 = 100,000 Specks
→ Generation rate: 100 × 10 = 1,000 Specks/second
→ Time to full: 100,000 / 1,000 = 100 seconds
→ Decay rate: 1,000 Specks/second (back to zero in 100 seconds)

Ledger Mapping: Mirrors the ledger's DustParameters: the Night-to-dust ratio, the generation/decay rate, and a grace period. The ratio is an unsigned 64-bit value (mapped to Kotlin Long) and the rate is an unsigned 32-bit value (mapped to Kotlin Int); both ranges are sufficient for valid positive values.

Network Defaults:

  • Testnet: Uses the initial dust parameters.

  • Mainnet: Determined by governance.

Usage:

val params = DustParameters.TESTNET_DEFAULTS

// Calculate max capacity for a Night UTXO
val nightValue = BigInteger.valueOf(100_000_000) // 100 NIGHT
val maxDust = params.calculateMaxCapacity(nightValue)
println("Max dust: $maxDust Specks")

// Calculate generation rate
val rate = params.calculateGenerationRate(nightValue)
println("Generation: $rate Specks/second")

Constructors

Link copied to clipboard
constructor(nightDustRatio: Long, generationDecayRate: Int)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Rate of dust generation and decay per second (u32 → Int)

Link copied to clipboard

Ratio of Night value to maximum dust capacity (u64 → Long)

Functions

Link copied to clipboard

Calculates the decay rate for a given Night value.

Link copied to clipboard

Calculates the generation rate for a given Night value.

Link copied to clipboard

Calculates the maximum dust capacity for a given Night value.

Link copied to clipboard
fun calculateTimeToEmpty(nightValue: BigInteger, currentDust: BigInteger = calculateMaxCapacity(nightValue)): Long

Calculates the time to decay to zero for a given Night value.

Link copied to clipboard
fun calculateTimeToFull(nightValue: BigInteger, initialDust: BigInteger = java.math.BigInteger.ZERO): Long

Calculates the time to reach full capacity for a given Night value.