0

Error (when sending)
error code: -26
error message:
64: non-mandatory-script-verify-flag (Non-canonical DER signature)

Transaction 010000000001020dcc23ccdb3665779a7657577cd33c5c0660e969ea2ffaf5438c58306ebc9dd201000000fd880100473044022075e1c8751f948b71a79e864040b8e9698e257f0dd65acb3cb6da852a1da8d96602204767d05ac1b75e1f85963c117e51cc8869711e1fe307b51cfdd7763b39e38aa9014730440220647678c47d4a4be2a5f70044e4cf5bf547fb513311401819a114e5a1e72e642002204e9f3847cb2789493446b96dce62acb7abdad06655aefef084bb0d6a49bc99c001473044022079be75240f2a1519559fc3eacfdbeee123403466879d720b9e7f68a45a2b3bef0220585ea1c34766d57e54103ec5102c8fd0925ee2bc1a847797176da9e878d21448014cad53210289d20d3d6e36f28537af3521ce05548fb16baf7d47ac67fbf318db6ed983b9ba21034712e706c1643ec0e9519edf093578886bac1c9c17893138a76111d9a14a2f1b2102a21047ac1a83c8cce21475240b2107a11d76212573a86f0dffe44cdd326f4dab2103430166298971c6282241ef46e866fa9077b4a48eafe4b370e94aef24050dda13210329446142884a33e6100603c6eead5300ec5cf438437f8374ea76dda2daced12855aeffffffff49508924c21b25ee2ff6aed61ccc202793aa992d3e033f12f2bf4a94d6346d0100000000232200207677cf0e71ff26dc2ac7e6b93a5f6b893d39c05a1367ca100cde7a62713ddb4affffffff0240420f00000000001976a9140d7ca1e17524d6c96209cf503fb053613cecf8f688acc0b606000000000017a914fa1cee87827866df00431b5c9a3506b5e31ef4ed87000500473045022100cd569e7f8e5fb6490ef3240d68abdd147f0c3ce4e77bcfd59f587b9a14848bdb02207fe31882d22518af84d3961809b6133c06b34ce6f91c1e579dcff0c58b7519d347304502210099699d11f3fa427c2739580de08fc3a305202a6b1f39c01d8f82e6ad8a9b191902205153041c9a291b81c3ef94cba9d22f3a8df6ee45faab13407ec8a56843051043483045022100b57e36875906add1edeb57badc92f5b4287f9e33b609fad5ae35912cdc0596ff022073338c6e14637dfc11abdb18c2396a58b8e537670d06084981799f64bcd7c3f401ad53210289d20d3d6e36f28537af3521ce05548fb16baf7d47ac67fbf318db6ed983b9ba21034712e706c1643ec0e9519edf093578886bac1c9c17893138a76111d9a14a2f1b2102a21047ac1a83c8cce21475240b2107a11d76212573a86f0dffe44cdd326f4dab2103430166298971c6282241ef46e866fa9077b4a48eafe4b370e94aef24050dda132102c877ef10e8dc5ca83f06263971f133f71e01e9b2a91a4184eb730026f2c3968f55ae00000000

Question
What is wrong with the signatures here?

My thoughts and a bit of context
So basically we have two inputs here. Both are from multisig addresses. The difference is that the second one is just P2WSH. The first one is mostlikely fine. The second one is my concern. So let's look at witness signatures for the second input.

We have three signatures:

  • 3045022100cd569e7f8e5fb6490ef3240d68abdd147f0c3ce4e77bcfd59f587b9a14848bdb02207fe31882d22518af84d3961809b6133c06b34ce6f91c1e579dcff0c58b7519d3
  • 304502210099699d11f3fa427c2739580de08fc3a305202a6b1f39c01d8f82e6ad8a9b191902205153041c9a291b81c3ef94cba9d22f3a8df6ee45faab13407ec8a56843051043
  • 3045022100b57e36875906add1edeb57badc92f5b4287f9e33b609fad5ae35912cdc0596ff022073338c6e14637dfc11abdb18c2396a58b8e537670d06084981799f64bcd7c3f401

First two are generated by hardware wallets. The third one is created by Bitcoin Core. So basically each of these signatures claims to be 0x45 (69 bytes long). But the third one has additional 01 at the end.

Questions
Is this the reason of the error?
If not what is this additional byte?
Any clues what is wrong with this transaction?

1 Answer 1

1

The "01" byte at the end is the sighash type byte (specifically, 01 means SIGHASH_ALL, indicating that all inputs and outputs are signed). Such a byte is required for all signatures in Bitcoin scripts (both in legacy and segwit signatures). However, that byte is part of the DER-encoded signature; it's appended to it.

Presumably your hardware wallet produces the DER signature without the sighash type, and whatever software you use to construct the actual transaction is responsible for adding it.

1
  • I assembled this transaction manually, and it was my fault for not adding sighashes to the signatures. The transaction is still wrong, but at least a different error occurs :) Seems that the generated signatures are just wrong. But your answer solves the problem described here. Thank you.
    – Jubert
    Nov 20, 2020 at 14:08

Your Answer

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

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