Browse Source

Adding Xuez Coin (#472)

patch-2
ddude 7 years ago
committed by Neil Booth
parent
commit
56de4dea67
  1. 1
      .travis.yml
  2. 2
      docs/HOWTO.rst
  3. 63
      lib/coins.py
  4. 1
      setup.py
  5. 14
      tests/blocks/xuez_mainnet_1.json
  6. 14
      tests/blocks/xuez_mainnet_15000.json

1
.travis.yml

@ -23,6 +23,7 @@ install:
- pip install pylru - pip install pylru
- pip install blake256 - pip install blake256
- pip install x11_hash - pip install x11_hash
- pip install xevan_hash
# command to run tests # command to run tests
script: pytest --cov=server --cov=lib --cov=wallet script: pytest --cov=server --cov=lib --cov=wallet
# Dont report coverage from nightly # Dont report coverage from nightly

2
docs/HOWTO.rst

@ -1,4 +1,4 @@
.. _HOWTO: . _HOWTO:
===== =====
HOWTO HOWTO

63
lib/coins.py

@ -1647,3 +1647,66 @@ class Axe(Dash):
''' '''
import x11_hash import x11_hash
return x11_hash.getPoWHash(header) return x11_hash.getPoWHash(header)
class Xuez(Coin):
NAME = "Xuez"
SHORTNAME = "XUEZ"
NET = "mainnet"
XPUB_VERBYTES = bytes.fromhex("022d2533")
XPRV_VERBYTES = bytes.fromhex("0221312b")
P2PKH_VERBYTE = bytes.fromhex("48")
P2SH_VERBYTES = [bytes.fromhex("12")]
WIF_BYTE = bytes.fromhex("d4")
GENESIS_HASH = ('000000e1febc39965b055e8e0117179a'
'4d18e24e7aaa0c69864c4054b4f29445')
TX_COUNT = 30000
TX_COUNT_HEIGHT = 15000
TX_PER_BLOCK = 1
RPC_PORT = 41799
REORG_LIMIT = 1000
BASIC_HEADER_SIZE = 112
PEERS = []
@classmethod
def header_hash(cls, header):
'''
Given a header return the hash for Xuez.
Need to download `xevan_hash` module
Source code: https://github.com/xuez/xuez
'''
version, = struct.unpack('<I', header[:4])
import xevan_hash
if version == 1 :
return xevan_hash.getPoWHash(header[:80])
else:
return xevan_hash.getPoWHash(header)
@classmethod
def electrum_header(cls, header, height):
version, = struct.unpack('<I', header[:4])
timestamp, bits, nonce = struct.unpack('<III', header[68:80])
if version == 1 :
return {
'block_height': height,
'version': version,
'prev_block_hash': hash_to_str(header[4:36]),
'merkle_root': hash_to_str(header[36:68]),
'timestamp': timestamp,
'bits': bits,
'nonce': nonce,
}
else:
return {
'block_height': height,
'version': version,
'prev_block_hash': hash_to_str(header[4:36]),
'merkle_root': hash_to_str(header[36:68]),
'timestamp': timestamp,
'bits': bits,
'nonce': nonce,
'nAccumulatorCheckpoint': hash_to_str(header[80:112]),
}

1
setup.py

@ -11,6 +11,7 @@ setuptools.setup(
# "x11_hash" package (1.4) is required to sync DASH network. # "x11_hash" package (1.4) is required to sync DASH network.
# "tribus_hash" package is required to sync Denarius network. # "tribus_hash" package is required to sync Denarius network.
# "blake256" package is required to sync Decred network. # "blake256" package is required to sync Decred network.
# "xevan_hash" package is required to sync Xuez network.
install_requires=['aiorpcX >= 0.5.5', 'plyvel', 'pylru', 'aiohttp >= 1'], install_requires=['aiorpcX >= 0.5.5', 'plyvel', 'pylru', 'aiohttp >= 1'],
packages=setuptools.find_packages(exclude=['tests']), packages=setuptools.find_packages(exclude=['tests']),
description='ElectrumX Server', description='ElectrumX Server',

14
tests/blocks/xuez_mainnet_1.json

@ -0,0 +1,14 @@
{
"hash": "0000010180d0d872e32af5bbefe8c3567c6ad89c90244ccfc5155555ad8dd22c",
"size": 212,
"height": 1,
"merkleroot": "7c48ceee00495329ab8ee4028a577dfb5f0da80ee6197b4e4f787306e0650351",
"tx": [
"7c48ceee00495329ab8ee4028a577dfb5f0da80ee6197b4e4f787306e0650351"
],
"time": 1523055115,
"nonce": 98,
"bits": "1e0fffff",
"previousblockhash": "000000e1febc39965b055e8e0117179a4d18e24e7aaa0c69864c4054b4f29445",
"block": "040000004594f2b454404c86690caa7a4ee2184d9a1717018e5e055b9639bcfee1000000510365e00673784f4e7b19e60ea80d5ffb7d578a02e48eab29534900eece487c0bfac75affff0f1e6200000000000000000000000000000000000000000000000000000000000000000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff045102d500ffffffff01402fd7863f1600002321024fcb2f96969e70381f4dc01e38a8df3a04297478a36b50d55cce8ba20242bacfac00000000"
}

14
tests/blocks/xuez_mainnet_15000.json

@ -0,0 +1,14 @@
{
"hash": "000000038b6eda3d00e28c4ccbcebb0ca9cdf1bf2c7cbd9366735590d5c8c9bb",
"size": 247,
"height": 15000,
"merkleroot": "bca5b726d932fd7e9c31dcbe12bc17c6da81c1cb625024ae7cf0bca47668d49b",
"tx": [
"bca5b726d932fd7e9c31dcbe12bc17c6da81c1cb625024ae7cf0bca47668d49b"
],
"time": 1524030719,
"nonce": 136866,
"bits": "1d049c81",
"previousblockhash": "00000001c2117eb8d8a0ab30145ee7a360440eddfc4a621caca03a40a89d7040",
"block": "0400000040709da8403aa0ac1c624afcdd0e4460a3e75e1430aba0d8b87e11c2010000009bd46876a4bcf07cae245062cbc181dac617bc12bedc319c7efd32d926b7a5bcffdcd65a819c041da216020000000000000000000000000000000000000000000000000000000000000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0502983a0139ffffffff0200e1f5050000000023210202e8f286f69013d9fb4f824e39e6b62bc129228e64522cbeb240e9bc007129e8ac80d1f008000000001976a914d83e3413ae0d667813f2c78ec67990460573675a88ac00000000"
}
Loading…
Cancel
Save