Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: thebitcoingirl on June 25, 2020, 11:03:15 PM



Title: (Non-canonical DER signature)
Post by: thebitcoingirl on June 25, 2020, 11:03:15 PM
I can't push this transaction. Always getting Exception: Code: -26, Error: mandatory-script-verify-flag-failed (Non-canonical DER signature)

Any idea of why?

Code:
0100000068982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e857233e0e000000008a47304402200b9788f351398c58cddf793d6cf85685ea766d3972ad92c8875a25eaaf193816022027b38e6f6d2af25d5628dd6bb6aa60f9f2381dedaec56b28a2a0615b41e5d8ef014104e864551075641b129b4e8e9aa843a81f0c35dea6825f3c3311935c9686ee12b174bf8e3a8d90cdb473527fb9ed21c19bc57ac399ecce5a380c5422085b65e5a4ffffffff520cae06673fc6950fdb2a2cba32f63b50fe99ce2d8469cfc3ddedf6cc34bed601000000fdfd0000483045022100dfcfafcea73d83e1c54d444a19fb30d17317f922c19e2ff92dcda65ad09cba24022001e7a805c5672c49b222c5f2f1e67bb01f87215fb69df184e7c16f66c1f87c290347304402204a657ab8358a2edb8fd5ed8a45f846989a43655d2e8f80566b385b8f5a70dab402207362f870ce40f942437d43b6b99343419b14fb18fa69bee801d696a39b3410b8034c695221023927b5cd7facefa7b85d02f73d1e1632b3aaf8dd15d4f9f359e37e39f05611962103d2c0e82979b8aba4591fe39cffbf255b3b9c67b3d24f94de79c5013420c67b802103ec010970aae2e3d75eef0b44eaa31d7a0d13392513cd0614ff1c136b3b1020df53aeffffffff73a38f37eaa75a85d3183e3fca81e2cb3f2f8216618a0ddcb257a5d0bf7926cb00000000fdfd0000483045022100dfcfafcea73d83e1c54d444a19fb30d17317f922c19e2ff92dcda65ad09cba24022001e7a805c5672c49b222c5f2f1e67bb01f87215fb69df184e7c16f66c1f87c290347304402204a657ab8358a2edb8fd5ed8a45f846989a43655d2e8f80566b385b8f5a70dab402207362f870ce40f942437d43b6b99343419b14fb18fa69bee801d696a39b3410b8034c695221023927b5cd7facefa7b85d02f73d1e1632b3aaf8dd15d4f9f359e37e39f05611962103d2c0e82979b8aba4591fe39cffbf255b3b9c67b3d24f94de79c5013420c67b802103ec010970aae2e3d75eef0b44eaa31d7a0d13392513cd0614ff1c136b3b1020df53aeffffffffe3055c5ea1ce034a6d01c4096cd3da87ddeae69e915e6e05177f985a370bdfdf0100000000ffffffff24fe20d2434ec1f2a0fd02fa7a4be629ad48ff76da7316bb4e7fb1ebadf987fd0000000000ffffffff1c73efeb6333e673e34aec19b484ace0bd59384a47e112cb2a003732cae0eb360100000000ffffffff1d463b99f7a0d6ad1f3575ec90feedc33cd27f71a24afdbc8d3b05cc87ab58d60500000000ffffffffe7df71fe75cdb52fecdbe8f7413c07efc3d268fece90de98435de69d6701d9ff0000000000ffffffffa247f4474405dc818f15d3ae3a16c2c55cd42755ce36c3d391249f2fd4dd6da60000000000ffffffff8d9e04e219a767e7689f0402444b32d6082cfdd1a52256672f553f46b1f65e065600000000ffffffffcbf84763b7f1f196b552b4b6892d58e99d23d391b1946886c7f5ad8b006da3ce1f00000000ffffffff2a1e3a0174985b1a042480e2ccc208e6058ca8484e14debebe2c1aa502f9a6a30000000000ffffffffbec6aa40a602519d5b667b0565441edb10ce135fe639f16e79a59e30087a08240000000000ffffffff2e1204911a6174d68c27a796617090cc4adfaad079a0c98f16ccb9b6741cb2910000000000ffffffff71d696751326fe75c23fc6a1587dc937238ca122ce4f8092447891768635021b0000000000ffffffff83b536348dc4489f951728c01d48430a742c2397b0fc0d649e4bbba8e6c5667f0000000000ffffffff695f532b7f90da271ed809f22e9d60d2a0ac043d6186f02321cae2afb697a7ab0100000000ffffffff4c15c43b99033c00e5502c0d833aa527427ef38aea0fa4a6dcae8367c5f9d9ea0000000000ffffffff9c296ab4175c05de03a99e1716fdd47a309aa0949e8593d5c994216c9f9fbea60000000000ffffffff341d31fd0367abce245b3b474c4d7895841a7bb2774982440149d34f88b2c5b40100000000ffffffff8e6e7294de189acec7363eda58a65f58882cf69e7a34f16f1e4524d408cce9820000000000ffffffff7ab9487f21e625638ba362a73438e8414af10721505b4172729d23dfbf6010570000000000ffffffff834bad16090252534a0ff1959225338d902ca7002192ffadf64f07768e648a260100000000ffffffff00031b45957ea8c66df99e88ea8ceef28f3d426fba01a3381fb54c92a106a9f70000000000ffffffff5f833f6015b284926b7e30eedf9ae2bbcff1a244e62caa7288d273cb93ac0eca0000000000ffffffff31b58a61b9830991bd21312186bef160dbe56438e39c6059c231c07861eeab0c0000000000ffffffff0922171fc9ae5a6cbe66d0d422e1ad5be966d2872934288bd95ae1a12489d7dd0000000000ffffffff704b8ea7ab7a67ec8e24468aa225d0059882c738289bb75f48a4429f544b48560000000000ffffffff4e577fbfc22a4a75c4ff3145d91412d05f1bded8f1a5fca4b69187ab07a8ef9f0000000000ffffffff01176649afa36c770195d4b325c7f7fe16d7c8c67ca7227fd91444b4586c4c720000000000ffffffff913eb0c8029004c18fded9aeab8d4608af9676af214048ae1f2cf6404ee71d220000000000ffffffff968a5ad4513b13d7b8f0dc5800433bfa50d6e1613883800f879bd4f041b8acb40000000000ffffffffbe98f1c65adaa6192707fe134d95e0c1d82f05dd3cfa85b02b83a9b34fc4d51d0000000000ffffffff2ecf44fc626226adca78e134fd7ac0d58f899333ebba1634be3cf9f934b5e2eb0000000000ffffffffbe1d67a453332b7526c7557d7339926b857e761494dff20ad87cf3f5ee50f88a0100000000ffffffff32ec5146e272f70804560a79f898c72b32fa6e37652489a54057e91b7aae950c0100000000ffffffff335c358deddd181bcc1a0268d6fa5db9440c39026a05fa403fd00973349132560100000000ffffffffc75b2af2cec71292d1984cffd9097251708063d9e5bfa2bd3c1861b16dea8f3b0000000000fffffffffaa8a38f54a98b468a47b51288cc01421ddf7382449db0117fc28315283f0d250000000000ffffffff01a1075aa3e9ec53e01cd9153994b099cfc84136b880ee5717dfb981a6258b030000000000ffffffffad93695adbeeef8987dc8719afea777826f70ca7d70959fd0b9ca10724bed1990100000000ffffffff539bd1b4fa11f68845ecd41f8ad342bdc2f7c7950c638f2e98ad53769fdf62a10500000000ffffffff715419b683323e9116dcc53f8ff120fdc8d342ddd3cfc8d24c17ff23c75da4fd0000000000ffffffffcc9133d49365826b57aa05253f0b839a6eeddfcdecaa4eb640dfde38499184f60000000000ffffffff785ac0251c23cbe5d9765ccffb1014fe10a5b9ddd30abae1a266b7a80b6ce748b108000000ffffffffdc4e10fe02b184c6666c59813a4ee3bf5d0c8ad43310357a4f7aaadce06b0e0f0000000000ffffffff5a14821dd6fac533a47c270c2d7723580102cb9f860b4a9e7d92920ad3fae4320a01000000ffffffff852ceb656975413df43fb4384a0ec32f31246dae24b6dd13d39652f1d376a13b0600000000ffffffff71210c24db59ca2f239a4841d8d796769c4cc3f2e5995d7d5c4cd3c7a930684c0000000000ffffffffcde5e2545ba80c2fe0d63a9ea9c6c5f04ee17b3b0898484852f5104adf92d7a00000000000ffffffffb70aae7f89473afaf4e3eab62b404b865446629789e2c26154ed07eeeeb103340000000000ffffffff1bb6afbcf8e761aa5f3ea57fe821ab9bcb3a7aa3f6ac7771a6e422f9336791240000000000ffffffff83e5b3974141a79cf513189f78a0d7755e501bb90c49596adeae7a5d2cdef4820000000000ffffffff3cb322b49d41fe9bc3d93a9fe1370ff8f5c85b0da6619f0d4ab0848b09c2646e0000000000ffffffff90972e5a77c639a533cdc12bbd30ff8de8f16eec96d3d52c8df0a48a9440eb480000000000ffffffff0d40e29eab5479dea4e573ba8a4c74e3506e9f202d3dd8acbc17e86534eaf5440100000000ffffffffe083a7d90a75ddb850f309c1dc0df8ff8c73e8ef8bfb8eade292363b4bab8d380000000000ffffffff4e7aa32e0f6473057640b488d2719b564775b0d341be87a969a0033e30985ad00000000000ffffffffb53f17c8cf25925300bf3517bd106477cb27b43ff213303719e0f90137dc907f0000000000ffffffffc966bfc80210bf28f6f58313802e45e98735279e77b49c5eae22c9295e4b2cbc0000000000ffffffff649696a3705156993fadfbb08f21cff687a616133d052d4992b6de5610f352bf0000000000ffffffff263c4d66d221468ff688bf52eb094c0f634cbb27327e93797451f781dd41580a0000000000ffffffffe1c050608527627a4e109f2363aab8ba64b54a9ebcc612843bcd62e2f7c618520100000000ffffffff4b5446172fba78e4a49bfbec7942effd2e96b734a8a65eb189297c4b7657ff590000000000ffffffff154ec024ffc95b9509f0c61957884f7865d42029dfdca8e14324f560cb893a050000000000ffffffff5533924b7336e6892aa8385867b983c015e5eadb5d10fa4b28834e787f30373f0000000000ffffffff076ec15ed7a2757fc2ead25579a950a06b09cb68805ad3e418c5c5acc01e884e0000000000ffffffff11fe3bdcd4541c08bfe751b0be71b2c4c048e142d7d6a08e0f8bc0c0e6d5075b0000000000ffffffff1f7467d2c3a2407b6b26335558f048bb531e08866a475c40c652519f4a55374f0000000000ffffffff5eaeae83426b1e94b2b3de13e70100254bc585777a0a36f2cea210415679b6b80000000000ffffffff697f8f085b544ddc7b3a14d680bd348a0d08146d42eea31e2db8b333be1271580000000000ffffffff78967fddb80c0f8048b13ceac78b989aecd4fb6076783a20a1a836185642f5960100000000ffffffffb6c5c0ac9e91de53c61fa13e45cfad48b06d9da0af26f5d9927bf7cc440606d10000000000ffffffffa6e955b585083c963d0441cba8474be222df29cea43695135b96c3f972694f660100000000ffffffffdf2e4535e9fe02f479e58014ec26239205e0a1cef30ec823145e41539e0fff670000000000ffffffff01331197ed1d63983e7dc0c5caf3435afe5ecbc1d18e21cd8b220ed9e3cbadf40000000000ffffffff3dc2f0df02bdc038c78e0157642f23acc152615990000a847edb4be57791f79f0000000000ffffffffcb8d953f4c812ecc7ef0f3a6e200076a0b452f16951bd67422f9805df5ee82720100000000ffffffffeed41d0fdeab3712d181f82d5a3a6d546d4454b9dc2f0d63e2a597b580874fd00100000000fffffffffdcb7cab62e57ed110c0b97155dac92865afbb97ab802da616510d1a843eb3700000000000fffffffff38d231be9ee2389c562972436af546b359d207b02525c5188acb3dee42204210000000000ffffffffce0166d08d67c2ced695aeb56c99c21fdf43e54827269e1472af9cef2067718f0a00000000ffffffff06fcadf8615542b379778e0814b337528f05ea921497d5ef0a7b0e77cd79ce240e00000000ffffffff68d52e9bf0c0cf97ec46d7334d08b16adf6af8abc0eec06e751e194c1a641c720000000000ffffffff83300127a986e29cccd6117adaefb85f4755ec7dafd144cc6439199388df76fa0000000000ffffffff55cd43a985ef2ddc1185f3ce15ed6049bb29cca6f1de4b3f9f1c76e8a98632300000000000ffffffff2246f32dd8ff901c4e67860e5e5279c4ade43a074879d26aa9a49f9fd6c26bc50000000000ffffffff1938eadae5a514a7a0efe991a6ae93b8135dc946e496c9d6cb80d713038a45b90000000000ffffffff2e0f087764d158db5d34900a23fc929fada6d1eca8b2800b7950c6a2b51c09900100000000fffffffffc5388324e6b736a68b9e1549099315bc4701667d8f2cd87406684a90f67fa000000000000ffffffff01927ebcc856650691784bcd33d2dcec7659244bd2011202a1cf0f37a2d5c8960000000000ffffffff2930f65f7013f1c3c9f4a515143c933d5e4956bd8af5c2ea946d0fa8291b54cb0000000000fffffffff6156e1a5adf425703b2840b52617a6d19ee53878f08ebd9a357eedff1cded950000000000ffffffffdbc58eb5a2c17614b1a31c79c51229d4a9d2a20fd0d369bc154c8f242c2c557b0000000000ffffffffa9ee768c71a6d62dce77e735ee0d717c9118937db35a3a952e6d43f8c97eaf540000000000fffffffffde9e76ce14b7f8fd1f5a5fc0771d3332c8318d7d606cb5993bff324e02ed8ba2300000000ffffffffd23d879610438cf1e66a968561775bc8b95d898b3c69977a551dd2cf67701f5f0000000000ffffffff0e9dbe6dabc94721c5076e0de7794409183a4425a8902b696ccec2a832c4a1e20000000000ffffffffba3f20365c8c32e0cfd761092a326b038fa9b1067fe9bfc3c79070aa8f1b0a540000000000ffffffff0a725dc5755061f80fbd6100b0db0043ab24cfe81f71bb4218e6ad4e3479e9240000000000ffffffffbc253a9a4d9158b9b7c2f225828c9dccbed9ad273d6d324a4c226b5652452b030100000000ffffffffecd20ad9d0b674dbc8834bb7837198b25b6e9ef1408f170ca625296b5cc9f3050100000000ffffffffa6414e0516bc9ae9d613172c594eea3fd4969be4a6e05230c6cdbd3ec5f54fd90000000000ffffffffc85e797f209059d10e821f378f958be44357f8642d31f18b67fd499061d766281e01000000ffffffff01bbb5152c010000001976a9145b5af6664139a0f436093f23aba7adb5330be97188ac00000000


