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

"Customize transaction" flow on SEND is providing bad PSBT for hardwallets using published APK on ungoogled phone #25

Closed
bitcoinheiro opened this issue Jun 27, 2023 · 14 comments

Comments

@bitcoinheiro
Copy link

When using the "Create transaction" button, all works fine and I can see the singlesig hardwallet to sign - and it works as expected!
But when I go through the "Customize transaction" flow, it does not show the correct device to sign and if I export as QR from above it is lacking information for the device to proceed with signing flow.

Please see screenshot below:
This is how it should be, with keys below to sign:
image

This is the customize transaction I'm talking about:
image

This is how it looks after customizing fees:
image

Where is the key? Without the button on the key to sign, by signing using the general menu, the hardwallet fails to identify the policy:
image

@bitcoinheiro
Copy link
Author

It's like it only cares about the change at the end of the process. You can see that it becomes a "Receive at" instead of "Send to"

@hugohn
Copy link
Contributor

hugohn commented Jun 28, 2023

Hey @bitcoinheiro, about this transaction, did you send BTC back to your own wallet? If so, only the change amount is relevant for the wallet and updating the wallet balance. The rest is subtracted as it goes to the miners.

@bitcoinheiro
Copy link
Author

No, I was not sending BTC to the own wallet. The transaction I was trying to make had 1 input and 2 outputs (1 external + 1 change). When using the "Create transaction" button, all worked as expected. But after the "Customize transaction" flow, it prioritized the change output for some reason (bigger than spend??)

@bitcoinheiro
Copy link
Author

bitcoinheiro commented Jun 29, 2023

I've tried making a transaction where the spend output was bigger than the change one to check my theory above, but no success. Will post a video to help you reproduce the bug.

You can see my video showing where/how the bug happens here:
https://youtu.be/bIDedEGDJxg

Note that I'm connecting using Tor as VPN on this device.
Maybe this issue is also related to this issue: #24

I can use it after handshaking via clearnet with your fee/price server - but then I reverted to Tor to use it privately.
Nunchuk is not supposed to work with users that want to protect their IPs?

@hugohn
Copy link
Contributor

hugohn commented Jun 29, 2023

@bitcoinheiro we have many users who connect to their own node over Tor, so that's not an issue. Anyway, we'll investigate it.

From the video, it looks like for some reason the Send transaction (outgoing) was somehow mistakenly interpreted as a Receive transaction (incoming).

@hugohn
Copy link
Contributor

hugohn commented Jun 29, 2023

@bitcoinheiro are you using our published APK on GrapheneOS? Or did you compile from source?

@bitcoinheiro bitcoinheiro changed the title "Customize transaction" flow on SEND is providing bad PSBT for hardwallets "Customize transaction" flow on SEND is providing bad PSBT for hardwallets using published APK on ungoogled phone Jun 29, 2023
@bitcoinheiro
Copy link
Author

bitcoinheiro commented Jun 29, 2023

@bitcoinheiro are you using our published APK on GrapheneOS? Or did you compile from source?

Yes, so this is Play Services related? I thought the apk available on this repo was as if compiled it myself from the source, no differences. Is the apk different from the source?

@hugohn
Copy link
Contributor

hugohn commented Jun 30, 2023

@bitcoinheiro the APK is NOT different from the source and there is no dependencies on Play Services (which is only used for crash reports). The reason I'm asking is whether your build environment/compilation process might have caused a bug.

@bitcoinheiro
Copy link
Author

bitcoinheiro commented Jun 30, 2023

@bitcoinheiro the APK is NOT different from the source and there is no dependencies on Play Services (which is only used for crash reports). The reason I'm asking is whether your build environment/compilation process might have caused a bug.

Understood! I used the apk from the releases located here: https://github.com/nunchuk-io/nunchuk-android/releases

@bitcoinlizard
Copy link

I'm seeing a similar issue to what @bitcoinheiro is seeing.

I am using APK version 1.9.32 (1.9.31 was also affected) on a phone running GrapheneOS with no Google Play Services installed. I created a new single sig wallet with a ColdCard for the signing key. I am trying to "send all". I scan a QR of the receiving address (an address outside of the nunchuk wallet). If I click "Create transaction" I receive an insufficient funds error because there is no money to pay the miner fee. If I click "Customize transaction" I immediately see the same error message for insufficient funds. I check the box for "Subtract fee from send amount" and click "Continue". Everything looks good at the next screen. I then click "Confirm and create transaction". I am at the "Pending Signatures" screen and the "Receive at" doesn't show an address and the amount is zero.

I recreated the exact same wallet in the iOS version of the app. Everything works correctly without issue. One thing I noticed was that the "Subtract fee from send amount" seems to be a default option in the iOS version of the app but not the Android APK.

@hugohn
Copy link
Contributor

hugohn commented Jul 5, 2023

Thanks all for reporting. We're looking into this issue.

@JayceLuong
Copy link
Collaborator

Could you use this version and help us verify that it works? We cannot reproduce on our side. This is new APK https://drive.google.com/file/d/1Zw275m64vPej04UXjXIF7cFnG2PX9Bhu/view?usp=sharing

@bitcoinlizard
Copy link

Thank you @JayceLuong. This version seems to have solved the issue. I can see that "Subtract fee from send amount" is now enabled by default. I don't have access to my signing key at the moment to complete the transaction but it would appear that my issue is resolved.

@hugohn
Copy link
Contributor

hugohn commented Jul 17, 2023

@bitcoinheiro @bitcoinlizard the latest Android version should fix both of the issues mentioned here.

https://github.com/nunchuk-io/nunchuk-android/releases/tag/android.1.9.33

@hugohn hugohn closed this as completed Jul 17, 2023
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

4 participants