extension icon indicating copy to clipboard operation
extension copied to clipboard

Resolve PSBT errors for Ordinals and Stamps with Ledger (The operation on device was rejected)

Open 314159265359879 opened this issue 8 months ago • 17 comments

image

314159265359879 avatar Dec 01 '23 09:12 314159265359879

@kyranjamie I know there are some folks eagerly waiting on an update in this case. I was wondering if you know more already.

314159265359879 avatar Dec 06 '23 20:12 314159265359879

Sorry @314159265359879, I haven't had a look at this one yet. Adding some time to my calendar to investigate tomorrow.

kyranjamie avatar Dec 06 '23 20:12 kyranjamie

Listing on magic eden there seems to be a similar issue (Chrome latest, wallet 6.18.0)

When initiating listing an ordinal on the site the first thing to pop up in the ledger display is "non-default sighash"... image after proceeding on ledger and signing: "the operation on device was rejected" error is displayed. image

The Ordinal is on the standard index (zero). I retested it with a regular text inscription.

User shared more exact step sequence to reproduce:

Open leather extension Connect ledger Change account to account 2 - BTC segwit has BTC in it, taproot has ordinals in it Connect account 2 to ME Select list ordinal Press 'confirm' Press 'connect bitcoin' *on ledger - get message > "Non-default sighash" > "reject if not sure" Press 'continue' Confirm output Receive message on extension "The operation on device was rejected"

314159265359879 avatar Dec 11 '23 10:12 314159265359879

@314159265359879 when troubleshooting ledger issues, please try to ascertain what Bitcoin Ledger app version they're using.

I'm seeing this response back from the device:

{
    "name": "TransportStatusError",
    "message": "Ledger device: Invalid data received (0x6a80)",
    "statusCode": 27264,
    "statusText": "INCORRECT_DATA"
}

I have a feeling this may be some limitation of the device, but I'll dig deeper to try and figure out what exactly causes it to break. Maybe it's a ledger app bug.

kyranjamie avatar Dec 11 '23 10:12 kyranjamie

The user had bitcoin ledger app 2.1.3 that is also what I retested with.

314159265359879 avatar Dec 11 '23 10:12 314159265359879

@kyranjamie any updates here about diagnostic info or next steps?

markmhendrickson avatar Dec 15 '23 06:12 markmhendrickson

Users using a Ledger device with their wallet to sell SRC20 tokens also run into this error on stampscan.xyz and openstamp.io. Attempting to transfer SRC20 through these dapps leads to the same error:

image

Buying SRC20 does work as expected on these dapps.

314159265359879 avatar Dec 16 '23 12:12 314159265359879

Ledger devices have limitations that software transactions don't. I never tried buying SRC-20, but I'm not surprised it doesn't work, given earlier experiences working with these devices.

I think the best place to start here is simply failing better. I'd like thoughts/ideas on how we can improve the experience, even when it doesn't work. Some ideas:

  • Custom error warnings on known-failing apps
  • Error messages suggesting they contact the app's support team (makes noise)
  • Some earlier expectation setting that Ledger isn't guaranteed to be 1:1 with software

kyranjamie avatar Dec 18 '23 09:12 kyranjamie

@314159265359879 What's your latest sense of this bug's urgency level? It's P1 but I suspect P2.

markmhendrickson avatar Feb 07 '24 11:02 markmhendrickson

The current workaround is to send the ordinal to a software wallet instead and then list it from there. There is no workaround for this issue when the user only wishes to list with Ledger on these marketplaces.

If the fix for this is to add error messages, that is not ideal for the user, they'd prefer to have the ability to sign the transactions with their device but I do think it is a good idea to warn them about this as soon as possible. Perhaps even when they set up Leather with a Ledger to tell them about some of the current limitations.

Listing & sending SRC-20 (and stamps?) is also rejected, tested on openstamp.io and stampscan.xyz.

Is there anything the marketplaces can do to make signing these transactions on a hardware device possible?

314159265359879 avatar Feb 25 '24 20:02 314159265359879

Might be fixed with: https://github.com/leather-wallet/extension/pull/5110

fbwoolf avatar Mar 21 '24 14:03 fbwoolf

@314159265359879 can you or @DeeList QA to see if fixed?

markmhendrickson avatar Mar 26 '24 12:03 markmhendrickson

A user who was trying to list an ordinal on gamma tested #5110 and it didn't fix their issue. They are getting the same error message as the current wallet. On the ledger device the error is « non default sighash » and then on screen: image

314159265359879 avatar Mar 27 '24 15:03 314159265359879

@kyranjamie @314159265359879

Users get a sighash warning, but that shouldn't be an issue that's erroring out. It just says that it's not a default one.

I think this is the part the transaction fails on, during the confirm transaction step:

if (st->inputs_total_amount < st->outputs.total_amount) {
    PRINTF("Negative fee is invalid\n");
    // negative fee transaction is invalid
    SEND_SW(dc, SW_INCORRECT_DATA);
    return false;
}

https://github.com/LedgerHQ/app-bitcoin-new/blob/2.2.2/src/handler/sign_psbt.c#L1327-L1335

When trying to sign a transaction with total inputs amount less than total outputs amount, it fails.

I don't think that's something we can fix ourselves.

edgarkhanzadian avatar Apr 19 '24 07:04 edgarkhanzadian

That makes sense, so this is then a bug with coinselection? we shouldn't be trying sign a tx with a negative fee 🤔

kyranjamie avatar Apr 19 '24 11:04 kyranjamie

@edgarkhanzadian to create issue with request for support in https://github.com/LedgerHQ/app-bitcoin-new

We'll also reach out to related app teams

markmhendrickson avatar Apr 22 '24 14:04 markmhendrickson

@edgarkhanzadian have you been able to create an issue in the above repo, and if so, mind linking here?

markmhendrickson avatar May 14 '24 11:05 markmhendrickson

Retested Sending SRC20 still fails. Tested on stampscan.xyz and openstamp.io

Sending Stamps with Leather in hardware mode does work. Tested on openstamp.io

314159265359879 avatar Jul 11 '24 20:07 314159265359879

@314159265359879 I've updated the title of this issue accordingly.

markmhendrickson avatar Jul 12 '24 09:07 markmhendrickson

This issue may also cover listing issues which fail for Stamps, Ordinals, SRC20, BRC20 and Runes alike.

It is not clear to me if the root cause is the same. SRC20 sending is the most acute need because when we have that at least users can send them to a software wallet to list.

314159265359879 avatar Jul 12 '24 11:07 314159265359879