Title: Re: (Non-canonical DER signature)
Post by: BitMaxz on June 25, 2020, 11:18:39 PM
What wallet did you generate this raw transaction?

Did you buy a wallet.dat file from somewhere and use the wallet.dat and trying to transfer funds?

I'm also getting the error when trying to broadcast it from https://coinb.in/#broadcast and other pushTX tools.

I tried to verify it on coinb.in but as a result it's not a fully signed transaction. Use this link below to verify this transaction.

- https://coinb.in/#verify


Title: Re: (Non-canonical DER signature)
Post by: thebitcoingirl on June 25, 2020, 11:31:54 PM
What wallet did you generate this raw transaction?

Did you buy a wallet.dat file from somewhere and use the wallet.dat and trying to transfer funds?

I'm also getting the error when trying to broadcast it from https://coinb.in/#broadcast and other pushTX tools.

I tried to verify it on coinb.in but as a result it's not a fully signed transaction. Use this link below to verify this transaction.

- https://coinb.in/#verify

I am using my own wallet, generated from a passphrase. The transaction is generated through custom Python code.

No, I didn't buy a wallet.dat, I am doing some tries with dormant addresses using the SIGHASH_SINGLE vulnerability for P2PKH addresses.

The verify tool you provided correctly decodes the transaction.. What you mean by it's not a fully signed transaction? And how I can fix that?


