# Path: coloredcoinlib/blockchain.py
# def script_to_raw_address(script):
#     def __init__(self, hash, n):
#     def __init__(self, op_hash, op_n):
#     def get_txhash(self):
#     def get_outpoint(self):
#     def set_nSequence(self, nSequence):
#     def __init__(self, value, script):
#     def __init__(self, bs):
#     def get_fee(self):
#     def from_bitcoincore(klass, txhash, bctx, bs):
#     def ensure_input_values(self):
#     def sort_txs(self, tx_list):
#         def get_dependent_txs(tx):
#     def __init__(self, bitcoind):
#     def publish_tx(self, txdata):
#     def from_url(cls, url, testnet=False):
#     def get_block_height(self, blockhash):
#     def get_block_count(self):
#     def get_block_hash(self, index):
#     def get_block(self, blockhash):
#     def get_blockhash_at_height(self, height):
#     def get_previous_blockinfo(self, blockhash):
#     def get_tx_blockhash(self, txhash):
#     def get_raw(self, txhash):
#     def get_tx(self, txhash):
#     def get_best_blockhash(self):
#     def iter_block_txs(self, blockhash):
#     def sort_txs(self, tx_list):
#         def get_dependent_txs(tx):
#     def get_mempool_txs(self):
# class COutpoint(object):
# class CTxIn(object):
# class CTxOut(object):
# class CTransaction(object):
# class BlockchainStateBase(object):
# class BlockchainState(BlockchainStateBase):


from bitcoin.core import CTransaction
from bitcoin.wallet import CBitcoinAddress
from bitcoin.core import x as to_binary
from bitcoin.core import b2lx as to_little_endian_hex
from bitcoin.core import b2x as to_hex
from coloredcoinlib import blockchain
import json
import socket
import sys
import time
import traceback
import urllib2
import bitcoin.rpc
                raw_messages = out.split("\n")

                # the last one isn't complete
                out = raw_messages.pop()
                for raw_message in raw_messages:
                    message = json.loads(raw_message)

                    id = message.get('id')
                    error = message.get('error')
                    result = message.get('result')

                    if id == target_id:
                        if error:
                            raise Exception("Received error '%s'!" % message)
                        else:
                            return result
        except:
            traceback.print_exc(file=sys.stdout)
        self.is_connected = False

    def get_response(self, method, params):
        """Given a message that consists of <method> which
        has <params>,
        Return the string response of the message sent to electrum"""
        current_id = self.message_counter
        self.message_counter += 1
        try:
            self.sock.send(
                json.dumps({
                    'id': current_id,

# Path: coloredcoinlib/blockchain.py
# def script_to_raw_address(script):
#     def __init__(self, hash, n):
#     def __init__(self, op_hash, op_n):
#     def get_txhash(self):
#     def get_outpoint(self):
#     def set_nSequence(self, nSequence):
#     def __init__(self, value, script):
#     def __init__(self, bs):
#     def get_fee(self):
#     def from_bitcoincore(klass, txhash, bctx, bs):
#     def ensure_input_values(self):
#     def sort_txs(self, tx_list):
#         def get_dependent_txs(tx):
#     def __init__(self, bitcoind):
#     def publish_tx(self, txdata):
#     def from_url(cls, url, testnet=False):
#     def get_block_height(self, blockhash):
#     def get_block_count(self):
#     def get_block_hash(self, index):
#     def get_block(self, blockhash):
#     def get_blockhash_at_height(self, height):
#     def get_previous_blockinfo(self, blockhash):
#     def get_tx_blockhash(self, txhash):
#     def get_raw(self, txhash):
#     def get_tx(self, txhash):
#     def get_best_blockhash(self):
#     def iter_block_txs(self, blockhash):
#     def sort_txs(self, tx_list):
#         def get_dependent_txs(tx):
#     def get_mempool_txs(self):
# class COutpoint(object):
# class CTxIn(object):
# class CTxOut(object):
# class CTransaction(object):
# class BlockchainStateBase(object):
# class BlockchainState(BlockchainStateBase):


# Path: ngcccbase/services/electrum.py
from bitcoin.core import CTransaction
from bitcoin.wallet import CBitcoinAddress
from bitcoin.core import x as to_binary
from bitcoin.core import b2lx as to_little_endian_hex
from bitcoin.core import b2x as to_hex
from coloredcoinlib import blockchain
import json
import socket
import sys
import time
import traceback
import urllib2
import bitcoin.rpc

                raw_messages = out.split("\n")

                # the last one isn't complete
                out = raw_messages.pop()
                for raw_message in raw_messages:
                    message = json.loads(raw_message)

                    id = message.get('id')
                    error = message.get('error')
                    result = message.get('result')

                    if id == target_id:
                        if error:
                            raise Exception("Received error '%s'!" % message)
                        else:
                            return result
        except:
            traceback.print_exc(file=sys.stdout)
        self.is_connected = False

    def get_response(self, method, params):
        """Given a message that consists of <method> which
        has <params>,
        Return the string response of the message sent to electrum"""
        current_id = self.message_counter
        self.message_counter += 1
        try:
            self.sock.send(
                json.dumps({
                    'id': current_id,

                    'method': method,