btcpayserver / BTCPayServer.Vault

Sign with software or hardware wallets
MIT License
163 stars 75 forks source link

I cant sign with my bitbox02 #39

Open ElSadhu opened 3 years ago

ElSadhu commented 3 years ago

Describe the bug

Sign the transaction with BTCPay Server Vault

Your BTCPay Environment (please complete the following information):

Your local environment (please complete the following information):

Your hardware wallet details (please complete the following information):

Additional context

Device found: Unknown

An unexpected error happened. (Input error: error code: 103, message: generic error. A keypath might be invalid. Supported keypaths are: m/49'/0'/ for p2wpkh-p2sh; m/84'/0'/ for p2wpkh; m/48'/0'//2' for p2wsh multisig; m/48'/0'//1' for p2wsh-p2sh multisig; m/48'/0'/' for any supported multisig; account can be between 0' and 99'; For address keypaths, append /0/ for a receive and /1/ for a change address.)

I think these is part of the issue, i find it in the report: 3-9:1.0: Failed to open report descriptor at '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-9/3-9:1.0/report_descriptor': No such file or directory

I can receive but I cant spent. Ićant understand that becouse I can do that with Specter. Iḿ running the btcpayserver in a testnet node.

Screenshots / Video / GIf (if applicable)

pavlenex commented 3 years ago

@elchula76 when trying to spend, can you make sure that in the advanced tab Always include non-witness UTXO if available is selected?

Also since this is testned, can you provide PSBT (when signing, instead of the hardware wallet, select PSBT and at the bottom of the next page paste PSBT content)

ElSadhu commented 3 years ago

Right now I was messaging with the bitbox02 support because i have the same issue with wasabi and they found these:

https://github.com/zkSNACKs/WalletWasabi/issues/6303

May be it helps you. Sorry my poor english.

NicolasDorier commented 3 years ago

I don't believe this is the case, on testnet we are using 84'/1'

ping @benma any issue with hwi-2.0.1 ?

NicolasDorier commented 3 years ago

@elchula76 which kind of wallet is it? Segwit or Segwit P2SH? (if you don't know, share an address with us)

NicolasDorier commented 3 years ago

Also in your wallet's settings, can you share us this

image

And how did you imported your wallet?

NicolasDorier commented 3 years ago

The error message also indicate about 0', but we are normally using 1' as it should on testnet...

benma commented 3 years ago

@NicolasDorier there is no known issue with the BitBox02 in HWI 2.0.1.

The error message is a generic message and does not necessarily mean the keypath is wrong. @elchula76 please answer the questions above so we can get more hints.

@elchula76

If there is a way to export and post a PSBT that you can't sign, please do so (can also be from a new test wallet for privacy, but it would help a lot with debugging).

ElSadhu commented 3 years ago

@elchula76 which kind of wallet is it? Segwit or Segwit P2SH? (if you don't know, share an address with us)

Good morning, The wallet may be single sign segwit, there u have an adress: tb1qhejfmq3mfzgfncwdne7fwpyqx8rqxjw7dyf7j6 I am just a newby technical user (since DOS) with a lot experiences working with a lot kind of software but i never be a developer and I really dont know what kind of info I can share without compromise my privacy and security,

benma commented 3 years ago

@elchula76 as I mentioned, you could make a new wallet (seed) to share the seed and a PSBT with us that does not work, so we can take a look.

Also please provide this: https://github.com/btcpayserver/BTCPayServer.Vault/issues/39#issuecomment-914017622

NicolasDorier commented 3 years ago

Can you export PSBT by doing this:

image

Then scroll down the page and copy paste here this data

image

ElSadhu commented 3 years ago

Also in your wallet's settings, can you share us this

image

And how did you imported your wallet?

Account key path: m/84'/1'/0' And how did you imported your wallet? Iḿ running a testnet core working fine with specter and my bitbox02, I do a normal import from my bitbox02, two times becouse the first time I think that i done something wrong. My specter key path with the same HW and the same procedure is m/84h/1h/0h and it work perfect.

NicolasDorier commented 3 years ago

@elchula76 I do a normal import from my bitbox02,: You mean with the BTCPay Server Vault?

What you did seem right to me.

If you can share us https://github.com/btcpayserver/BTCPayServer.Vault/issues/39#issuecomment-914132811 I can take a look.

ElSadhu commented 3 years ago

@elchula76 as I mentioned, you could make a new wallet (seed) to share the seed and a PSBT with us that does not work, so we can take a look.

Also please provide this: #39 (comment)

Can I use the same wallet? It just a test, i m trying to learn how to create and use a store with btcpay

NicolasDorier commented 3 years ago

yes, you can use same wallet

ElSadhu commented 3 years ago

Tell me if this is what u need

{ "fee": "0.00000178 BTC", "feeRate": "1 Sat/B", "tx": { "hash": "22488e26cc62d7d384bdff6bef747e9b11af96d1aa59799061aef27dbe9e9b86", "ver": 1, "vin_sz": 2, "vout_sz": 1, "lock_time": 0, "size": 123, "in": [ { "prev_out": { "hash": "d1e641a8c950f7aa5a6e23b2d8bff7d679668faec1ba70e5d3e35035640407c7", "n": 0 }, "scriptSig": "" }, { "prev_out": { "hash": "5e6a3aaaff6912a5199fcf7973dfe0000c6a6d10cfd3e7fb3b0bffb943ccbf7d", "n": 0 }, "scriptSig": "" } ], "out": [ { "value": "0.00012822", "scriptPubKey": "0 e9e457f78f09091f5f902d02cb5e4f5c9161ad5c" } ] }, "inputs": [ { "index": 0, "partial_signatures": {}, "non_witness_utxo": { "hash": "d1e641a8c950f7aa5a6e23b2d8bff7d679668faec1ba70e5d3e35035640407c7", "ver": 2, "vin_sz": 1, "vout_sz": 2, "lock_time": 0, "size": 223, "in": [ { "prev_out": { "hash": "2e7596e8199024e28c25da767c2002be3cae76474bb7405fdfc7b762bb7e649e", "n": 0 }, "scriptSig": "", "witness": "3045022100cf47299cd3ffbb1ac297bf3a08bef685e03deb20474a020366660e928e255a9c0220116a43f538c0d57b27da9c4f2d7608ee43b59377b7f2e70c0694484f86de627d01 02702db99130400bc4b8ebb0f90bf51a9a911a3223e280287d7b4cab945fa4c2fe", "sequence": 4294967293 } ], "out": [ { "value": "0.00003000", "scriptPubKey": "0 5e30629b00f8a75edc0b140599441c498bf97e64" }, { "value": "0.00010580", "scriptPubKey": "0 b904bc0bd17dbbdcffa3487d040becfe22452871" } ] }, "witness_utxo": { "value": "0.00003000", "scriptPubKey": "0 5e30629b00f8a75edc0b140599441c498bf97e64" }, "bip32_derivs": [ { "pubkey": "03d81090273d60898169bfb5449d45c3ceff03d4e6901ae3dabed4dde76e052a7d", "master_fingerprint": "7b8460bc", "path": "84'/1'/0'/0/0" } ], "bip32_taproot_derivs": [] }, { "index": 1, "partial_signatures": {}, "non_witness_utxo": { "hash": "5e6a3aaaff6912a5199fcf7973dfe0000c6a6d10cfd3e7fb3b0bffb943ccbf7d", "ver": 1, "vin_sz": 1, "vout_sz": 2, "lock_time": 0, "size": 223, "in": [ { "prev_out": { "hash": "6459414eaa7e3921284adcd5f99b5a6d15eb00f4c8ca0f399d8fec57386f7554", "n": 3 }, "scriptSig": "", "witness": "3045022100f0ab90aa6270397b62f8ec526bfdc047681295f746b2d869c7cafce2c14fd84602201c93d6b6770ae26d81a64c5ffc9309073f55bed56e06217937b668dc5acce2a001 03b6f33d2e61601adde985e69aee070b85ee39894e7dd4647728c2d382d8dd5c12" } ], "out": [ { "value": "0.00010000", "scriptPubKey": "0 7e654ae46f4bf0a8f409593e360d432700be242a" }, { "value": "0.00031205", "scriptPubKey": "0 3d04c0219f77693d21016c756611a6a531121fe3" } ] }, "witness_utxo": { "value": "0.00010000", "scriptPubKey": "0 7e654ae46f4bf0a8f409593e360d432700be242a" }, "bip32_derivs": [ { "pubkey": "026c4e3df013624a41640f3cdb07892a63acba802162c7862016f9a24e011bb3cb", "master_fingerprint": "7b8460bc", "path": "84'/1'/0'/0/5" } ], "bip32_taproot_derivs": [] } ], "outputs": [ { "bip32_derivs": [], "bip32_taproot_derivs": [] } ] }

ElSadhu commented 3 years ago

@elchula76 I do a normal import from my bitbox02,: You mean with the BTCPay Server Vault?

What you did seem right to me.

If you can share us #39 (comment) I can take a look.

You mean with the BTCPay Server Vault? Yes, with the latest version of btcpayserver vault

NicolasDorier commented 3 years ago

@elchula76 can you copy paste not this, but scroll down and there is some base64 string that you can copy. Look the screen I show you above.

ElSadhu commented 3 years ago

These one?

cHNidP8BAHsBAAAAAscHBGQ1UOPT5XC6wa6PZnnW97/YsiNuWqr3UMmoQebRAAAAAAD/////fb/MQ7n/Czv759PPEG1qDADg33N5z58ZpRJp/6o6al4AAAAAAP////8BFjIAAAAAAAAWABQdJ+2osLpTc+uzhqEDUmQGsXYdNgAAAAAAAQEfuAsAAAAAAAAWABReMGKbAPinXtwLFAWZRBxJi/l+ZAEA3wIAAAAAAQGeZH67YrfH319At0tHdq48vgIgfHbaJYziJJAZ6JZ1LgAAAAAA/f///wK4CwAAAAAAABYAFF4wYpsA+Kde3AsUBZlEHEmL+X5kVCkAAAAAAAAWABS5BLwL0X273P+jSH0EC+z+IkUocQJIMEUCIQDPRymc0/+7GsKXvzoIvvaF4D3rIEdKAgNmZg6SjiVanAIgEWpD9TjA1Xsn2pxPLXYI7kO1k3e38ucMBpRIT4beYn0BIQJwLbmRMEALxLjrsPkL9RqakRoyI+KAKH17TKuUX6TC/gAAAAAiBgPYEJAnPWCJgWm/tUSdRcPO/wPU5pAa49q+1N3nbgUqfRh7hGC8VAAAgAEAAIAAAACAAAAAAAAAAAAAAQEfECcAAAAAAAAWABR+ZUrkb0vwqPQJWT42DUMnAL4kKgEA3wEAAAAAAQFUdW84V+yPnTkPysj0AOsVbVqb+dXcSighOX6qTkFZZAMAAAAA/////wIQJwAAAAAAABYAFH5lSuRvS/Co9AlZPjYNQycAviQq5XkAAAAAAAAWABQ9BMAhn3dpPSEBbHVmEaalMRIf4wJIMEUCIQDwq5CqYnA5e2L47FJr/cBHaBKV90ay2GnHyvziwU/YRgIgHJPWtncK4m2Bpkxf/JMJBz9VvtVuBiF5N7Zo3FrM4qABIQO28z0uYWAa3emF5pruBwuF7jmJTn3UZHcowtOC2N1cEgAAAAAiBgJsTj3wE2JKQWQPPNsHiSpjrLqAIWLHhiAW+aJOARuzyxh7hGC8VAAAgAEAAIAAAACAAAAAAAUAAAAAAA==

NicolasDorier commented 3 years ago

yes thanks one moment please

NicolasDorier commented 3 years ago

it seems to me correct PSBT. I will try to sign with another hardware wallet on btcpay, to make sure that this is not a bug from our end. If it works, then maybe some issue on bitbox2.

ElSadhu commented 3 years ago

I dont know if helps u but with specter I have these: Test | Single (Segwit) | m/84h/1h/0h; the same key path and i can send and receive transaction with the same bitbox02.

NicolasDorier commented 3 years ago

@benma it seems his PSBT is correct. I tried to replicate the bug with a coldcard on https://testnet.demo.btcpayserver.org/ but it worked properly.

Can you take a look at it? (if you use Brave, think of removing the shield) You can probably reproduce easily.

ElSadhu commented 3 years ago

I try it with firefox to

ElSadhu commented 3 years ago

I try the same removing the shield and againg-.

Device found: Unknown An unexpected error happened. (Input error: error code: 103, message: generic error. A keypath might be invalid. Supported keypaths are: m/49'/0'/ for p2wpkh-p2sh; m/84'/0'/ for p2wpkh; m/48'/0'//2' for p2wsh multisig; m/48'/0'//1' for p2wsh-p2sh multisig; m/48'/0'/' for any supported multisig; account can be between 0' and 99'; For address keypaths, append /0/ for a receive and /1/ for a change address.)

ElSadhu commented 3 years ago

@benma it seems his PSBT is correct. I tried to replicate the bug with a coldcard on https://testnet.demo.btcpayserver.org/ but it worked properly.

Can you take a look at it? (if you use Brave, think of removing the shield) You can probably reproduce easily.

I try to test the bitbox02 at the same link but it doesnt work because the server vault dont work at these link

NicolasDorier commented 3 years ago

@elchula76 I think this is something wrong with the bitbox02 at this point. Let's wait if @benma can repro.

ElSadhu commented 3 years ago

ok thanks, If i can help u, iḿ here working with your great work.

benma commented 3 years ago

@NicolasDorier I ran dotnet run -p BTCPayServer.Vault.csproj and used the test site you mentioned, but I can't get past this after accepting the connection in Vault:

Any other quick ways to test signing here?

@elchula76 can you share your mnemonic seed (if only used for testing purposes)? If not, it would be very helpful if you could make a new seed to share here, and another PSBT that fails, so I can try to figure out what is going on.

ElSadhu commented 3 years ago

I don't know if helps you but I use the same seed with electrum with mi bitbox02 HWW and it works fine signing the transaction. Two software signing fine at the same node with the same seed in bitbox02 (specter and electrum) and two (wasabi and btcpayserver) with exactly the same issue. If u want the seed i can send you but i dont want to do that here, i dont feel comfortably.

NicolasDorier commented 3 years ago

@benma that's strange error, I never saw this. Do you have a stacktrace in the javascript console? You should have, if so, please copy/paste here.

I will push a new commit that at least fix the device type unknown that @elchula76 is seeing. The error you show me seems different reason so I'll fix that at same time.

btw, is it possible the problem of @elchula76 come from the PSBT not having hte non_witness_utxo filled in?

ElSadhu commented 3 years ago

Good morning, I was trying to get my wasabi wallet with electrum thats work fine doing the same to get the btcpar wallet, but when i try I have these diference with the key path and if I try to change it it doesnt work and I have these error... may be it helps to undestand what happend... If some one of you give me an email adress I send u the seed. thanks. photo_2021-09-08_10-38-12 photo_2021-09-08_10-38-20

ElSadhu commented 3 years ago

@benma that's strange error, I never saw this. Do you have a stacktrace in the javascript console? You should have, if so, please copy/paste here.

I will push a new commit that at least fix the device type unknown that @elchula76 is seeing. The error you show me seems different reason so I'll fix that at same time.

btw, is it possible the problem of @elchula76 come from the PSBT not having hte non_witness_utxo filled in?

I always filled the box of non_witness_utxo, but i never try to sign the transaction with PSBT, I really dont know how it works and I dont know if bitbox02 can... I will try.

benma commented 3 years ago

@NicolasDorier I added a testnet bitbox02 wallet, received some coins, made a tx, and I can reproduce the same error.

However, when I copy the generated PSBT and run it on the command line like this:

hwi --chain test -t bitbox02 signtx <PSBT>

The transaction is displayed on the device and can be signed normally.

This means that somehow BTCPayServer.Vault is invoking HWI in the wrong way (maybe missing the --chain test param or something like that?), or that the PSBT created for the HW wallet is different from the one when choosing to export the PSBT. Unfortunately the log output does not show the exact HWI command invoked when signing.

benma commented 3 years ago

@NicolasDorier did you get a chance to take a look? As mentioned, the exported PSBT and everything on the HWI side seems okay.

NicolasDorier commented 3 years ago

sorry about this, I forgot this. I'll need to try, but my bitbox2 is at the office. I'll try to get it monday and repro.

NicolasDorier commented 3 years ago

@elchula76 if can you DM me on https://chat.btcpayserver.org/ so I don't drop the ball?

ElSadhu commented 3 years ago

Done

El vie, 1 oct 2021 a las 15:30, Nicolas Dorier @.***>) escribió:

@elchula76 https://github.com/elchula76 if can you DM me on https://chat.btcpayserver.org/ so I don't drop the ball?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/btcpayserver/BTCPayServer.Vault/issues/39#issuecomment-932229896, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVPYKVWLU3CKYX6XEKNNXA3UEWZV5ANCNFSM5DO5TFQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.