Title: Re: (Non-canonical DER signature)
Post by: thebitcoingirl on June 25, 2020, 11:36:47 PM
Also, the following transaction shows correctly as fully signed on coinb.in but still throwing (Non-canonical DER signature) error

Code:
0100000003982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e857233e0e000000008a473044022070e9832f88e68c5393e6394e48a59c299424a48d516578ccccbe9db1c33bb0ed0220700671d28c4399dcc79d2a68d1b4b708099e393714352b920413f3b04e78e18d014104e864551075641b129b4e8e9aa843a81f0c35dea6825f3c3311935c9686ee12b174bf8e3a8d90cdb473527fb9ed21c19bc57ac399ecce5a380c5422085b65e5a4ffffffff520cae06673fc6950fdb2a2cba32f63b50fe99ce2d8469cfc3ddedf6cc34bed601000000fdfd0000483045022100dfcfafcea73d83e1c54d444a19fb30d17317f922c19e2ff92dcda65ad09cba24022001e7a805c5672c49b222c5f2f1e67bb01f87215fb69df184e7c16f66c1f87c290347304402204a657ab8358a2edb8fd5ed8a45f846989a43655d2e8f80566b385b8f5a70dab402207362f870ce40f942437d43b6b99343419b14fb18fa69bee801d696a39b3410b8034c695221023927b5cd7facefa7b85d02f73d1e1632b3aaf8dd15d4f9f359e37e39f05611962103d2c0e82979b8aba4591fe39cffbf255b3b9c67b3d24f94de79c5013420c67b802103ec010970aae2e3d75eef0b44eaa31d7a0d13392513cd0614ff1c136b3b1020df53aeffffffff73a38f37eaa75a85d3183e3fca81e2cb3f2f8216618a0ddcb257a5d0bf7926cb00000000fdfd0000483045022100dfcfafcea73d83e1c54d444a19fb30d17317f922c19e2ff92dcda65ad09cba24022001e7a805c5672c49b222c5f2f1e67bb01f87215fb69df184e7c16f66c1f87c290347304402204a657ab8358a2edb8fd5ed8a45f846989a43655d2e8f80566b385b8f5a70dab402207362f870ce40f942437d43b6b99343419b14fb18fa69bee801d696a39b3410b8034c695221023927b5cd7facefa7b85d02f73d1e1632b3aaf8dd15d4f9f359e37e39f05611962103d2c0e82979b8aba4591fe39cffbf255b3b9c67b3d24f94de79c5013420c67b802103ec010970aae2e3d75eef0b44eaa31d7a0d13392513cd0614ff1c136b3b1020df53aeffffffff01a954242a010000001976a9145b5af6664139a0f436093f23aba7adb5330be97188ac00000000


