Esempio n. 1
0
 def setUp(self):
     self.server_url = "electrum.pdmc.net"
     self.ei = ElectrumInterface(self.server_url, 50001)
     self.bcs = EnhancedBlockchainState(self.server_url, 50001)
     self.txhash = 'b1c68049c1349399fb867266fa146a854c16cd8a18a01d3cd7921ab9d5af1a8b'
     self.height = 277287
     self.raw_tx = '01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4803273b04062f503253482f049fe1bd5208ee5f364f06648bae2e522cfabe6d6de0a3e574e400f64403ea10de4ff3bc0dcb42d49549e273a9faa4eac33b04734804000000000000000000000001cde08d95000000001976a91480ad90d403581fa3bf46086a91b2d9d4125db6c188ac00000000'
     self.address = '1CC3X2gu58d6wXUWMffpuzN9JAfTUWu4Kj'
Esempio n. 2
0
 def test_random_merkle(self):
     server_url = "electrum.pdmc.net"
     ei = ElectrumInterface(server_url, 50001)
     bcs = EnhancedBlockchainState(server_url, 50001)
     self.verifier.blockchain_state = bcs
     h = '265db1bc122c4dae20dd0b55d55c7b270fb1378054fe624457b73bc28b5edd55'
     self.verifier.verify_merkle(h)
     self.assertTrue(self.verifier.get_confirmations(h) > 3)
Esempio n. 3
0
    def __init__(self, config):
        """Creates a Colored Coin Context given a config <config>
        """
        params = config.get('ccc', {})
        self.testnet = config.get('testnet', False)
        self.klass = TestnetAddress if self.testnet else Address

        self.blockchain_state = blockchain.BlockchainState.from_url(
            None, self.testnet)

        if not self.testnet:
            ok = False
            try:
                # try fetching transaction from the second block of
                # the bitcoin blockchain to see whether txindex works
                self.blockchain_state.bitcoind.getrawtransaction(
                    "9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5"
                    "a7a1cde251e54ccfdd5")
                ok = True
            except Exception as e:
                pass
            if not ok:
                # use Electrum to request transactions
                self.blockchain_state = EnhancedBlockchainState(
                    "electrum.cafebitcoin.com", 50001)

        self.store_conn = store.DataStoreConnection(
            params.get("colordb_path", "color.db"))
        self.cdstore = store.ColorDataStore(self.store_conn.conn)
        self.metastore = store.ColorMetaStore(self.store_conn.conn)

        self.colormap = colormap.ColorMap(self.metastore)

        cdbuilder = builder.ColorDataBuilderManager(
            self.colormap, self.blockchain_state, self.cdstore, self.metastore,
            builder.FullScanColorDataBuilder)

        self.colordata = colordata.ThickColorData(cdbuilder,
                                                  self.blockchain_state,
                                                  self.cdstore)
Esempio n. 4
0
 def get_blockchain_state(self):
     server_url = "electrum.pdmc.net"
     ei = ElectrumInterface(server_url, 50001)
     return EnhancedBlockchainState(server_url, 50001)