예제 #1
0
def X11Hash(x):
    return darkcoin_hash.getPoWHash(x)
예제 #2
0
def X11Hash(x):
    return darkcoin_hash.getPoWHash(x)
예제 #3
0
파일: dash.py 프로젝트: ELM4Ever/encompass
'''Chain-specific Dash code'''
from cryptocur import CryptoCur, hash_encode, hash_decode, rev_hex, int_to_hex, sha256
import os
import darkcoin_hash as darkhash

HashX11 = lambda x: darkhash.getPoWHash(x)

class Dash(CryptoCur):
    PoW = False
    chain_index = 5
    coin_name = 'Dash'
    code = 'DASH'
    p2pkh_version = 76
    p2sh_version = 16
    wif_version = 204
    ext_pub_version = '02fe52f8'
    ext_priv_version = '02fe52cc'

    DUST_THRESHOLD = 5430
    MIN_RELAY_TX_FEE = 1000
    RECOMMENDED_FEE = 50000
    COINBASE_MATURITY = 100

    block_explorers = {
        'CryptoID': 'https://chainz.cryptoid.info/dash/',
        'CoinPlorer': 'https://coinplorer.com/DRK',
    }

    base_units = {
        'DASH': 8,
        'mDASH': 5,
예제 #4
0
    return rev_hex(s)


def var_int(i):
    if i < 0xfd:
        return int_to_hex(i)
    elif i <= 0xffff:
        return "fd" + int_to_hex(i, 2)
    elif i <= 0xffffffff:
        return "fe" + int_to_hex(i, 4)
    else:
        return "ff" + int_to_hex(i, 8)


#Changing Hash to Darkcoin's X11 Function
HashX11 = lambda x: darkhash.getPoWHash(x)

Hash = lambda x: hashlib.sha256(hashlib.sha256(x).digest()).digest()

hash_encode = lambda x: x[::-1].encode('hex')

hash_decode = lambda x: x.decode('hex')[::-1]


def header_to_string(res):
    pbh = res.get('prev_block_hash')
    if pbh is None:
        pbh = '0' * 64

    return int_to_hex(res.get('version'), 4) \
        + rev_hex(pbh) \
예제 #5
0
 def test_darkcoin_hash(self):
     self.pow_hash = hexlify(darkcoin_hash.getPoWHash(self.block_header))
     self.assertEqual(self.pow_hash, self.best_hash)
예제 #6
0
def Hash(x): #Import darkcoin_hash as darkhash.getPoWHash(x)
    if type(x) is unicode: x=x.encode('utf-8')
    return darkhash.getPoWHash(x)