stacks-network / pybitcoin

A Bitcoin python library for private + public keys, addresses, transactions, & RPC
MIT License
277 stars 117 forks source link

add support for arbitrary version bytes #15

Open Kefkius opened 9 years ago

Kefkius commented 9 years ago

Add two classes, CoinPrivateKey and CoinPublicKey, that take a version byte parameter in their constructors. Also allow WIF version byte to be specified via a parameter.

shea256 commented 9 years ago

Hi @Kefkius thanks for the suggestions and pull request. I have a few questions:

  1. Do you find the method that you've included here to be better than this:

class KefkiusCoinPrivateKey(BitcoinPrivateKey):
    _pubkeyhash_version_byte = 42

kefkius_priv_1 = KefkiusCoinPrivateKey()
kefkius_priv_2 = KefkiusCoinPrivateKey()

Here, one can create a new class for a new coin and then create new instances of the class. This is in contrast to your pull request, where you allow users to create new keys without defining a new class.

  1. In my experience, WIF version numbers are simply equal to 128 plus the pubkeyhash version number. Have you been in a situation where you'd need to explicitly set the WIF version number separate from the the pubkeyhash version number?
Kefkius commented 9 years ago

@rxl You're welcome. I see that the method you described is at least as useful as mine to a user. I made the pull request after seeing that so many coins were on "to-do" implementation status. I figured this would be an easy little hack to use, but yes, the method you described is just as effective, and may be a better option.

As for WIF versions: Yes, I've had to explicitly define a WIF version.

CLAassistant commented 4 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Kefkius seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.