Author

Topic: SOLVED [Why are my generated transactions non-canonical?] (Read 1211 times)

hero member
Activity: 714
Merit: 601
**snip**

My best guess is that coinb.in isn't actually verifying the signature.  I can see that  it "decoded" the transaction and it has a check next to "signed".  But, alas, I'm not familiar with this interface, perhaps it turns green or something if the signature is valid?  Did you go back to try the coinb.in again after you figured out the error?  I'm curious what you found.

That is correct, coinb.in's verify page will just check to see if a signature exists not if its valid or not. Hope this helps.
newbie
Activity: 17
Merit: 0
It works now: https://blockchain.info/de/tx/64d45ef207f6b283540db006bf6ddd43a1c312ca826e08336053fe7f6bab0b8a (my first transaction signed with my own library Smiley )

The txs produced now look like this:

Code:
0100000001883971b9025799b61040fdd0bc516a4c631f8753f689962fc72980de4f2aabc8000000006b483045022100f24f95da3b0df769a79af676c6d0cbd781fa7c0d04be1712c3b148b53472fad702200dc0b3635bba2a0af15104d86ef86ccc74811287184956aa4b612e041e5a5ace01210340af8583e795691debf6331605a444a1bd2ae3e3978b38ff1d2c7f69443b6c01ffffffff01905f0100000000001976a914b7675e0b90a09cb97674702be07b119c989b835088ac00000000

Code:
01000000  		version
01  number of inputs
883971b9025799b61040fdd0bc516a4c631f8753f689962fc72980de4f2aabc8 reverse hash
00000000 prev. output number
6b size of scriptSig


48  push data 72
3045022100f24f95da3b0df769a79af676c6d0cbd781fa7c0d04be1712c3b148b53472fad702200dc0b3635bba2a0af15104d86ef86ccc74811287184956aa4b612e041e5a5ace01 sig + hash all
21  push data 33
0340af8583e795691debf6331605a444a1bd2ae3e3978b38ff1d2c7f69443b6c01 pubKey


ffffffff  sequence
01 number of outputs
905f010000000000  value
19 scriptPubKey size
76a914b7675e0b90a09cb97674702be07b119c989b835088ac scriptPubKey
00000000 locktime

So it seems to work now. I don't know what went wrong with the pubKey (I'm using openssl for all the crypto. Thx to all Smiley
full member
Activity: 217
Merit: 259
The pubkey in the scriptSig looks also strange:

0440af8583e795691debf6331605a444a1bd2ae3e3978b38ff1d2c7f69443b6c01

33 bytes (compressed) but starts with 04 indicating uncompressed.
legendary
Activity: 1456
Merit: 1081
I may write code in exchange for bitcoins.
Hi,

I'm writing a c++ library to sign Bitcoin transactions (you can find it here: https://github.com/sgeisler/EasyBitcoin).

I tryed to send a transaction from 1HikVCL5PsR75toN23yEifLqmg8uXAepoz to some other address. At the moment only the code to sign the input is implemented, so I first created a raw transaction with coinbin and then replaced the unsigned input with the signed input generated by my script.

Code:
0100000001883971b9025799b61040fdd0bc516a4c631f8753f689962fc72980de4f2aabc8000000006a47304402207a57c1db269e2ab4706279309a4d1d91112478d92132c2580d4b6f21670dce0502200590c8be6be1616c41db4663800c3b3d9d36ffa0e4d1c7b08082b0b00f679f9a01210440af8583e795691debf6331605a444a1bd2ae3e3978b38ff1d2c7f69443b6c01ffffffff01905f0100000000001976a914ed25801aa39644aaa7fcef2944ba200e05e615be88ac00000000

Coinbin shows it as signed when I try to verify it: verify at coinb.in

But when I try to broadcast it it shows:
Quote
64: non-canonical

I don't know what I'm doing wrong. I mainly followed this tutorial.

Do you know if a bitcoin transaction debugger exists?

It would be great if you could help me Smiley


EDIT: I think I've found my error, I'm only hashing the input and not the whole tx (silly me), will try to hash the whole tx. But why did coinb.in accept the signature if it wasn't correct?

My best guess is that coinb.in isn't actually verifying the signature.  I can see that  it "decoded" the transaction and it has a check next to "signed".  But, alas, I'm not familiar with this interface, perhaps it turns green or something if the signature is valid?  Did you go back to try the coinb.in again after you figured out the error?  I'm curious what you found.
newbie
Activity: 17
Merit: 0
Hi,

I'm writing a c++ library to sign Bitcoin transactions (you can find it here: https://github.com/sgeisler/EasyBitcoin).

I tryed to send a transaction from 1HikVCL5PsR75toN23yEifLqmg8uXAepoz to some other address. At the moment only the code to sign the input is implemented, so I first created a raw transaction with coinbin and then replaced the unsigned input with the signed input generated by my script.

Code:
0100000001883971b9025799b61040fdd0bc516a4c631f8753f689962fc72980de4f2aabc8000000006a47304402207a57c1db269e2ab4706279309a4d1d91112478d92132c2580d4b6f21670dce0502200590c8be6be1616c41db4663800c3b3d9d36ffa0e4d1c7b08082b0b00f679f9a01210440af8583e795691debf6331605a444a1bd2ae3e3978b38ff1d2c7f69443b6c01ffffffff01905f0100000000001976a914ed25801aa39644aaa7fcef2944ba200e05e615be88ac00000000

Coinbin shows it as signed when I try to verify it: verify at coinb.in

But when I try to broadcast it it shows:
Quote
64: non-canonical

I don't know what I'm doing wrong. I mainly followed this tutorial.

Do you know if a bitcoin transaction debugger exists?

It would be great if you could help me Smiley


EDIT: I think I've found my error, I'm only hashing the input and not the whole tx (silly me), will try to hash the whole tx. But why did coinb.in accept the signature if it wasn't correct?
Jump to: