Closed snare closed 10 years ago
Hello @snarez, great thanks for the pull request. I haven't found any documentation about the Litecoin protocol, the protocol (messages and field formats) are the same of the Bitcoin protocol ? I ask this because if they are different there will be more changes to support it and this merge can cause a problem when a different message format arrives.=
Yeah the protocols for altcoins are generally a direct clone of the original Bitcoin protocol. I haven't looked at anything apart from Litecoin and Dogecoin, but they both seem to work OK without modification apart from the magic number. If there are any protocol differences I think it will be fairly easy for people to subclass the existing packet classes and monkey patch things to make it work. I'm working on something at the moment that will talk to a lot of altcoin networks so I will see how it goes and submit further pull requests if there are other areas that require generalisation in order to support other coins.
I'm currently adding other coins by this hackery:
ALTMAGIC = {
"dogecoin": 0xc0c0c0c0
}
protocoin.fields.MAGIC_VALUES.update(ALTMAGIC)
So this is probably an area that could be generalised (or at least wrapped in some configuration functions), but I'll tackle it down the track if it seems worth it. This method will work for now. Great work on protocoin :)
Thanks for the reply @snarez, I'll merge your changes and then later I'll generalize this. Thanks for the contribution !
This small patch makes it easier to build clients for other altcoins based on protocoin. Here is a sample Litecoin client based on the provided examples:
To add other altcoins we'd just need to add to the MAGIC_VALUES dict.