@staticmethod
def process(rpcconn, from_addr, to_addr, amount):
    utxos = BTC_ListUTXO.utxo(rpcconn, from_addr)

    def UtxoFilter(utxos, amount):
        selected = []
        from decimal import Decimal
        nSum = Decimal('0')
        nFee = Decimal('0.0')
        for utxo in [item for item in utxos if ((int(item['confirmations']) >= 1) and (float(item['amount']) > 0.0003))]:
            selected.append(utxo)
            nSum += Decimal(str(utxo['amount']))
            if (nSum > Decimal(str(amount))):
                nFee = BTC_EstimateSmartFee.calcFee(rpcconn, len(selected), 2)
                if (nSum > (nFee + amount)):
                    break
        return (selected, nSum, nFee)
    (selected, nSum, fee) = UtxoFilter(utxos, amount)
    if (not isinstance(amount, Decimal)):
        amount = Decimal(str(amount))
    if (nSum < (fee + amount)):
        return (False, 'budget not enough')
    from utils import filtered
    param_in = [filtered(item, ['txid', 'vout']) for item in selected]
    param_out = {to_addr: amount, from_addr: ((nSum - amount) - fee)}
    commands = [['createrawtransaction', param_in, param_out]]
    return (True, {'hex': rpcconn.batch_(commands), 'utxos': selected, 'txout': param_out})
@staticmethod
def process(rpcconn, from_addr, to_addr, amount):
    utxos = BTC_ListUTXO.utxo(rpcconn, from_addr)

    def UtxoFilter(utxos, amount):
        selected = []
        from decimal import Decimal
        nSum = Decimal('0')
        nFee = Decimal('0.0')
        for utxo in [item for item in utxos if ((int(item['confirmations']) >= 1) and (float(item['amount']) > 0.0003))]:
            selected.append(utxo)
            nSum += Decimal(str(utxo['amount']))
            if (nSum > Decimal(str(amount))):
                nFee = BTC_EstimateSmartFee.calcFee(rpcconn, len(selected), 2)
                if (nSum > (nFee + amount)):
                    break
        return (selected, nSum, nFee)
    (selected, nSum, fee) = UtxoFilter(utxos, amount)
    if (not isinstance(amount, Decimal)):
        amount = Decimal(str(amount))
    if (nSum < (fee + amount)):
        return (False, 'budget not enough')
    from utils import filtered
    param_in = [filtered(item, ['txid', 'vout']) for item in selected]
    param_out = {to_addr: amount, from_addr: ((nSum - amount) - fee)}
    commands = [['createrawtransaction', param_in, param_out]]
    return (True, {'hex': rpcconn.batch_(commands), 'utxos': selected, 'txout': param_out})