2

I am trying to create a simple native segwit transaction on bitcoin testnet but it is failing on submit with RPC error -26 which based on the source code is this: RPC_VERIFY_REJECTED = -26, //!< Transaction or block was rejected by network rules

I have created the transaction using PSBT, signed all inputs, finalized and extracted transaction hex which is what I am submitting via HTTP POST to https://blockstream.info/testnet/api/tx

Here is the signed transaction:

020000000001024aa98a288909cd44fa7abfb3418cacec2978fd41270b7d6917f0b8fecf92d8e80100000000ffffffff8e4777141e8f81b56237980e0380a79432ec3b82862deb34d5ff3efc701b01f80100000000ffffffff01e80300000000000016001472b11f9b893032a316151b457d51614d5be4c2120247304402200e00725946a9d176649d247644626c75d33c2e08566fb735ef036b25d54b9e15022035da9eb7ed15ae036bea2cb01ad0f2d0291c5612abd039fa84b0c4e11265352b0121036123e7fc019fd0883f5957bd47ce1273d28ed950407c1a6686e86d4d3b00405302483045022100a72f331387f666b357fe96eab028b64dcf542d7b07ac326527ab3e4da7d57233022024944bcd1b4eea97657e145f79cbaf819681409a219224fe696bcdf1b8fd39f50121036123e7fc019fd0883f5957bd47ce1273d28ed950407c1a6686e86d4d3b00405300000000

I did try to decode & verify here https://live.blockcypher.com/btc/decodetx/ and as far as I understand the native segwit format, it looks right. But then I must be missing something. Any pointers would be appreciated

3
  • You are using the same public key to spend two different outputs from two different prior transactions (both P2WPKH) - is that right? And those two prior outputs sum to >1000 satoshi? Commented Oct 5, 2023 at 12:16
  • Does this answer your question? Error 26: mandatory-script-verify-flag-failed (Data push larger than necessary) Commented Oct 5, 2023 at 12:38
  • Thanks @RedGrittyBrick for your suggestions. I am just sending my own UTXOs to myself for test (minus the fee). No problem with that. The problem was that my signature was incorrect. The API for SignerAsync.sign calls the first argument 'hash' so I assumed that my ECDSA signer was receiving precomputed hash but I needed another sha256. Now it works fine. Commented Oct 6, 2023 at 10:05

1 Answer 1

2

The problem was that my signature was incorrect. The API for SignerAsync.sign calls the first argument 'hash' so I assumed that my ECDSA signer was receiving precomputed hash but I needed another sha256. Now it works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.