Title: Re: (Non-canonical DER signature)
Post by: BitMaxz on June 25, 2020, 11:49:18 PM
I am using my own wallet, generated from a passphrase. The transaction is generated through custom Python code.

No, I didn't buy a wallet.dat, I am doing some tries with dormant addresses using the SIGHASH_SINGLE vulnerability for P2PKH addresses.

The verify tool you provided correctly decodes the transaction.. What you mean by it's not a fully signed transaction? And how I can fix that?

I mean is what wallet you are using?

Actually, I don't have idea or have experience on generating transaction with Python code. So maybe there's a problem about the python code you are using.

Why not try to install a blockchain wallet and import the wallet you currently using or use Electrum instead and make a transaction again using this wallet. Let's see if it will go through...

I just got the idea from here "error 16: mandatory-script-verify-flag-failed (https://bitcointalk.org/index.php?topic=1455675.0)" that error is same as what I got from coinb.in.


Title: Re: (Non-canonical DER signature)
Post by: pooya87 on June 26, 2020, 02:45:41 AM
I can't push this transaction. Always getting Exception: Code: -26, Error: mandatory-script-verify-flag-failed (Non-canonical DER signature)

i don't know why you are receiving that error but it is because your transaction is not signed. it contains 104 inputs and only 3 of them are signed and the rest don't have any signature!
your first signature script is also wrong since you are putting a <sig><pub> to spend a P2PK output.
your second signature script doesn't make any sense either, you are putting a <OP_0><sig><sig><redeemscript> to spend a simple P2PKH script!

