예제 #1
0
    def __init__(self):
        # Create 3 thread-pools each with 1 thread
        self.network_service = bitcoin.async_service(1)
        self.disk_service = bitcoin.async_service(1)
        self.mempool_service = bitcoin.async_service(1)

        self.hosts = bitcoin.hosts(self.network_service)
        self.handshake = bitcoin.handshake(self.network_service)
        self.network = bitcoin.network(self.network_service)
        self.protocol = bitcoin.protocol(self.network_service, self.hosts,
                                         self.handshake, self.network)

        db_prefix = "/home/genjix/libbitcoin/database"
        self.blockchain = bitcoin.bdb_blockchain(self.disk_service, db_prefix,
                                                 self.blockchain_started)
        self.poller = bitcoin.poller(self.mempool_service, self.blockchain)
        self.transaction_pool = \
            bitcoin.transaction_pool(self.mempool_service, self.blockchain)

        self.protocol.subscribe_channel(self.monitor_tx)
        self.session = \
            bitcoin.session(self.network_service, self.hosts, self.handshake,
                            self.network, self.protocol, self.blockchain,
                            self.poller, self.transaction_pool)
        self.session.start(self.handle_start)

        self.memory_buffer = \
            membuf.memory_buffer(self.mempool_service.internal_ptr,
                                 self.blockchain.internal_ptr,
                                 self.transaction_pool.internal_ptr)
    def __init__(self):
        # Create 3 thread-pools each with 1 thread
        self.network_service = asiccoin.async_service(1)
        self.disk_service = asiccoin.async_service(1)
        self.mempool_service = asiccoin.async_service(1)

        self.hosts = asiccoin.hosts(self.network_service)
        self.handshake = asiccoin.handshake(self.network_service)
        self.network = asiccoin.network(self.network_service)
        self.protocol = asiccoin.protocol(self.network_service, self.hosts,
                                         self.handshake, self.network)

        db_prefix = "/home/genjix/libasiccoin/database"
        self.blockchain = asiccoin.bdb_blockchain(self.disk_service, db_prefix,
                                                 self.blockchain_started)
        self.poller = asiccoin.poller(self.mempool_service, self.blockchain)
        self.transaction_pool = \
            asiccoin.transaction_pool(self.mempool_service, self.blockchain)

        self.protocol.subscribe_channel(self.monitor_tx)
        self.session = \
            asiccoin.session(self.network_service, self.hosts, self.handshake,
                            self.network, self.protocol, self.blockchain,
                            self.poller, self.transaction_pool)
        self.session.start(self.handle_start)

        self.memory_buffer = \
            membuf.memory_buffer(self.mempool_service.internal_ptr,
                                 self.blockchain.internal_ptr,
                                 self.transaction_pool.internal_ptr)
예제 #3
0

def finish(ec, result):
    print "Finish:", ec
    for line in result:
        for k, v in line.iteritems():
            begin = k + ":"
            print begin, " " * (12 - len(begin)), v
        print


a = asiccoin.async_service(1)
chain = asiccoin.bdb_blockchain(a, "/home/genjix/libasiccoin/database",
                               blockchain_started)
txpool = asiccoin.transaction_pool(a, chain)
txdat = asiccoin.data_chunk("0100000001d6cad920a04acd6c0609cd91fe4dafa1f3b933ac90e032c78fdc19d98785f2bb010000008b483045022043f8ce02784bd7231cb362a602920f2566c18e1877320bf17d4eabdac1019b2f022100f1fd06c57330683dff50e1b4571fb0cdab9592f36e3d7e98d8ce3f94ce3f255b01410453aa8d5ddef56731177915b7b902336109326f883be759ec9da9c8f1212c6fa3387629d06e5bf5e6bcc62ec5a70d650c3b1266bb0bcc65ca900cff5311cb958bffffffff0280969800000000001976a9146025cabdbf823949f85595f3d1c54c54cd67058b88ac602d2d1d000000001976a914c55c43631ab14f7c4fd9c5f153f6b9123ec32c8888ac00000000")
ex = asiccoin.satoshi_exporter()
tx = ex.load_transaction(txdat)


def stored(ec):
    print "mbuff", ec

mbuff = membuf.memory_buffer(a.internal_ptr, chain.internal_ptr,
                             txpool.internal_ptr)
mbuff.receive(tx, stored)
address = "1AA6mgxqSrvJTxRrYrikSnLaAGupVzvx4f"
raw_input()
history.payment_history(a, chain, txpool, mbuff, address, finish)
raw_input()
예제 #4
0

def finish(ec, result):
    print "Finish:", ec
    for line in result:
        for k, v in line.iteritems():
            begin = k + ":"
            print begin, " " * (12 - len(begin)), v
        print


a = bitcoin.async_service(1)
chain = bitcoin.bdb_blockchain(a, "/home/genjix/libbitcoin/database",
                               blockchain_started)
txpool = bitcoin.transaction_pool(a, chain)
txdat = bitcoin.data_chunk("0100000001d6cad920a04acd6c0609cd91fe4dafa1f3b933ac90e032c78fdc19d98785f2bb010000008b483045022043f8ce02784bd7231cb362a602920f2566c18e1877320bf17d4eabdac1019b2f022100f1fd06c57330683dff50e1b4571fb0cdab9592f36e3d7e98d8ce3f94ce3f255b01410453aa8d5ddef56731177915b7b902336109326f883be759ec9da9c8f1212c6fa3387629d06e5bf5e6bcc62ec5a70d650c3b1266bb0bcc65ca900cff5311cb958bffffffff0280969800000000001976a9146025cabdbf823949f85595f3d1c54c54cd67058b88ac602d2d1d000000001976a914c55c43631ab14f7c4fd9c5f153f6b9123ec32c8888ac00000000")
ex = bitcoin.satoshi_exporter()
tx = ex.load_transaction(txdat)


def stored(ec):
    print "mbuff", ec

mbuff = membuf.memory_buffer(a.internal_ptr, chain.internal_ptr,
                             txpool.internal_ptr)
mbuff.receive(tx, stored)
address = "1AA6mgxqSrvJTxRrYrikSnLaAGupVzvx4f"
raw_input()
history.payment_history(a, chain, txpool, mbuff, address, finish)
raw_input()