btcpayserver / BTCPayServer.Vault

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

Vault not working right on linux #74

Closed divinationstar closed 9 months ago

divinationstar commented 11 months ago

Describe the bug

I've never been able to get the send function working on linux. It gives me an error message "This device can't sign the transaction. (Wrong device, wrong passphrase or wrong device fingerprint in your wallet settings)" Which makes no sense as its the same device I use to send from Wasabi.

I've tried it with Brave and get that error above. I've tried it with Chrome and it doesn't see that Vault is running so I can't get past that error message.

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

It seems to me this is a timeout issue.. Could have something to do with the CPU calculations required to calculate a transaction with dozens of inputs. The current workaround is to send a small amount of BTC which calculates successfully just before it times out. If I add more BTC then it times out. I've done this multiple times so I know how much I can send without timing it out. But there's no reason for Wasabi to time out. It times out after about 45 seconds -2 minutes. But if there is going to be a timeout 5+ minutes should be the default. I can calculate exactly how long until the timeout if you want.

My computer is about 4 years old. 8 gigs ram. ntel® Core™ i7-8650U CPU @ 1.90GHz × 8 Mesa Intel® UHD Graphics 620 (KBL GT2)

Screenshots / Video / GIf (if applicable)

divinationstar commented 10 months ago

Tried it in Opera browser. Same message as before. Think's it's the wrong device. The only issue I can think of is I have one device for BTC and another device for LTC. Maybe it thinks sending BTC should use the LTC device? Which doesn't make much sense but it's a possibility.

IMG_4195

divinationstar commented 10 months ago

I figured out the problem. Master fingerprint and Account key path were empty. I put those in and I'm able to send. Although, the process is a bit hokey and choosing coins in coin control really drains the memory in the browser. This works in Brave but Chrome does not see the Vault running.

Lastly, choosing too many coins (over 70) created a crash in the Nano X that required a complete restore.

divinationstar commented 10 months ago

If I do a send with 150+ inputs the vault times out. You may want to look at the timeout setting on the vault app. The problem is it times out just before the Nano X finishes calculating. This might improve with a faster computer which I will have to test in a few weeks.

If the Vault stays in calculation mode until Nano X finishes then it works and the transaction can continue. If the Vault times out first, I have to restart the send from scratch. I always have to reduce the inputs/total amount to send with each attempt until it doesn't time out.

NicolasDorier commented 9 months ago

@divinationstar can you tell me what error you see with the timeout? Where do you see? in the javascript console? in the window?

divinationstar commented 9 months ago

@divinationstar can you tell me what error you see with the timeout? Where do you see? in the javascript console? in the window?

There is no error message. The pop up vault window just times out. You can tell because the signing logo stops in the vault window. If that happens before the ledger finishes calculating the process stops and you have to start all over again. The fix is to extend the timeout in the Vault to lets say five minutes. Most likely that won't work either because the ledger will time out way before then. But at least it won't be the Vault timing out. Any merchant that receives lots of BTC transactions will have this problem if they let the inputs keep adding up.

NicolasDorier commented 9 months ago

I don't think we have any timeout in the vault. I tried to reproduce this with a sleep, but couldn't do it.

" the signing logo stops in the vault window" it means that it should have completed properly.

What do you see on the btcpay website then? Do you see an error or it's still showing "Signing on the device" step?

divinationstar commented 9 months ago

I don't think we have any timeout in the vault. I tried to reproduce this with a sleep, but couldn't do it.

" the signing logo stops in the vault window" it means that it should have completed properly.

What do you see on the btcpay website then? Do you see an error or it's still showing "Signing on the device" step?

If the vault times out or it finishes calculations BEFORE the ledger has finished it means it has timed out. The ledger must finish calculating first while the vault is still showing the signing activity. If the ledger finishes it's calculations first, then the next thing that happens is the browser page changes to the broadcast screen showing all the inputs. If the vault finishes it's calculations or times out first, then the ledger finishes it's calculations after that then nothing happens. The vault is not doing anything and the browser page doesn't complete and go to the broadcast screen and the ledger is back to where it started.

I can duplicate this every time if I try to make a send with more than let's say 150 inputs.

I'm assuming the vault is calculating during the signing logo thing running in the window. If it's not calculating then it's running something. That something is what sends data to the browser page to go to the broadcast page. The browser shows 127.xx.xx something as it sends data to the page.

divinationstar commented 9 months ago

Once I see the 127.xx.xx in the bottom of the browser page that means it's worked and I can breathe a sense of relief that I don't have to wait through this whole thing again to get a send going. This only happens when the vault is still showing it's running some calculation. If not running the browser will never forward to the broadcast page.

NicolasDorier commented 9 months ago

I released https://github.com/btcpayserver/BTCPayServer.Vault/releases/tag/Vault%2Fv2.0.9 which fixed an error on windows about the PSBT being too big. I don't think this will solve your issue, but please try it.

I tried signing with coldcard a huge transaction which took 5min to process. No timeout.

It is possibly a bug in Trezor T's support for HWI. There isn't any timeout set at the Vault level.

NicolasDorier commented 9 months ago

About the original error:

"This device can't sign the transaction. (Wrong device, wrong passphrase or wrong device fingerprint in your wallet settings)"

This happen if you imported the xpub rather than exporting the wallet file from wasabi and importing in btcpay. A XPUB isn't enough to create PSBTs. This is why there is a big warning in the page for importing it.

NicolasDorier commented 9 months ago

closing this as the original issue was about not importing the wasabi wallet file. (instead of xpub)

NicolasDorier commented 9 months ago

@divinationstar can you open a separate issue after trying on https://github.com/btcpayserver/BTCPayServer.Vault/releases/tag/Vault%2Fv2.0.9

Explain this timeout precisely, and maybe additional context on what you see on Sparrow, this may be a HWI bug here. I sadly can't try, I don't have a Trezor T now.

divinationstar commented 9 months ago

I've been using a Ledger Nano X, not a Trezor.

divinationstar commented 9 months ago

About the original error:

"This device can't sign the transaction. (Wrong device, wrong passphrase or wrong device fingerprint in your wallet settings)"

This happen if you imported the xpub rather than exporting the wallet file from wasabi and importing in btcpay. A XPUB isn't enough to create PSBTs. This is why there is a big warning in the page for importing it.

Are you saying this issue will go away if importing wasabi file instead of the xpub?

NicolasDorier commented 9 months ago

yes