From 96f7200e9e3d22a0290b6dfa2f6a0a62ee1fbe71 Mon Sep 17 00:00:00 2001 From: Vivek Teegalapally Date: Thu, 9 Aug 2018 11:10:07 +0530 Subject: [PATCH] Adding new code to accomodate FLO blockchain FLO is a blockchain which has comment feature built into it. These are the additions required in the code to accomodate it. --- pywallet/network.py | 34 ++++++++++++++++++++++++++++++++++ pywallet/utils/bip32.py | 4 ++++ pywallet/wallet.py | 4 ++++ 3 files changed, 42 insertions(+) diff --git a/pywallet/network.py b/pywallet/network.py index 339f11b..f6399be 100644 --- a/pywallet/network.py +++ b/pywallet/network.py @@ -185,3 +185,37 @@ class BlockCypherTestNet(object): EXT_PUBLIC_KEY = 0x2d413ff # Used to serialize public BIP32 addresses EXT_SECRET_KEY = 0x2d40fc3 # Used to serialize private BIP32 addresses BIP32_PATH = "m/44'/1'/0'/" + + +class FLOMainNet(object): + """FLO MainNet version bytes + + Version bytes from: + https://github.com/floblockchain/flo/blob/flo-master/src/chainparams.cpp#L155 + """ + NAME = "FLO Main Net" + COIN = "FLO" + SCRIPT_ADDRESS = 0x08 # int(0x08) = 8 + PUBKEY_ADDRESS = 0x23 # int(0x23) = 35 + SECRET_KEY = PUBKEY_ADDRESS + 128 # = int(0xa3) = 163 + + EXT_PUBLIC_KEY = 0x0134406B + EXT_SECRET_KEY = 0x01343C31 + + # Confirm this for FLO from @bitspill + BIP32_PATH = "m/44'/2'/0'/" + +class FLOTestNet(object): + """FLO TestNet version bytes + + Primary version bytes from: + https://github.com/floblockchain/flo/blob/flo-master/src/chainparams.cpp#L289 + """ + NAME = "FLO Test Net" + COIN = "FLO" + SCRIPT_ADDRESS = 0xc6 # int(0xc6) = 198 + PUBKEY_ADDRESS = 0x73 # int(0x6f) = 115 + SECRET_KEY = PUBKEY_ADDRESS + 128 # = int(0xef) = 239 + + EXT_PUBLIC_KEY = 0x013440e2 + EXT_SECRET_KEY = 0x01343c23 diff --git a/pywallet/utils/bip32.py b/pywallet/utils/bip32.py index 50697a4..e025fe7 100644 --- a/pywallet/utils/bip32.py +++ b/pywallet/utils/bip32.py @@ -659,6 +659,10 @@ class Wallet(object): response = DashMainNet elif network == 'dash_testnet' or network == 'DASHTEST': response = DashTestNet + elif network == "flo" or network == "FLO": + response = FLOMainNet + elif network == "flo_testnet" or network == "FLOTEST": + response = FLOTestNet else: response = network return response diff --git a/pywallet/wallet.py b/pywallet/wallet.py index b96812e..75a76dc 100644 --- a/pywallet/wallet.py +++ b/pywallet/wallet.py @@ -83,6 +83,10 @@ def get_network(network='btctest'): return DashMainNet elif network == "dash_testnet" or network == 'dashtest': return DashTestNet + elif network == "flo": + return FLOMainNet + elif network == "flo_testnet": + return FLOTestNet return BitcoinTestNet