bitcoinbitcoin-testnet

Bitcoin transaction (testnet) submit fails


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


Solution

  • 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.