leather-io / extension

Leather browser extension
https://leather.io
MIT License
294 stars 141 forks source link

PSBT with an ordinal taproot script path is not signed #3742

Closed radicleart closed 1 year ago

radicleart commented 1 year ago

Hey!

I am trying to get the PSBT below signed but it is passed back unchanged from the wallet after openPsbtRequestPopup. The actual PSBT is below.

The commitment to the script paths is the 0th output of this tx: c693c22a8caf9ca83637ea67c3734e66de6916547f38d0a445008d3a6d8c6416

The tap leaf script I'm attempting to spend is;

pubkey op_checksig

where pubkey is my ordinal pubkey (userData.profile.btcPublicKey.p2tr) with the first byte removed (the 32 byte x only part).

Note: I've used btc-signer to make this work with a custodial key pair. Miller's code does a byte wise compare of each script - trying to find the pubkey. If found it provides the signature and a finalizable tx - see this tx: 47e334fa40a9e31f0c465718eb94526064c7548196b1ee386ab15d6333ceadec.

The PSBT (hex / base 64);

70736274ff01005e020000000116648c6d3a8d0045a4d0387f541669de664e73c367ea3736a89caf8c2ac293c60000000000ffffffff01541d00000000000022512070647801ee86cb36db1ab41f12ed7365545c3cd51839ae6732f5a9f99114274700000000000100ea020000000001018cc6fdc06cd1ffddf7ebdeab6d6332be11de1479fff9816fad5da4c44ed93cbc0000000000ffffffff02481f0000000000002251205e94f6ea8eb7957b06a3869eb8f2aad8dcfe52e6fdf608187825a1d01036c7d1249b050000000000160014ea2e0ac83568ab8c6a2b4e3908914546f3c53cc7024730440220694098941f822a9a65cd889b1be573f5cf1b792e68438fb4b1362b38827f037c022046cd83d3795e84b0a50916be3b80f0c812f3eb89d2234c3dfd1a1b559af859f9012102c0642636af6947dde337b1ea2bbe9cc142ec426ffac72ff73b7dc7afa99ac912000000004215c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac00d351abcbf3c02fc796116394725b850c9e9440da14150a844e320f470f3e98146213c051aea4549ffff9845cd298947db226d875f0b8ad8cd000000001388000000007520264bd0d3bd80ea2da383b0a2a29f53d258e05904d2279f5f223053b987a3fd56acc04215c050929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0ab123dbf6a724c5cbd7144962bd17befb4d8f7d81ed83ddef2f9b90a84897cc6232036f903d2602d826f18d57f396fcdc3d6ee251162a418b99d0a55df5b50992028acc0011820be2ba230418e78cb508f1f434789f303f2fe3cda012206b270b4c91bba3b35c70000
cHNidP8BAF4CAAAAARZkjG06jQBFpNA4f1QWad5mTnPDZ+o3Nqicr4wqwpPGAAAAAAD/////AVQdAAAAAAAAIlEgcGR4Ae6GyzbbGrQfEu1zZVRcPNUYOa5nMvWp+ZEUJ0cAAAAAAAEA6gIAAAAAAQGMxv3AbNH/3ffr3qttYzK+Ed4Uef/5gW+tXaTETtk8vAAAAAAA/////wJIHwAAAAAAACJRIF6U9uqOt5V7BqOGnrjyqtjc/lLm/fYIGHglodAQNsfRJJsFAAAAAAAWABTqLgrINWirjGorTjkIkUVG88U8xwJHMEQCIGlAmJQfgiqaZc2Imxvlc/XPG3kuaEOPtLE2KziCfwN8AiBGzYPTeV6EsKUJFr47gPDIEvPridIjTD39GhtVmvhZ+QEhAsBkJjavaUfd4zex6iu+nMFC7EJv+scv9zt9x6+pmskSAAAAAEIVwFCSm3TBoElUt4tLYDXpel4HiloPKOyW1Ue/7prOgDrADTUavL88Avx5YRY5RyW4UMnpRA2hQVCoROMg9HDz6YFGITwFGupFSf//mEXNKYlH2yJth18LitjNAAAAABOIAAAAAHUgJkvQ072A6i2jg7Ciop9T0ljgWQTSJ59fIjBTuYej/VaswEIVwFCSm3TBoElUt4tLYDXpel4HiloPKOyW1Ue/7prOgDrAqxI9v2pyTFy9cUSWK9F777TY99ge2D3e8vm5CoSJfMYjIDb5A9JgLYJvGNV/OW/Nw9buJRFipBi5nQpV31tQmSAorMABGCC+K6IwQY54y1CPH0NHifMD8v482gEiBrJwtMkbujs1xwAA
markmhendrickson commented 1 year ago

@fbwoolf thoughts here on whether it's probably wallet-side or dev error, and if the latter, have we seen any similar reports with known resolution that we could share / document?

fbwoolf commented 1 year ago

@fbwoolf thoughts here on whether it's probably wallet-side or dev error, and if the latter, have we seen any similar reports with known resolution that we could share / document?

I haven't seen anyone else report this not working. I would suspect the PSBT is not built correctly when passed to us? Might be worth referencing an implementation by another app that is working? Would be helpful to know the console error returned by the signer lib if the inputs aren't being signed.

radicleart commented 1 year ago

It could be error my side - especially if stripping off the first byte to get the x-only pubkey is incorrect? I have a work around so it's not pressing. From memory were no errors in the console - the psbt was returned unchanged.

fbwoolf commented 1 year ago

It could be error my side - especially if stripping off the first byte to get the x-only pubkey is incorrect? I have a work around so it's not pressing. From memory were no errors in the console - the psbt was returned unchanged.

Could it possibly be related to this? https://github.com/hirosystems/wallet/issues/3770

@kyranjamie do we strip the first byte?

radicleart commented 1 year ago

Could it possibly be related to this? #3770

It could be - I was aware of this behaviour but I'm not able to confirm either way right now so happy if you want to close this issue.

markmhendrickson commented 1 year ago

Note we'll add more error handling that should help catch cases like this one here https://github.com/hirosystems/wallet/issues/3804