-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add Trezor support #41
Conversation
@wszdexdrf it seems the CI is failing: https://github.com/wizardsardine/async-hwi/actions/runs/5775689020/job/15668289653?pr=41 |
I fixed the CI tests. The problem was the the CI didn't have a protobuf compiler, which is needed to build the trezor-client crate (dependency). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR !
https://crates.io/crates/trezor-client 0.1.2 with added |
Seems good, targeting next week to release it after testing with simulator 👍 |
Can you add an implementation of |
Something like this? |
Yes perfect ! , my bad for commenting too quickly. |
sorry @wszdexdrf i'm having trouble following the logic but, can this actually sign transactions? ISTM from |
Yes, about that. I didn't want to make any assumptions, hence I created the I honestly don't feel strongly about either way. We could also create a while loop (with some sleeps in between, hopefully using the async nature somehow), or simply leaving it up to the user. What do you think about this @matejcik? |
well, sign_tx from HWI trait doesn't return anything, it expects you to modify the passed in psbt object (as far as I can tell anyway). there is no way for the caller to get ahold of the SignTxProgress object so you'll need to do the loop internally somehow. given that the whole thing is async, it would be nice to do it in an async manner -- but trezor-client library is currently synchronous, so I'm not sure how to accomplish that |
@matejcik please take a look at https://github.com/wszdexdrf/async-hwi/pull/3 where I used some tests to test the functionality. |
I did some testing and now the code is able to sign transactions. If anyone needs to look at the tests, they are on branch https://github.com/wszdexdrf/async-hwi/tree/tests |
Pinging reviewers for review and merge. @matejcik @edouardparis @prusnak |
))?; | ||
for pk in input.bip32_derivation.keys() { | ||
let fp = input.bip32_derivation.get(pk).unwrap().0; | ||
let pk = PublicKey::from_slice(pk.serialize().as_ref()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear here why it is serialize and deserialize, can you not just clone the key ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pk
from the bip32_derivation
is of type bitcoin::secp256k1::PublicKey
and the type needed in partial_sigs
is bitcoin::PublicKey
. The serializing and deserializing is used as a rudimentary type-casting.
Sorry I did not forget you, I am just very busy. But I am going to a conference next week and I hope to test with a real device here. |
This PR aims to add Trezor functionality to this library using trezor-client crate. The following commits add an implementation of
trait HWI
using the above mentioned Trezor API in rust.