config.BURN_END = 283810
        config.UNSPENDABLE = '1CounterpartyXXXXXXXXXXXXXXXUWLpVr'

    if config.TESTCOIN:
        config.PREFIX = b'XX'                   # 2 bytes (possibly accidentally created)
    else:
        config.PREFIX = b'CNTRPRTY'             # 8 bytes

    if args.action == None: args.action = 'server'

    # Check that bitcoind is running, communicable, and caught up with the blockchain.
    # Check that the database has caught up with bitcoind.
    if not args.force:
        util.bitcoind_check(db)
        if args.action not in ('server', 'purge'):
            util.database_check(db)

    # Do something.
    if args.action == 'send':
        quantity = util.devise(db, args.quantity, args.asset, 'input')
        unsigned_tx_hex = send.create(db, args.source, args.destination,
                                      quantity, args.asset)
        json_print(bitcoin.transmit(unsigned_tx_hex, unsigned=args.unsigned))

    elif args.action == 'order':
        # Fee argument is either fee_required or fee_provided, as necessary.
        if args.give_asset == 'BTC':
            if args.fee_required != 0:
                raise exceptions.FeeError('When selling BTC, do not specify a fee required.')
            fee_required = args.fee_required
            fee_provided = util.devise(db, args.fee_provided, 'BTC', 'input')
示例#2
0
    logger.addHandler(fileh)
    #API requests logging (don't show on console in normal operation)
    requests_log = logging.getLogger("requests")
    requests_log.setLevel(logging.DEBUG if args.verbose else logging.WARNING)

    if args.action == None: args.action = 'server'
    
    # TODO
    # Check versions.
    # Check that bitcoind is running, communicable, and caught up with the blockchain.
    # Check that the database has caught up with bitcoind.
    if not args.force:
        util.versions_check(db)
        bitcoin.bitcoind_check(db)
        if args.action not in ('server', 'reparse', 'rollback'):
            util.database_check(db, bitcoin.get_block_count())
    # TODO

    # Do something.


    # MESSAGE CREATION
    if args.action == 'send':
        quantity = util.devise(db, args.quantity, args.asset, 'input')
        cli('create_send', [args.source, args.destination, args.asset,
                           quantity],
            args.unsigned)

    elif args.action == 'order':
        fee_required, fee_fraction_provided = D(args.fee_fraction_required), D(args.fee_fraction_provided)
        give_quantity, get_quantity = D(args.give_quantity), D(args.get_quantity)
示例#3
0
    logger.addHandler(fileh)
    #API requests logging (don't show on console in normal operation)
    requests_log = logging.getLogger("requests")
    requests_log.setLevel(logging.DEBUG if args.verbose else logging.WARNING)

    if args.action == None: args.action = 'server'

    # TODO
    # Check versions.
    util.versions_check(db)
    # Check that bitcoind is running, communicable, and caught up with the blockchain.
    # Check that the database has caught up with bitcoind.
    if not args.force:
        bitcoin.bitcoind_check(db)
        if args.action not in ('server', 'reparse', 'rollback', 'potentials'):
            util.database_check(db, bitcoin.rpc('getblockcount', []))
    # TODO

    # Do something.

    # MESSAGE CREATION
    if args.action == 'send':
        quantity = util.devise(db, args.quantity, args.asset, 'input')
        cli('create_send',
            [args.source, args.destination, args.asset, quantity],
            args.unsigned)

    elif args.action == 'order':
        fee_required, fee_fraction_provided = D(args.fee_fraction_required), D(
            args.fee_fraction_provided)
        give_quantity, get_quantity = D(args.give_quantity), D(
示例#4
0
def is_db_updated(callback):
    try:
        util.database_check(db)
    except:
        callback(False)
    callback(True)
示例#5
0
    logger.addHandler(fileh)
    #API requests logging (don't show on console in normal operation)
    requests_log = logging.getLogger("requests")
    requests_log.setLevel(logging.DEBUG if args.verbose else logging.WARNING)

    if args.action == None: args.action = 'server'

    # Check versions.
    util.versions_check(db)

    # Check that bitcoind is running, communicable, and caught up with the blockchain.
    # Check that the database has caught up with bitcoind.
    if not args.force:
        util.bitcoind_check(db)
        if args.action not in ('server', 'reparse', 'rollback'):
            util.database_check(db)

    # Do something.
    if args.action == 'send':
        quantity = util.devise(db, args.quantity, args.asset, 'input')
        unsigned_tx_hex = send.create(db,
                                      args.source,
                                      args.destination,
                                      quantity,
                                      args.asset,
                                      unsigned=args.unsigned)
        print(unsigned_tx_hex) if args.unsigned else json_print(
            bitcoin.transmit(unsigned_tx_hex))

    elif args.action == 'order':
        fee_required, fee_provided = D(args.fee_required), D(args.fee_provided)
示例#6
0
def is_db_updated(callback):
    try:
        util.database_check(db)
    except:
        callback(False)
    callback(True)