|
| 1 | +# DET k/v key reference |
| 2 | + |
| 3 | +`DetKv` wraps the upstream `platform_wallet_storage::KvStore`. Values are encoded as `[ schema_version (1 byte) | bincode(payload) ]` using `bincode::config::standard()`. Keys are colon-separated namespaces. Every `DetKv` call takes an `Option<&WalletId>` scope: `None` = global slot, `Some(&id)` = per-wallet slot (cascades on wallet delete). |
| 4 | + |
| 5 | +Two backing stores exist: |
| 6 | + |
| 7 | +| Store | Path | Contents | |
| 8 | +|-------|------|----------| |
| 9 | +| `det-app.sqlite` | `<data_dir>/det-app.sqlite` | Cross-network settings | |
| 10 | +| `platform-wallet.sqlite` | `<data_dir>/spv/<net>/platform-wallet.sqlite` | Everything else (per-network) | |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## Settings |
| 15 | + |
| 16 | +| Key | Scope | Store | Value type | Fields | |
| 17 | +|-----|-------|-------|------------|--------| |
| 18 | +| `det:settings:v1` | `None` | `det-app.sqlite` | `AppSettings` via `AppSettingsWire` | `network`, `root_screen_type`, `dash_qt_path`, `overwrite_dash_conf`, `disable_zmq`, `theme_mode`, `core_backend_mode`, `onboarding_completed`, `show_evonode_tools`, `user_mode`, `close_dash_qt_on_exit`, `auto_start_spv` | |
| 19 | + |
| 20 | +Source: `src/model/settings.rs`, `src/context/settings_db.rs` |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## Wallet selection |
| 25 | + |
| 26 | +| Key | Scope | Store | Value type | Fields | |
| 27 | +|-----|-------|-------|------------|--------| |
| 28 | +| `det:selected_wallet:v1` | `None` | `platform-wallet.sqlite` | `SelectedWallet` | `hd_wallet_hash: Option<[u8;32]>`, `single_key_hash: Option<[u8;32]>` | |
| 29 | + |
| 30 | +Source: `src/model/selected_wallet.rs`, `src/wallet_backend/mod.rs` |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## Identities |
| 35 | + |
| 36 | +| Key | Scope | Store | Value type | Notes | |
| 37 | +|-----|-------|-------|------------|-------| |
| 38 | +| `det:identity:<base58_identity_id>` | `None` | `platform-wallet.sqlite` | `StoredQualifiedIdentity` | Fields: `qi_bytes` (inner bincode), `status: u8`, `identity_type: String`, `wallet_hash: Option<[u8;32]>`, `wallet_index: Option<u32>` | |
| 39 | +| `det:identity_order:v1` | `None` | `platform-wallet.sqlite` | `Vec<[u8;32]>` | Ordered list of identity ID raw bytes | |
| 40 | +| `det:top_ups:<base58_identity_id>` | `None` | `platform-wallet.sqlite` | `BTreeMap<u32, u64>` | Top-up history: account index → credits | |
| 41 | + |
| 42 | +Source: `src/context/identity_db.rs` |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Scheduled votes |
| 47 | + |
| 48 | +| Key | Scope | Store | Value type | Notes | |
| 49 | +|-----|-------|-------|------------|-------| |
| 50 | +| `det:scheduled_vote:<base58_voter_id>:<contested_name>` | `None` | `platform-wallet.sqlite` | `StoredScheduledVote` | Fields: `voter_id: [u8;32]`, `contested_name: String`, `choice: StoredVoteChoice`, `unix_timestamp: u64`, `executed_successfully: bool` | |
| 51 | + |
| 52 | +Source: `src/context/identity_db.rs` |
| 53 | + |
| 54 | +--- |
| 55 | + |
| 56 | +## Contested names (DPNS) |
| 57 | + |
| 58 | +| Key | Scope | Store | Value type | Notes | |
| 59 | +|-----|-------|-------|------------|-------| |
| 60 | +| `det:contested_name:<normalized_name>` | `None` | `platform-wallet.sqlite` | `StoredContestedName` | Fields: `normalized_contested_name`, `locked_votes`, `abstain_votes`, `awarded_to`, `end_time`, `locked`, `last_updated`, `contestants: Vec<StoredContestant>` | |
| 61 | + |
| 62 | +`StoredContestant` fields: `id: [u8;32]`, `name`, `info`, `votes: u32`, `created_at`, `created_at_block_height`, `created_at_core_block_height`, `document_id: [u8;32]`. |
| 63 | + |
| 64 | +Source: `src/context/contested_names_db.rs` |
| 65 | + |
| 66 | +--- |
| 67 | + |
| 68 | +## Contracts |
| 69 | + |
| 70 | +| Key | Scope | Store | Value type | Notes | |
| 71 | +|-----|-------|-------|------------|-------| |
| 72 | +| `det:contract:<base58_contract_id>` | `None` | `platform-wallet.sqlite` | `StoredContract` | Fields: `contract_bytes: Vec<u8>` (platform-serialized), `alias: Option<String>` | |
| 73 | + |
| 74 | +Source: `src/context/contract_token_db.rs` |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Tokens |
| 79 | + |
| 80 | +| Key | Scope | Store | Value type | Notes | |
| 81 | +|-----|-------|-------|------------|-------| |
| 82 | +| `det:token:<base58_token_id>` | `None` | `platform-wallet.sqlite` | `StoredToken` | Fields: `config_bytes: Vec<u8>` (bincode `TokenConfiguration`), `alias: String`, `data_contract_id: [u8;32]`, `position: u16` | |
| 83 | +| `det:token_balance:<base58_identity_id>:<base58_token_id>` | `None` | `platform-wallet.sqlite` | `u64` | Raw balance in token base units | |
| 84 | +| `det:token_order:v1` | `None` | `platform-wallet.sqlite` | `Vec<([u8;32],[u8;32])>` | Ordered `(token_id, identity_id)` pairs for My Tokens screen | |
| 85 | + |
| 86 | +Source: `src/context/contract_token_db.rs` |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## Platform addresses |
| 91 | + |
| 92 | +Both keys use **per-wallet scope** (`Some(&seed_hash)`) so entries cascade on wallet removal. |
| 93 | + |
| 94 | +| Key | Scope | Store | Value type | Notes | |
| 95 | +|-----|-------|-------|------------|-------| |
| 96 | +| `det:platform_addr:<canonical_address>` | `Some(&wallet_seed_hash)` | `platform-wallet.sqlite` | `StoredPlatformAddressInfo` | Fields: `balance: u64`, `nonce: u32` | |
| 97 | +| `det:platform_sync:v1` | `Some(&wallet_seed_hash)` | `platform-wallet.sqlite` | `StoredPlatformSyncInfo` | Fields: `last_sync_timestamp: u64`, `sync_height: u64` | |
| 98 | + |
| 99 | +Source: `src/context/platform_address_db.rs` |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## DashPay sidecar |
| 104 | + |
| 105 | +All sidecar keys use **global scope** (`None`). The per-network `platform-wallet.sqlite` already partitions by network, so no `<network>:` prefix is needed within the key. |
| 106 | + |
| 107 | +| Key | Scope | Store | Value type | Notes | |
| 108 | +|-----|-------|-------|------------|-------| |
| 109 | +| `det:dashpay:blocked:<base58_contact_id>` | `None` | `platform-wallet.sqlite` | `()` | Presence-only flag: contact is blocked | |
| 110 | +| `det:dashpay:rejected:<base58_counterparty_id>` | `None` | `platform-wallet.sqlite` | `()` | Presence-only flag: contact request rejected | |
| 111 | +| `det:dashpay:timestamps:<base58_entity_id>` | `None` | `platform-wallet.sqlite` | `(i64, i64)` | DET-local `(created_at_ms, updated_at_ms)` | |
| 112 | +| `det:dashpay:private:<base58_owner>:<base58_contact>` | `None` | `platform-wallet.sqlite` | `ContactPrivateInfo` | Fields: `nickname: String`, `notes: String`, `is_hidden: bool` | |
| 113 | +| `det:dashpay:address_index:<base58_owner>:<base58_contact>` | `None` | `platform-wallet.sqlite` | `ContactAddressIndex` | Fields: `owner_identity_id: Vec<u8>`, `contact_identity_id: Vec<u8>`, `next_send_index: u32`, `highest_receive_index: u32`, `bloom_registered_count: u32` | |
| 114 | +| `det:dashpay:addr_map:<base58_owner>:<address>` | `None` | `platform-wallet.sqlite` | `([u8;32], u32)` | Reverse map: wallet address → `(contact_id_bytes, index)` | |
| 115 | + |
| 116 | +Source: `src/wallet_backend/dashpay.rs`, `src/model/dashpay.rs` |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## Summary counts |
| 121 | + |
| 122 | +| Store | Key count | |
| 123 | +|-------|-----------| |
| 124 | +| `det-app.sqlite` | 1 | |
| 125 | +| `platform-wallet.sqlite` | 17 (across 8 domains) | |
| 126 | +| **Total** | **18** | |
| 127 | + |
| 128 | +Prefixed/templated keys (e.g. `det:identity:<id>`) are counted once per prefix, not per instance. |
0 commit comments