示例#1
0
    def from_dict(cls, config):
        from yadacoin.transactionutils import TU

        cls.seed = config.get('seed', '')
        cls.xprv = config.get('xprv', '')
        cls.username = config.get('username', '')
        cls.use_pnp = config.get('use_pnp', True)
        cls.ssl = config.get('ssl', True)
        cls.origin = config.get('origin', True)
        cls.polling = config.get('polling', -1)
        cls.network = config.get('network', 'mainnet')
        cls.public_key = config['public_key']
        cls.address = str(P2PKHBitcoinAddress.from_pubkey(bytes.fromhex(cls.public_key)))

        cls.private_key = config['private_key']
        cls.wif = cls.generate_wif(cls.private_key)
        cls.bulletin_secret = TU.generate_deterministic_signature(config, config['username'], config['private_key'])

        cls.mongodb_host = config['mongodb_host']
        cls.database = config['database']
        cls.site_database = config['site_database']
        cls.web_server_host = config['web_server_host']
        cls.web_server_port = config['web_server_port']
        if config['peer_host'] == '0.0.0.0' or config['peer_host'] == 'localhost':
            raise Exception("cannot use localhost or 0.0.0.0, must specify public ipv4 address")
        if config['peer_host'] == '[my public ip]':
            raise Exception("please configure your peer_post to your public ipv4 address")
        cls.peer_host = config['peer_host']
        cls.peer_port = config['peer_port']
        cls.serve_host = config['serve_host']
        cls.serve_port = config['serve_port']
        cls.callbackurl = config['callbackurl']
        cls.fcm_key = config['fcm_key']
示例#2
0
 def get_bulletin_secret(cls, private_key=None, username=''):
     from yadacoin.transactionutils import TU
     return TU.generate_deterministic_signature(username, private_key)
示例#3
0
 def inst_get_bulletin_secret(self):
     from yadacoin.transactionutils import TU
     return TU.generate_deterministic_signature(self, self.username,
                                                self.private_key)