def default_config(): args = test_bbc_ethereum.Args() config = bbc_ethereum.setup_config(args.workingdir, args.config, args.networkid, args.gethport, args.log) conf = config.get_config() db_conf = { "db_type": "sqlite", "db_name": "bbc_ledger.sqlite", "replication_strategy": "all", "db_servers": [{ "db_addr": "127.0.0.1", "db_port": 3306, "db_user": "******", "db_pass": "******" }] } domain_id1_conf = { 'storage': { 'type': 'internal', }, 'db': db_conf, 'use_ledger_subsystem': True, 'ledger_subsystem': { 'subsystem': 'ethereum', 'max_transactions': 100, 'max_seconds': 30, }, } domain_id2_conf = { 'storage': { 'type': 'internal', }, 'db': db_conf, 'use_ledger_subsystem': True, 'ledger_subsystem': { 'subsystem': 'ethereum', 'max_transactions': 100, 'max_seconds': 30, }, } conf['domains'][domain_id1.hex()] = domain_id1_conf conf['domains'][domain_id2.hex()] = domain_id2_conf return config
def _verify_by_subsystem(self, args, digest, spec, subtree): if spec[b'subsystem'] != b'ethereum': print("Failed: not stored in an Ethereum subsystem.") return 0 bbcConfig = bbc_ethereum.setup_config(args.workingdir, args.config, args.networkid, args.gethport, args.log) config = bbcConfig.get_config() prevdir = os.getcwd() os.chdir(bbc1.__path__[0] + '/core/ethereum') eth = bbc_ethereum.BBcEthereum( config['ethereum']['account'], config['ethereum']['passphrase'], contract_address=spec[b'contract_address']) os.chdir(prevdir) return eth.verify(digest, subtree)
def _verify_by_subsystem(self, args, digest, spec, subtree): if spec[b'subsystem'] != b'ethereum': print("Failed: not stored in an Ethereum subsystem.") return 0 bbcConfig = bbc_ethereum.setup_config(args.workingdir, args.config, args.network) config = bbcConfig.get_config() prevdir = os.getcwd() os.chdir(bbc1.__path__[0] + '/core/ethereum') os.environ['WEB3_INFURA_PROJECT_ID'] = \ config['ethereum']['web3_infura_project_id'] eth = bbc_ethereum.BBcEthereum( config['ethereum']['network'], config['ethereum']['private_key'], contract_address=spec[b'contract_address'].decode('utf-8')) os.chdir(prevdir) return eth.verify(digest, subtree)
def default_config(): args = Args() return bbc_ethereum.setup_config(args.workingdir, args.config, 'ropsten' if TEST_INFURA_PROJECT_ID != '' else 'development')
eth = bbc_ethereum.BBcEthereum( config['ethereum']['network'], config['ethereum']['private_key'], contract_address=spec[b'contract_address'].decode('utf-8')) os.chdir(prevdir) return eth.verify(digest, subtree) if __name__ == '__main__': subsystem_tool = EthereumSubsystemTool() args = subsystem_tool.parse_arguments() bbcConfig = bbc_ethereum.setup_config(args.workingdir, args.config, args.network) if args.command_type == 'auto': print("Setting up brownie.") bbc_ethereum.setup_brownie(bbcConfig, args.project_id) print("Setting up an Ethereum account.") bbc_ethereum.setup_account(bbcConfig, args.private_key) print("Deploying the anchor contract.") bbc_ethereum.setup_deploy(bbcConfig) elif args.command_type == 'balance': print(bbc_ethereum.get_balance(bbcConfig)) elif args.command_type == 'brownie': bbc_ethereum.setup_brownie(bbcConfig, args.project_id)
eth = bbc_ethereum.BBcEthereum( config['ethereum']['account'], config['ethereum']['passphrase'], contract_address=spec[b'contract_address']) os.chdir(prevdir) return eth.verify(digest, subtree) if __name__ == '__main__': subsystem_tool = EthereumSubsystemTool() args = subsystem_tool.parse_arguments() bbcConfig = bbc_ethereum.setup_config(args.workingdir, args.config, args.networkid, args.gethport, args.log) if args.command_type == 'auto': print("Setting up populus.") bbc_ethereum.setup_populus() print("Setting up an Ethereum genesis block.") bbc_ethereum.setup_genesis(bbcConfig) print("Setting up a new Ethereum account.") bbc_ethereum.setup_new_account(bbcConfig, args.passphrase) print("Starting a local geth node.") bbc_ethereum.setup_run(bbcConfig) print("10-second interval for mining.") time.sleep(10) print("Deploying the anchor contract.") bbc_ethereum.setup_deploy(bbcConfig)
def default_config(): args = Args() return bbc_ethereum.setup_config(args.workingdir, args.config, args.networkid, args.gethport, args.log)