Skip to content

Commit 3d23ea4

Browse files
feat(qt): create and top up the DashPay identity
Add IdentityFlow, the DashPay tab's identity controller, built only with --enable-platform-gui. It creates and tops up the wallet's identity (identity index 0) as the mobile wallets do. The wallet builds and signs an asset lock whose credit output pays a seed-derived funding key: RegistrationFundingKey{0} to register, or a fresh TopupFundingKey{n} per top-up. The user confirms the amount and the exact network fee before anything is sent. The flow then writes the asset lock's record (dashpay/funding/identity/0 or dashpay/funding/topup/<n>: txid and amount, plus the identity for a top-up), commits the transaction, and waits for a lock. A rejected commit abandons the transaction and erases the record once it is abandoned. Once the node has the payment's InstantSend lock, or else its ChainLock (the node drops the InstantSend lock once the block is ChainLocked), one SDK call (registerIdentity or topUpIdentity) creates the identity or adds the credits. The call is signed through the wallet, which stays unlocked from the passphrase given for the funding until the client has signed. The amounts follow the mobile wallets: 0.03 DASH to register and at least 0.01 DASH to top up. The registered keys follow the mobile wallets' ids: 0 AUTHENTICATION MASTER, 1 AUTHENTICATION CRITICAL, 2 AUTHENTICATION HIGH, 3 TRANSFER CRITICAL, 4 ENCRYPTION and 5 DECRYPTION. ENCRYPTION and DECRYPTION are MEDIUM, without the mobile wallets' DashPay contract bounds, for which the client has no field. The record is erased once Platform has consumed the asset lock. A registration or top-up interrupted by a restart, a dropped call or a refusal therefore offers Continue, which sends the same asset lock again and funds nothing new. If Platform says the asset lock is already consumed, an earlier attempt landed. A top-up then ends its record. A registration finds its identity by the Hash160 of its MASTER key, and finding the identity ends the registration record. A record whose payment is missing from the wallet, abandoned or replaced is ended by Continue, with nothing sent to Platform. When the client starts, the flow looks the identity up by its MASTER key. Deriving that key needs an unlocked wallet, so for an encrypted wallet the tab offers a lookup button instead of asking for the passphrase on its own. The lookup starts only after the passphrase dialog, whose event loop may itself have started one. The key hash is kept in memory for later lookups. Closing a gate forgets the identity until it is looked up again. The tab shows one header line with the identity and its balance, plus Create identity, Continue or Top up, whichever applies. The flow follows the service's rules: it calls only through client() and checks it each time, wraps each write in trackWrite, keeps one call in flight, and on changed() resets a call the client dropped and reissues the lookup. PlatformService gains walletModel() and clientModel() accessors. PlatformUi::Describe words a failed call for C3's StatusKind set. The fake Platform client records the asset-lock proofs it is given. The PlatformTests scenarios cover: - registration: confirmation of the amount and fee, where declining sends nothing; the asset lock paying the registration key; the wait until the node has a lock; the register call with its proof; the record ending. - Continue: after a write dropped by network-off and after a restart; the already-consumed answer resolved by the MASTER-key lookup. - top-ups: a fresh funding key each time; the new balance; an abandoned funding ended by Continue. - an encrypted wallet: the lookup on unlock, with one lookup shown as running when the client is rebuilt during the passphrase dialog; the balance line; and lookups after a rebuild without the passphrase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 891d668 commit 3d23ea4

12 files changed

Lines changed: 1073 additions & 7 deletions

‎src/Makefile.qt.include‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ QT_MOC_CPP = \
124124

125125
if ENABLE_PLATFORM_GUI
126126
QT_MOC_CPP += \
127+
qt/platform/moc_identityflow.cpp \
127128
qt/platform/moc_platformpage.cpp \
128129
qt/platform/moc_platformservice.cpp
129130
endif
@@ -232,8 +233,10 @@ BITCOIN_QT_H = \
232233

233234
if ENABLE_PLATFORM_GUI
234235
BITCOIN_QT_H += \
236+
qt/platform/identityflow.h \
235237
qt/platform/platformpage.h \
236-
qt/platform/platformservice.h
238+
qt/platform/platformservice.h \
239+
qt/platform/platformui.h
237240
endif
238241

239242
QT_RES_ICONS = \
@@ -370,8 +373,10 @@ BITCOIN_QT_WALLET_CPP = \
370373
qt/walletview.cpp
371374

372375
BITCOIN_QT_PLATFORM_CPP = \
376+
qt/platform/identityflow.cpp \
373377
qt/platform/platformpage.cpp \
374-
qt/platform/platformservice.cpp
378+
qt/platform/platformservice.cpp \
379+
qt/platform/platformui.cpp
375380

376381
BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
377382
if TARGET_WINDOWS

0 commit comments

Comments
 (0)