vbuterin / pybitcointools

SImple, common-sense Bitcoin-themed Python ECC library
1.3k stars 861 forks source link

Value of scripthash_byte in script_to_address() #35

Closed LaurentMT closed 10 years ago

LaurentMT commented 10 years ago

Not sure about this but should we not use 196 instead of 192 for the value of scripthash_byte in script_to_address() ? (https://en.bitcoin.it/wiki/List_of_address_prefixes)

Done some tests to generate a P2SH address and send some coins to this address with Bitcoin Core:

priv1 = sha256('This is a private key 1') pub1 = privtopub(priv1) priv2 = sha256('This is a private key 2') pub2 = privtopub(priv2) script = mk_multisig_script([pub1, pub2], 2, 2) multisig_addr = p2sh_scriptaddr(script, 196) # 2N55f5BcsXWZYWLF9S1NBPdjwkmToBcJaYT accepted by bitcoin core multisig_addr2 = p2sh_scriptaddr(script, 192) # 2LTjF8kRigni3EbgoLL2uT8eoEkS2PbGbMF refused by bitcoin core

vbuterin commented 10 years ago

Yep, my mistake. Pushed commit to fix.

LaurentMT commented 10 years ago

Thanks for the good work !