No, I didn't buy a wallet.dat, I am doing some tries with dormant addresses using the SIGHASH_SINGLE vulnerability for P2PKH addresses.
what vulnerability?! i think you are very confused about how bitcoin works.


Title: Re: (Non-canonical DER signature)
Post by: nc50lc on June 26, 2020, 04:52:10 AM
No, I didn't buy a wallet.dat, I am doing some tries with dormant addresses using the SIGHASH_SINGLE vulnerability for P2PKH addresses.
Is it based from this or something similar: http://joncave.co.uk/2014/08/bitcoin-sighash-single/ (http://joncave.co.uk/2014/08/bitcoin-sighash-single/)?
Because if you did, you totally misunderstood the article (read the first paragraph carefully); you're trying to spend a P2PK output and P2PKH outputs that you don't have the control over.

The signatures from your transaction suggest that you're following that exact article.
The redeem script that you've used is even the same as the sample transaction's (Go to "Stealing coins in a new transaction"), it's the same redeem script  :P


Title: Re: (Non-canonical DER signature)
Post by: achow101 on June 26, 2020, 04:59:24 AM
Your first input has a P2PK UTXO but you've provided a scriptSig that is for P2PKH. The error is because the script interpreter is trying to interpret a public key as a signature. The first thing it checks is the signature encoding, and a pubkey does not have a signature's encoding, so this check fails.


Title: Re: (Non-canonical DER signature)
Post by: TheArchaeologist on June 26, 2020, 06:51:38 AM
Ok, so you are trying to steal the funds (50 BTC) from the coinbase-transaction of block 1? And that didn't work out (gosh!) and now you want us to help you with your stealing plans? (Hint: good luck with that!)