dcrwallet
dcrwallet copied to clipboard
multi: Modify PurchaseTickets method.
multi: Modify PurchaseTickets method.
Accept the choice to force submission script derivation from an account
and mark signing addresses for the external branch of that account that
share the index.
rpc: Add parameters to PurchaseTickets.
Add the VotingAccount and UseVotingAccount parameters and the VotingKeys
return.
server: Add DumpPrivateKey.
Add logic for DumpPrivateKey grpc request.
rpc: Add DumpPrivateKey method type.
server: Add Address method.
Add logic for Address grpc request.
rpc: Add address method type.
Add grpc method that returns the address for an account at branch and
index.
Decrediton will get private data for a seed from trezor. It then imports that seed into dcrwallet as an account and names it "prefix_addr" where addr is the address at acct0/branch0/index0 from the trezor. We can later use this name to determine if the account has been imported. After the account is imported, this pr comes into play. When purchasing the ticket the account is unlocked. It then calls the PurchaseTickets
grpc method and passes true for UseVotingAccount
and the account for VotingAccount
. The account's internal address at the next index is used for the submission script. Later we dump the private key for the submission script to give to the vsp. Normally we cannot dump a private key from trezor, so this is the main motivation for these changes. The same index for the external address of that account is used as an alternate signing key for the ticket. The signing address is communicated to the vspd and future settings for that ticket, especially voting preferences, can be signed without asking trezor to sign every message (because it owns the commitment address which is normally used to prove ownership).
The trezor must sign the ticket hex and then it sends it as a raw tx. So, all of the vsp communication is with decrediton currently. I am unsure if dcrwallet should play a larger role there. I believe there will also need to be one more pr after this one to deal with ticket upkeep. Trezor purchases come with the drawback that the fee cannot be automatically paid again if too much time has passed. I'm actually unsure of the wallet's responsibility here, will look into it more, but if there is a tldr...
Is this still a draft or ready for review?
It is draft. Will clean it up ASAP. Was waiting to see what happened with #2120 to prevent some footgun situations before this might get it.