Browse Source

Add Bellcoin support (#850)

* Add Bellcoin
patch-2
streetcrypto7 6 years ago
committed by Neil
parent
commit
faf6d57ea7
  1. 1
      .travis.yml
  2. 29
      electrumx/lib/coins.py
  3. 1
      setup.py
  4. 14
      tests/blocks/bellcoin_mainnet_412394.json

1
.travis.yml

@ -36,6 +36,7 @@ install:
- pip install x16r_hash - pip install x16r_hash
- pip install pycryptodomex - pip install pycryptodomex
- pip install git+https://github.com/Electra-project/nist5_hash - pip install git+https://github.com/Electra-project/nist5_hash
- pip install bell-yespower
# command to run tests # command to run tests
script: script:
- pytest --cov=electrumx - pytest --cov=electrumx

29
electrumx/lib/coins.py

@ -3033,3 +3033,32 @@ class ECCoin(Coin):
# you have to install scryp python module (pip install scrypt) # you have to install scryp python module (pip install scrypt)
import scrypt import scrypt
return scrypt.hash(header, header, 1024, 1, 1, 32) return scrypt.hash(header, header, 1024, 1, 1, 32)
class Bellcoin(Coin):
NAME = "Bellcoin"
SHORTNAME = "BELL"
NET = "mainnet"
XPUB_VERBYTES = bytes.fromhex("0488b21e")
XPRV_VERBYTES = bytes.fromhex("0488ade4")
P2PKH_VERBYTE = bytes.fromhex("19")
P2SH_VERBYTES = [bytes.fromhex("55")]
WIF_BYTE = bytes.fromhex("80")
GENESIS_HASH = ('000008f3b6bd10c2d03b06674a006b8d'
'9731f6cb58179ef1eee008cee2209603')
DESERIALIZER = lib_tx.DeserializerSegWit
TX_COUNT = 264129
TX_COUNT_HEIGHT = 219574
TX_PER_BLOCK = 5
RPC_PORT = 25252
REORG_LIMIT = 1000
PEERS = [
'bell.electrumx.japanesecoin-pool.work s t',
'bell.streetcrypto7.com s t',
]
@classmethod
def header_hash(cls, header):
'''Given a header return the hash.'''
import bell_yespower
return bell_yespower.getPoWHash(header)

1
setup.py

@ -19,6 +19,7 @@ setuptools.setup(
'xevan-hash': ['xeven-hash'], 'xevan-hash': ['xeven-hash'],
'x11-hash': ['x11-hash>=1.4'], 'x11-hash': ['x11-hash>=1.4'],
'zny-yespower-0-5': ['zny-yespower-0-5'], 'zny-yespower-0-5': ['zny-yespower-0-5'],
'bell-yespower': ['bell-yespower'],
}, },
packages=setuptools.find_packages(include=('electrumx*',)), packages=setuptools.find_packages(include=('electrumx*',)),
description='ElectrumX Server', description='ElectrumX Server',

14
tests/blocks/bellcoin_mainnet_412394.json

@ -0,0 +1,14 @@
{
"hash": "000004585973c0ce2c9f4c8be13983f901e712e808b1603ddc84c5fc1d630fe4",
"size": 281,
"height": 412394,
"merkleroot": "22d70bbc624844f38343efc35e551d5ce5110d7fddd450bf4a535c830a8a7b3b",
"tx": [
"22d70bbc624844f38343efc35e551d5ce5110d7fddd450bf4a535c830a8a7b3b"
],
"time": 1561546385,
"nonce": 1896874112,
"bits": "1e0745c4",
"previousblockhash": "000001301d2ac66c89ebf7bed1bfaf9398efaea6c3fc2aa5da80efadab7eac40",
"block": "0000002040ac7eabadef80daa52afcc3a6aeef9893afbfd1bef7eb896cc62a1d300100003b7b8a0a835c534abf50d4dd7f0d11e55c1d555ec3ef4383f3444862bc0bd722914e135dc445071e8000107101010000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff2003ea4a0604924e135d085ffffdb3000000000d2f6e6f64655374726174756d2f00000000020000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf900ca9a3b000000001976a9144570c3c687ebf8ef5af7f6efae9b810055305c3088ac0120000000000000000000000000000000000000000000000000000000000000000000000000"
}
Loading…
Cancel
Save