예제 #1
0
def _SelectParams():
    # For Monacoin.
    if config.TESTNET:
        genesis_hash = 'a2b106ceba3be0c6d097b2a6a6aacf9d638ba8258ae478158f449c321061e0b2'
    elif config.REGTEST:
        assert False, 'Monaparty does not support REGTEST network.'
    else:
        genesis_hash = 'ff9f1c0116d19de7c9963845e129f9ed1bfc0b376eb54fd7afa42e0d418c8bb6'
    altcoin.SelectParams(genesis_hash)
예제 #2
0
def start_all(db):

    # For Monacoin.
    altcoin.SelectParams(
        'ff9f1c0116d19de7c9963845e129f9ed1bfc0b376eb54fd7afa42e0d418c8bb6')

    # Backend.
    connect_to_backend()

    # API Status Poller.
    api_status_poller = api.APIStatusPoller()
    api_status_poller.daemon = True
    api_status_poller.start()

    # API Server.
    api_server = api.APIServer()
    api_server.daemon = True
    api_server.start()

    # Server.
    blocks.follow(db)
예제 #3
0
            OP_RETURN, 'I <3 Dogecoin'
        ]
    )

    burn_quantity = quantity / 2.0 # We burn half, and give half to the miners
    # Sign and relay a transaction burning the inputs
    txouts = [CTxOut(burn_quantity, burn_script)]
    tx = CMutableTransaction(txins, txouts)
    tx_signed = rpc.signrawtransaction(tx)
    if not tx_signed['complete']:
        raise Error('Transaction came back without all inputs signed.')
    rpc.sendrawtransaction(tx_signed['tx'])
    print 'Burnt ' + str(quantity / COIN) + ' DOGE in TX ID ' + b2lx(tx_signed['tx'].GetHash())

# Select Dogecoin test network
altcoin.SelectParams('bb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e')

rpc = AltcoinProxy(service_port=44555, btc_conf_file=os.path.expanduser('~/.dogecoin/dogecoin.conf'))
txins = []
quantity = 0
for txout in rpc.listunspent(0):
    if txout['amount'] <= COIN:
        txins.append(CMutableTxIn(txout['outpoint']))
        quantity += txout['amount']
        if len(txins) > 100:
            burn_txins(rpc, quantity, txins)
            txins = []
            quantity = 0

if len(txins) > 0:
    burn_txins(rpc, quantity, txins)
예제 #4
0
#!/usr/bin/env python3

# Copyright (C) 2015 The python-altcoinlib developers
#
# This file is part of python-altcoinlib
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or distributed except according to the terms contained in the
# LICENSE file.
"""Pull the latest block in from a Litecoin testnet client"""

import sys
import os.path

import altcoin
from altcoin.rpc import AltcoinProxy
from bitcoin.core import lx

altcoin.SelectParams(
    'f5ae71e26c74beacc88382716aced69cddf3dffff24f384e1808905e0188f68f')

rpc = AltcoinProxy(
    service_port=19332,
    btc_conf_file=os.path.expanduser('~/.litecoin/litecoin.conf'))
best_block_hash = rpc.getblockchaininfo()['bestblockhash']
print rpc.getblock(lx(best_block_hash))