Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: Import xprivs for use with trezor watching only wallet. #1934

Open
JoeGruffins opened this issue Nov 28, 2020 · 2 comments
Open

multi: Import xprivs for use with trezor watching only wallet. #1934

JoeGruffins opened this issue Nov 28, 2020 · 2 comments

Comments

@JoeGruffins
Copy link
Member

JoeGruffins commented Nov 28, 2020

Background

Trezor is a hardware wallet. We can make simple transactions with it. It stores private keys on the device and doesn't give them out. If you want something signed with a private key, you send that data to the trezor to be signed and get the signature back. There is an effort to get staking working securely and infallibly on trezor. For an old staking pool, or a solo staker, this is mostly fine.

Problem

For the new vspd api (v3) we need to send the private key used to derive the sstxsubmission so that the pool can vote for us. Normally, a trezor cannot export a private key.

Solution

Rather than trying create an exception, we have decided to create a psuedo-key from other data that only the user can access from their trezor. We will use this data as a private key and import it into dcrwallet as an xpriv. From that xpriv dcrwallet will create voting keys for trezor ticket purchases.

Specific Changes Needed

db

We need to add more imported private accounts to the wallet. Plus we need to make sure these specific accounts aren't used for other transactions. (How to?)

The "imported" account has a lot of special exceptions. It is much less of an account that a placeholder for imported addresses. All accounts are keyed in the db by a uint32, and imported accounts start half way. We can use the halfway point plus one for our purposes. Our voting accounts are almost identical to derived accounts. The only difference is the type.

grpc

We can add a method to import voting extended private keys. It takes the xpriv, password, and some other arguments and stores an encrypted xpriv in the database at the next imported account index.

We need to specify the voting account when purchasing tickets. For this a couple of arguments need to be added to Purchase tickets, including the voting account number.

voting

These changes should allow for voting with a watching only wallet, but I do not propose making this possible yet. The objective is to allow voting from the new vspd. If watching only wallet voting is needed, that can be done later.

revoking

Revoking using the xprivs is however necessary as part of these changes.
edit: Voting and revoking may work out of the box.

change log
2020
11/28 Initial issue.
12/14 Update db, grpc, and voting sections.
@JoeGruffins
Copy link
Member Author

JoeGruffins commented Dec 12, 2020

Working on it.

@JoeGruffins
Copy link
Member Author

Waiting for the next trezor release, which should have ticket purchasing enabled. Also related is this: trezor/trezor-firmware#1508 but who knows how long it will take for this to get moving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant