#!/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 VCoin testnet client"""

# import sys
import os.path

import altcoin
from altcoin.rpc import AltcoinProxy

# Select VCoin test network
altcoin.SelectParams('000007e14c52364cee2d4d9483541d473e3e73c896df75882273b91313b44816')
# Set up RPC connection
rpc = AltcoinProxy(service_port=55535, btc_conf_file=os.path.expanduser('~/.vcoincore/vcoin.conf'))
# Get new address
print(rpc.getnewaddress('python-altcoinlib example'))
예제 #2
0
        ]
    )

    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)
#!/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 Dogecoin testnet client"""

import sys
import os.path

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

altcoin.SelectParams('bb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e')

rpc = AltcoinProxy(service_port=44555, btc_conf_file=os.path.expanduser('~/.dogecoin/dogecoin.conf'))
best_block_hash = rpc.getblockchaininfo()['bestblockhash']
print (rpc.getblock(lx(best_block_hash)))
예제 #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 Dogecoin testnet client"""

import sys
import os.path

import altcoin
from altcoin.rpc import AltcoinProxy

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

rpc = AltcoinProxy(
    service_port=44555,
    btc_conf_file=os.path.expanduser('~/.dogecoin/dogecoin.conf'))
print rpc.getnewaddress('python-altcoinlib example')
예제 #5
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 Dogecoin testnet client"""

import sys
import os.path

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

altcoin.SelectParams(
    'bb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e')

rpc = AltcoinProxy(
    service_port=44555,
    btc_conf_file=os.path.expanduser('~/.dogecoin/dogecoin.conf'))
best_block_hash = rpc.getblockchaininfo()['bestblockhash']
print(rpc.getblock(lx(best_block_hash)))
예제 #6
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))
예제 #7
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.
"""Take a list of block heights and return block from Dogecoin testnet client"""

import sys
from os.path import expanduser

import altcoin
from altcoin.rpc import AltcoinProxy

altcoin.SelectParams(
    'bb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e')

rpc = AltcoinProxy(service_port=44555,
                   btc_conf_file=expanduser('~/.dogecoin/dogecoin.conf'))

for block_height in sys.argv[1:]:
    print(rpc.getblock(rpc.getblockhash(int(block_height))))
#!/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.

"""Take a list of block heights and return block from Dogecoin testnet client"""

import sys
from os.path import expanduser

import altcoin
from altcoin.rpc import AltcoinProxy

altcoin.SelectParams(
    'bb0a78264637406b6360aad926284d544d7049f45189db5664f3c4d07350559e')

rpc = AltcoinProxy(service_port=44555,
                   btc_conf_file=expanduser('~/.dogecoin/dogecoin.conf'))

for block_height in sys.argv[1:]:
    print (rpc.getblock(rpc.getblockhash(int(block_height))))