-from twisted.internet import defer
-
-
-class BitcoinMainnet(object):
- BITCOIN_P2P_PREFIX = 'f9beb4d9'.decode('hex')
- BITCOIN_P2P_PORT = 8333
- BITCOIN_ADDRESS_VERSION = 0
- BITCOIN_RPC_PORT = 8332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' not in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
- not (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
- BITCOIN_SYMBOL = 'BTC'
-
-class BitcoinTestnet(object):
- BITCOIN_P2P_PREFIX = 'fabfb5da'.decode('hex')
- BITCOIN_P2P_PORT = 18333
- BITCOIN_ADDRESS_VERSION = 111
- BITCOIN_RPC_PORT = 8332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' not in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
- (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
- BITCOIN_SYMBOL = 'tBTC'
-
-
-class NamecoinMainnet(object):
- BITCOIN_P2P_PREFIX = 'f9beb4fe'.decode('hex')
- BITCOIN_P2P_PORT = 8334
- BITCOIN_ADDRESS_VERSION = 52
- BITCOIN_RPC_PORT = 8332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
- not (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
- BITCOIN_SYMBOL = 'NMC'
-
-class NamecoinTestnet(object):
- BITCOIN_P2P_PREFIX = 'fabfb5fe'.decode('hex')
- BITCOIN_P2P_PORT = 18334
- BITCOIN_ADDRESS_VERSION = 111
- BITCOIN_RPC_PORT = 8332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
- (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//210000)
- BITCOIN_SYMBOL = 'tNMC'
-
-
-class IxcoinMainnet(object):
- BITCOIN_P2P_PREFIX = 'f9beb4d9'.decode('hex')
- BITCOIN_P2P_PORT = 8337
- BITCOIN_ADDRESS_VERSION = 138
- BITCOIN_RPC_PORT = 8338
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' not in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' in (yield bitcoind.rpc_help()) and
- not (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 96*100000000 >> (height + 1)//210000)
- BITCOIN_SYMBOL = 'IXC'
+import os
+import platform
-class IxcoinTestnet(object):
- BITCOIN_P2P_PREFIX = 'fabfb5da'.decode('hex')
- BITCOIN_P2P_PORT = 18337
- BITCOIN_ADDRESS_VERSION = 111
- BITCOIN_RPC_PORT = 8338
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' not in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' in (yield bitcoind.rpc_help()) and
- (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 96*100000000 >> (height + 1)//210000)
- BITCOIN_SYMBOL = 'tIXC'
-
-
-class I0coinMainnet(object):
- BITCOIN_P2P_PREFIX = 'f1b2b3d4'.decode('hex')
- BITCOIN_P2P_PORT = 7333
- BITCOIN_ADDRESS_VERSION = 105
- BITCOIN_RPC_PORT = 7332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' not in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
- 'i0coinaddress' in (yield bitcoind.rpc_help()) and
- not (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 48*100000000 >> (height + 1)//218750)
- BITCOIN_SYMBOL = 'I0C'
-
-class I0coinTestnet(object):
- BITCOIN_P2P_PREFIX = 'f5b6b7d8'.decode('hex')
- BITCOIN_P2P_PORT = 17333
- BITCOIN_ADDRESS_VERSION = 112
- BITCOIN_RPC_PORT = 7332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'name_firstupdate' not in (yield bitcoind.rpc_help()) and
- 'ixcoinaddress' not in (yield bitcoind.rpc_help()) and
- 'i0coinaddress' in (yield bitcoind.rpc_help()) and
- (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 48*100000000 >> (height + 1)//218750)
- BITCOIN_SYMBOL = 'tI0C'
-
-
-class SolidcoinMainnet(object):
- BITCOIN_P2P_PREFIX = 'deadbabe'.decode('hex')
- BITCOIN_P2P_PORT = 7555
- BITCOIN_ADDRESS_VERSION = 125
- BITCOIN_RPC_PORT = 8332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'solidcoinaddress' in (yield bitcoind.rpc_help()) and
- not (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 32*100000000 >> (height + 1)//300000)
- BITCOIN_SYMBOL = 'SC'
-
-
-class LitecoinMainnet(object):
- BITCOIN_P2P_PREFIX = 'fbc0b6db'.decode('hex')
- BITCOIN_P2P_PORT = 9333
- BITCOIN_ADDRESS_VERSION = 48
- BITCOIN_RPC_PORT = 9332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'litecoinaddress' in (yield bitcoind.rpc_help()) and
- not (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//840000)
- BITCOIN_POW_SCRYPT = True;
- BITCOIN_SYMBOL = 'LTC'
+from twisted.internet import defer
-class LitecoinTestnet(object):
- BITCOIN_P2P_PREFIX = 'fcc1b7dc'.decode('hex')
- BITCOIN_P2P_PORT = 19333
- BITCOIN_ADDRESS_VERSION = 111
- BITCOIN_RPC_PORT = 19332
- BITCOIN_RPC_CHECK = staticmethod(defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
- 'litecoinaddress' in (yield bitcoind.rpc_help()) and
- (yield bitcoind.rpc_getinfo())['testnet']
- )))
- BITCOIN_SUBSIDY_FUNC = staticmethod(lambda height: 50*100000000 >> (height + 1)//840000)
- BITCOIN_POW_SCRYPT = True;
- BITCOIN_SYMBOL = 'tLTC'
+from . import data
+from p2pool.util import math, pack, jsonrpc
+
+@defer.inlineCallbacks
+def check_genesis_block(bitcoind, genesis_block_hash):
+ try:
+ yield bitcoind.rpc_getblock(genesis_block_hash)
+ except jsonrpc.Error_for_code(-5):
+ defer.returnValue(False)
+ else:
+ defer.returnValue(True)
+
+@defer.inlineCallbacks
+def get_subsidy(bitcoind, target):
+ res = yield bitcoind.rpc_getblock(target)
+
+ defer.returnValue(res)
+
+nets = dict(
+ novacoin=math.Object(
+ P2P_PREFIX='e4e8e9e5'.decode('hex'),
+ P2P_PORT=7777,
+ ADDRESS_VERSION=8,
+ RPC_PORT=8344,
+ RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
+ 0 == (yield bitcoind.rpc_getblock('00000a060336cbb72fe969666d337b87198b1add2abaa59cca226820b32933a4'))['height'] and
+ not (yield bitcoind.rpc_getinfo())['testnet']
+ )),
+ SUBSIDY_FUNC=lambda bitcoind, target: get_subsidy(bitcoind, target),
+ BLOCK_PERIOD=600, # s
+ SYMBOL='NVC',
+ CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'NovaCoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/NovaCoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.novacoin'), 'novacoin.conf'),
+ BLOCK_EXPLORER_URL_PREFIX='http://explorer.novaco.in/block/',
+ ADDRESS_EXPLORER_URL_PREFIX='http://explorer.novaco.in/address/',
+ TX_EXPLORER_URL_PREFIX='http://explorer.novaco.in/tx/',
+ SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
+ DUMB_SCRYPT_DIFF=2**16,
+ DUST_THRESHOLD=0.01e6,
+ ),
+ novacoin_testnet=math.Object(
+ P2P_PREFIX='cdf2c0ef'.decode('hex'),
+ P2P_PORT=17777,
+ ADDRESS_VERSION=111,
+ RPC_PORT=18344,
+ RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
+ 0 == (yield bitcoind.rpc_getblock('0000c763e402f2436da9ed36c7286f62c3f6e5dbafce9ff289bd43d7459327eb'))['height'] and
+ (yield bitcoind.rpc_getinfo())['testnet']
+ )),
+ SUBSIDY_FUNC=lambda bitcoind, target: get_subsidy(bitcoind, target),
+ BLOCK_PERIOD=600, # s
+ SYMBOL='tNVC',
+ CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'NovaCoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/NovaCoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.novacoin'), 'novacoin.conf'),
+ BLOCK_EXPLORER_URL_PREFIX='http://novacoin.su/block/',
+ ADDRESS_EXPLORER_URL_PREFIX='http://novacoin.su/address/',
+ TX_EXPLORER_URL_PREFIX='http://novacoin.su/tx/',
+ SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
+ DUMB_SCRYPT_DIFF=2**16,
+ DUST_THRESHOLD=0.01e6,
+ ),
+)
+for net_name, net in nets.iteritems():
+ net.NAME = net_name