vbuterin / pybitcointools

SImple, common-sense Bitcoin-themed Python ECC library
1.28k stars 856 forks source link

canonical length marker at the end of #147

Closed samnet closed 7 years ago

samnet commented 7 years ago

I am confused about the end marker at the end of signatures (in my case, individual sigs for a Tx that spends a P2SH) in pybitcointools:

pybitcointools: 304402204dae851c29a117383c5c535086a7fe899c9c5f0d927a4e680498fdd9b244cb15022058fea40a9f8c3988b17556fceacdce063860057fd8c6ad84de40515d287758dd**01**

Bitcore: 304402204dae851c29a117383c5c535086a7fe899c9c5f0d927a4e680498fdd9b244cb15022058fea40a9f8c3988b17556fceacdce063860057fd8c6ad84de40515d287758dd

These are two same signatures (i.e., same Tx, input, private key). Only, in pybitcointools' implementation, you have a 01 at the end. Why?

rgds

wizardofozzie commented 7 years ago

@samnet the 01 means SIGHASH_ALL. Whilst DER encodes r, s only, Bitcoin Txs always have the hashcode appended to the DER