def test_wallets(self):
        address = implementations.create_address()

        if Config.get("bitshares", "keep_keys_private", True):
            assert address["privateKey"] == "keep_keys_private"
        else:
            assert address["privateKey"] == Config.get_config(
            )["bitshares"]["exchange_account_active_key"]
        assert Config.get("bitshares",
                          "exchange_account_name") in address["publicAddress"]
Beispiel #2
0
    def _short_digit_hash(self, value):
        hash_type = Config.get("operation_storage", "key_hash", "type", default="crc32")

        if hash_type == "crc32":
            short_hash = hex(zlib.crc32(value.encode(encoding='UTF-8')))
            short_hash = short_hash[2:len(short_hash)]

        elif hash_type == "sha256":
            checker = hashlib.sha256()
            checker.update(value.encode(encoding='UTF-8'))
            short_hash = checker.hexdigest()
        return short_hash[0:Config.get("operation_storage", "key_hash", "digits", 3)]
    def test_wallet(self):
        response = self.client.post(url_for('Blockchain.SignService.wallets'))

        response = response.json

        if Config.get("bitshares", "keep_keys_private", True):
            self.assertEqual(response["privateKey"], "keep_keys_private")
        else:
            self.assertEqual(
                response["privateKey"],
                Config.get("bitshares", "exchange_account_active_key"))

        addrs = split_unique_address(response["publicAddress"])

        self.assertEqual(addrs["account_id"],
                         Config.get("bitshares", "exchange_account_id"))

        self.assertEqual(len(addrs["customer_id"]), 36)
        def flag_completed(block_num):
            network = Config.get("network_type")
            connection = Config.get("bitshares", "connection", network)
            #             connection["keys"] = key
            instance = BitShares(**connection)

            irr = instance.rpc.get_dynamic_global_properties().get(
                "last_irreversible_block_num")
            head = instance.rpc.get_dynamic_global_properties().get(
                "head_block_number")

            print("Blockchain Monitor: Looking for block " + str(block_num),
                  ", current head=" + str(head) + ", irreversible=" + str(irr))

            monitor = BlockchainMonitor(storage=store,
                                        bitshares_instance=instance)
            monitor.start_block = block_num - 1
            monitor.stop_block = block_num + 1
            monitor.listen()
Beispiel #5
0
#!/usr/bin/env python3
import click
import time
from bexi import Config, factory
from bexi.connection import requires_blockchain

import logging
import threading
import json
from pprint import pprint
from bexi.operation_storage.exceptions import OperationNotFoundException

config = Config.get("wsgi")


@click.group()
def main():
    pass


@main.command()
@click.option("--host")
@click.option("--port")
def wsgi(host, port):
    host = host or config["host"]
    port = port or config["port"]

    from bexi.wsgi.app import get_manage_service_app, get_sign_service_app

    app = get_manage_service_app()
    app = get_sign_service_app(app)