DustTokenEntity
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:
Night UTXO registered → Dust token created with value=0
Dust generates over time (value increases up to cap)
Dust spent for fees → Token marked PENDING
Transaction confirmed → Token marked SPENT, new token created with change
Balance Calculation: Current balance = sum(all AVAILABLE dust tokens, calculated at current time)
Properties
Creation time (Unix timestamp in milliseconds). Used to calculate current value based on generation progress.
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.
Dust generation rate (Specks per second). Calculated as: nightValueStars * generationDecayRate Default: 8,267 Specks per Star per second Stored as string to support precision.
Initial value when token was created (in Specks). Stored as string to support u128 values from Rust.
Last updated timestamp (Unix timestamp in milliseconds). Used to track when this cache entry was last synced with DustLocalState.
Backing Night UTXO identifier (intentHash:outputIndex). Links this dust token to the Night UTXO that generates it.
Backing Night UTXO value (in Stars). Determines dust generation rate and capacity. Stored as string to support large values.