DustTokenEntity

data class DustTokenEntity(val nullifier: String, val address: String, val initialValue: String, val creationTimeMillis: Long, val nightUtxoId: String, val nightValueStars: String, val dustCapacitySpecks: String, val generationRatePerSecond: String, val state: UtxoState = UtxoState.AVAILABLE, val lastUpdatedMillis: Long = System.currentTimeMillis())

Room entity for dust token (UTXO) storage.

Purpose: Caches dust token information from DustLocalState for fast balance queries and prevents need to deserialize entire state for simple operations.

Relationship to DustLocalState:

  • Source of truth: Serialized DustLocalState (in EncryptedSharedPreferences)

  • This table: Cache layer for performance

  • Sync: Update this table when DustLocalState changes

Dust Token Lifecycle:

  1. Night UTXO registered → Dust token created with value=0

  2. Dust generates over time (value increases up to cap)

  3. Dust spent for fees → Token marked PENDING

  4. Transaction confirmed → Token marked SPENT, new token created with change

Balance Calculation: Current balance = sum(all AVAILABLE dust tokens, calculated at current time)

Constructors

Link copied to clipboard
constructor(nullifier: String, address: String, initialValue: String, creationTimeMillis: Long, nightUtxoId: String, nightValueStars: String, dustCapacitySpecks: String, generationRatePerSecond: String, state: UtxoState = UtxoState.AVAILABLE, lastUpdatedMillis: Long = System.currentTimeMillis())

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Wallet address that owns this dust token. Format: mn_addr_network1...

Link copied to clipboard

Creation time (Unix timestamp in milliseconds). Used to calculate current value based on generation progress.

Link copied to clipboard

Maximum dust capacity for this token (in Specks). Calculated as: nightValueStars * nightDustRatio Default: 5 Dust per Night (5,000,000 Specks per Star) Stored as string to support u128 values.

Link copied to clipboard

Dust generation rate (Specks per second). Calculated as: nightValueStars * generationDecayRate Default: 8,267 Specks per Star per second Stored as string to support precision.

Link copied to clipboard

Initial value when token was created (in Specks). Stored as string to support u128 values from Rust.

Link copied to clipboard

Last updated timestamp (Unix timestamp in milliseconds). Used to track when this cache entry was last synced with DustLocalState.

Link copied to clipboard

Backing Night UTXO identifier (intentHash:outputIndex). Links this dust token to the Night UTXO that generates it.

Link copied to clipboard

Backing Night UTXO value (in Stars). Determines dust generation rate and capacity. Stored as string to support large values.

Link copied to clipboard

Unique identifier: hex-encoded nullifier (32 bytes). The nullifier is the unique ID for this dust token in the commitment tree.

Link copied to clipboard

Token state (AVAILABLE, PENDING, or SPENT).