Closed lenhatquang97 closed 1 year ago
Update: I know the main cause is wrong address type: Two addresses when I debug are p2wpkh and p2sh. I have changed my source code to use P2TR address. However, I also meet error in this transaction after revealing transaction.
-25: TX rejected: failed to validate input f03691956d903a9475f2cb9234e809d9e1ec2c12fc0575358553d454100fd503:0 which references output 86566ae50f44eb08da37dacca524529a6a76e4acef9f99c2f8ddadf13c00f2d2:0 - (input witness [f083c8b39d9355a107596736f224786120d0061b4583fde2d8b7b670cdb9724487e817f5b9fadda55eb5cee0d1b38aba5da79658c2474621362ce19c39b2e99a 20bbcea8ef034bd4df764f6339248091e454268446256d851aed3c50f0cf8dd74cac00630b48656c6c6f20576f726c6468 c1bbcea8ef034bd4df764f6339248091e454268446256d851aed3c50f0cf8dd74c], input script bytes , prev output script bytes 51209452f02a1041e0b3d7e3d863afb87d61e1d3ac661988541e6e88b053b3e23aeb)
Maybe start with the basics? https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch07.asciidoc#pay-to-witness-script-hash-p2wsh I would try to get a p2wsh example to work before attempting p2tr, as that is not documented that well (as in a book or easy to understand tutorial AFAIK).
Can I book video call with you about this bug? I meet some problems in creating commit transactions in my thesis. My thesis is using btcwallet for creating Ordinals-fork version (only embedding data).
No, sorry, I'm way too busy to do calls. There are lots of resources out there explaining how to do witness script spends, just mainly for p2wsh and not yet for p2tr. So maybe start there.
Ok, so I will start from this! Thank you very much
Situation
Now, I am successful in commit transactions. I want to create a reveal transaction for embedding some texts. However, I meet this problem for non-witness inputs. I want to what is the main root cause, and how to solve this problem.
Problem
-25: TX rejected: failed to parse input d48ea76bedebcaef97b0dded85af53f941f847ee3611925d71e2df6c0af0ad7c:0 which references output 9a486548987c117fb3cf73959578854b2dc9eb6f3f35507880621a369410372b:0 - non-witness inputs cannot have a witness (input witness [1b7c17fd0f2a4d80e4bde0e5e3d603f2c9a387bd7fe078edf254493f96982ed3f25f65b2642728cb5ca82132c55970ce76f720439184e4de1dc7c97fd079a338 20bbcea8ef034bd4df764f6339248091e454268446256d851aed3c50f0cf8dd74cac00630b48656c6c6f20576f726c6468 c1bbcea8ef034bd4df764f6339248091e454268446256d851aed3c50f0cf8dd74c], input script bytes , prev output script bytes 76a91488fc282bfeebc8361ef36e2372f94922e3fd427088ac)
Source code: available on https://github.com/lenhatquang97/bitcoin_nft_v2. Note on RevealTx
Btcd, btcwallet commands to run
btcwallet --simnet --username=youruser --password=SomeDecentp4ssw0rd
btcd --simnet --rpcuser=youruser --rpcpass=SomeDecentp4ssw0rd --miningaddr=SeZdpbs8WBuPHMZETPWajMeXZt1xzCJNAJ --txindex
Suggested previous solutions
I also have another clue for this problem:
I have used legacy address, so I try to change receiver address from legacy address from this of the follow:
to bech32 address like sb1qlqph0wraeh56jkuvajxm59fp80gewet84s5v4x
to p2sh-segwit address like rXFf2kofnbqQZAnPFAvdezoNL1WE1nuMxq
But I meet some problems:
Bech32 address
p2sh-segwit