diff --git a/lbry/lbry/wallet/coin/__init__.py b/lbry/lbry/wallet/coin/__init__.py deleted file mode 100644 index 97b69ed6e..000000000 --- a/lbry/lbry/wallet/coin/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__path__: str = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/lbry/lbry/wallet/coin/bitcoincash.py b/lbry/lbry/wallet/coin/bitcoincash.py deleted file mode 100644 index 69bd2553a..000000000 --- a/lbry/lbry/wallet/coin/bitcoincash.py +++ /dev/null @@ -1,49 +0,0 @@ -__node_daemon__ = 'bitcoind' -__node_cli__ = 'bitcoin-cli' -__node_bin__ = 'bitcoin-abc-0.17.2/bin' -__node_url__ = ( - 'https://download.bitcoinabc.org/0.17.2/linux/bitcoin-abc-0.17.2-x86_64-linux-gnu.tar.gz' -) -__spvserver__ = 'torba.server.coins.BitcoinCashRegtest' - -from binascii import unhexlify -from torba.client.baseledger import BaseLedger -from torba.client.basetransaction import BaseTransaction -from .bitcoinsegwit import MainHeaders, UnverifiedHeaders - - -class Transaction(BaseTransaction): - - def signature_hash_type(self, hash_type): - return hash_type | 0x40 - - -class MainNetLedger(BaseLedger): - name = 'BitcoinCash' - symbol = 'BCH' - network_name = 'mainnet' - - headers_class = MainHeaders - transaction_class = Transaction - - pubkey_address_prefix = bytes((0,)) - script_address_prefix = bytes((5,)) - extended_public_key_prefix = unhexlify('0488b21e') - extended_private_key_prefix = unhexlify('0488ade4') - - default_fee_per_byte = 50 - - -class RegTestLedger(MainNetLedger): - headers_class = UnverifiedHeaders - network_name = 'regtest' - - pubkey_address_prefix = bytes((111,)) - script_address_prefix = bytes((196,)) - extended_public_key_prefix = unhexlify('043587cf') - extended_private_key_prefix = unhexlify('04358394') - - max_target = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - genesis_hash = '0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206' - genesis_bits = 0x207fffff - target_timespan = 1 diff --git a/lbry/lbry/wallet/coin/bitcoinsegwit.py b/lbry/lbry/wallet/coin/bitcoinsegwit.py deleted file mode 100644 index b9856cf58..000000000 --- a/lbry/lbry/wallet/coin/bitcoinsegwit.py +++ /dev/null @@ -1,86 +0,0 @@ -__node_daemon__ = 'bitcoind' -__node_cli__ = 'bitcoin-cli' -__node_bin__ = 'bitcoin-0.16.3/bin' -__node_url__ = ( - 'https://bitcoin.org/bin/bitcoin-core-0.16.3/bitcoin-0.16.3-x86_64-linux-gnu.tar.gz' -) -__spvserver__ = 'torba.server.coins.BitcoinSegwitRegtest' - -import struct -from typing import Optional -from binascii import hexlify, unhexlify -from torba.client.baseledger import BaseLedger -from torba.client.baseheader import BaseHeaders, ArithUint256 - - -class MainHeaders(BaseHeaders): - header_size: int = 80 - chunk_size: int = 2016 - max_target: int = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff - genesis_hash: Optional[bytes] = b'000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f' - target_timespan: int = 14 * 24 * 60 * 60 - - @staticmethod - def serialize(header: dict) -> bytes: - return b''.join([ - struct.pack(' ArithUint256: - if chunk == -1: - return ArithUint256(self.max_target) - previous = self[chunk * 2016] - current = self[chunk * 2016 + 2015] - actual_timespan = current['timestamp'] - previous['timestamp'] - actual_timespan = max(actual_timespan, int(self.target_timespan / 4)) - actual_timespan = min(actual_timespan, self.target_timespan * 4) - target = ArithUint256.from_compact(current['bits']) - new_target = min(ArithUint256(self.max_target), (target * actual_timespan) / self.target_timespan) - return new_target - - -class MainNetLedger(BaseLedger): - name = 'BitcoinSegwit' - symbol = 'BTC' - network_name = 'mainnet' - headers_class = MainHeaders - - pubkey_address_prefix = bytes((0,)) - script_address_prefix = bytes((5,)) - extended_public_key_prefix = unhexlify('0488b21e') - extended_private_key_prefix = unhexlify('0488ade4') - - default_fee_per_byte = 50 - - -class UnverifiedHeaders(MainHeaders): - max_target = 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - genesis_hash = None - validate_difficulty = False - - -class RegTestLedger(MainNetLedger): - network_name = 'regtest' - headers_class = UnverifiedHeaders - - pubkey_address_prefix = bytes((111,)) - script_address_prefix = bytes((196,)) - extended_public_key_prefix = unhexlify('043587cf') - extended_private_key_prefix = unhexlify('04358394')