def get_config(): configure_logger() p = configargparse.getArgumentParser(default_config_files=[os.path.join(PATH, 'conf.ini'), '/etc/cert-issuer/conf.ini']) add_arguments(p) parsed_config, _ = p.parse_known_args() if not parsed_config.safe_mode: logging.warning('Your app is configured to skip the wifi check when the USB is plugged in. Read the ' 'documentation to ensure this is what you want, since this is less secure') # overwrite with enum parsed_config.chain = Chain.parse_from_chain(parsed_config.chain) # ensure it's a supported chain if parsed_config.chain.blockchain_type != BlockchainType.bitcoin and \ parsed_config.chain.blockchain_type != BlockchainType.ethereum and \ parsed_config.chain.blockchain_type != BlockchainType.mock: raise UnknownChainError(parsed_config.chain.name) logging.info('This run will try to issue on the %s chain', parsed_config.chain.name) if parsed_config.chain.blockchain_type == BlockchainType.bitcoin: bitcoin_chain_for_python_bitcoinlib = parsed_config.chain if parsed_config.chain == Chain.bitcoin_regtest: bitcoin_chain_for_python_bitcoinlib = Chain.bitcoin_regtest bitcoin.SelectParams(chain_to_bitcoin_network(bitcoin_chain_for_python_bitcoinlib)) configure_logger() return parsed_config
def get_config(name=None): configure_logger() p = configargparse.getArgumentParser(name) add_arguments(p) parsed_config, _ = p.parse_known_args() if not parsed_config.safe_mode: logging.warning( 'Your app is configured to skip the wifi check when the USB is plugged in. Read the ' 'documentation to ensure this is what you want, since this is less secure' ) # overwrite with enum parsed_config.chain = Chain.parse_from_chain(parsed_config.chain) # ensure it's a supported chain if parsed_config.chain.blockchain_type != BlockchainType.bitcoin and \ parsed_config.chain.blockchain_type != BlockchainType.ethereum and \ parsed_config.chain.blockchain_type != BlockchainType.mock: raise UnknownChainError(parsed_config.chain.name) logging.info('This run will try to issue on the %s chain', parsed_config.chain.name) if parsed_config.chain.blockchain_type == BlockchainType.bitcoin: bitcoin_chain_for_python_bitcoinlib = parsed_config.chain if parsed_config.chain == Chain.bitcoin_regtest: bitcoin_chain_for_python_bitcoinlib = Chain.bitcoin_regtest bitcoin.SelectParams( chain_to_bitcoin_network(bitcoin_chain_for_python_bitcoinlib)) return parsed_config
def __init__(self, config: 'AttrDict', unsigned_certs: dict): # 1- Prepare config and unsigned certs (These come from my latest changes in cert-tools self.config = config self.config.original_chain = self.config.chain self.config.chain = Chain.parse_from_chain(self.config.chain) self.path_to_secret = os.path.join(config.usb_name, config.key_file) self.unsigned_certs = unsigned_certs self.cert_generator = self._create_cert_generator() # 2- Calculate Merkle Tree and Root self.merkle_tree_generator = MerkleTreeGenerator() self.merkle_tree_generator.populate(self.cert_generator) self.merkle_root = self.merkle_tree_generator.get_blockchain_data()
def get_config(path=None): if not path: config_file_path = os.path.join(PATH, 'conf.ini') else: config_file_path = path configargparse.initArgumentParser(name='issue_conf', default_config_files=[config_file_path]) p = configargparse.get_argument_parser('issue_conf') add_arguments(p) parsed_config, _ = p.parse_known_args() if not parsed_config.safe_mode: logging.warning( 'Your app is configured to skip the wifi check when the USB is plugged in. Read the ' 'documentation to ensure this is what you want, since this is less secure' ) # overwrite with enum parsed_config.chain = Chain.parse_from_chain(parsed_config.chain) # Set the fee to the recommended value (only enabled if the current chain is mainnet) if parsed_config.chain.blockchain_type == BlockchainType.bitcoin: parsed_config.tx_fee = 0 parsed_config.satoshi_per_byte = requests.get( 'https://bitcoinfees.earn.com/api/v1/fees/recommended').json( )['fastestFee'] # final fee = max(tx_fee, satoshi_per_byte * size) # ensure it's a supported chain if parsed_config.chain.blockchain_type != BlockchainType.bitcoin and \ parsed_config.chain.blockchain_type != BlockchainType.ethereum and \ parsed_config.chain.blockchain_type != BlockchainType.mock: raise UnknownChainError(parsed_config.chain.name) logging.info('This run will try to issue on the %s chain', parsed_config.chain.name) if parsed_config.chain.blockchain_type == BlockchainType.bitcoin: bitcoin_chain_for_python_bitcoinlib = parsed_config.chain if parsed_config.chain == Chain.bitcoin_regtest: bitcoin_chain_for_python_bitcoinlib = Chain.bitcoin_regtest bitcoin.SelectParams( chain_to_bitcoin_network(bitcoin_chain_for_python_bitcoinlib)) return parsed_config
def get_config(): p = configargparse.getArgumentParser(default_config_files=[ os.path.join(PATH, 'conf.ini'), '/etc/cert-issuer/conf.ini' ]) add_arguments(p) parsed_config, _ = p.parse_known_args() if not parsed_config.safe_mode: logging.warning( 'Your app is configured to skip the wifi check when the USB is plugged in. Read the ' 'documentation to ensure this is what you want, since this is less secure' ) # overwrite with enum parsed_config.bitcoin_chain = Chain.parse_from_chain( parsed_config.bitcoin_chain) bitcoin.SelectParams(parsed_config.bitcoin_chain.name) configure_logger() return parsed_config
def get_config(): global config if config == None: #config = cert_issuer.config.get_config() config = DottedDict({ 'my_config': None, 'revoke': False, 'issuing_address': '0xD748BF41264b906093460923169643f45BDbC32e', 'verification_method': 'ecdsa-koblitz-pubkey:0xD748BF41264b906093460923169643f45BDbC32e', 'usb_name': '.', 'key_file': 'pk', 'unsigned_certificates_dir': './data/unsigned_certificates', 'signed_certificates_dir': '/app/cert_issuer/data/signed_certificates', 'blockchain_certificates_dir': './data/blockchain_certificates', 'work_dir': './data/work', 'max_retry': 10, 'chain': 'ethereum_bloxberg', 'safe_mode': False, 'dust_threshold': 2.75e-05, 'tx_fee': 0.0006, 'batch_size': 10, 'satoshi_per_byte': 250, 'bitcoind': False, 'gas_price': 20000000000, 'gas_limit': 60000, 'api_token': None, 'blockcypher_api_token': None, 'node_url': 'https://core.bloxberg.org', 'issuing_method': 'smart_contract', 'ens_name': 'mpdl.berg', 'revocation_list_file': './revocations.json', 'ens_registry_bloxberg': '0xb9F5cd1e334aCEd748bA1422b8a08c548ddBc73D', 'ens_registry_mainnet': '0xb9F5cd1e334aCEd748bA1422b8a08c548ddBc73D' }) config.chain = Chain.parse_from_chain(config.chain) return config