当前位置: 首页>>代码示例>>Python>>正文


Python bitcoin.SelectParams方法代码示例

本文整理汇总了Python中bitcoin.SelectParams方法的典型用法代码示例。如果您正苦于以下问题:Python bitcoin.SelectParams方法的具体用法?Python bitcoin.SelectParams怎么用?Python bitcoin.SelectParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bitcoin的用法示例。


在下文中一共展示了bitcoin.SelectParams方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: generate_multisig_address

# 需要导入模块: import bitcoin [as 别名]
# 或者: from bitcoin import SelectParams [as 别名]
def generate_multisig_address(redeemscript: str, testnet: bool = False) -> str:
    """
    Generates a P2SH-multisig Bitcoin address from a redeem script

    Args:
        redeemscript: hex-encoded redeem script
                      use generate_multisig_redeem_script to create
                      the redeem script from three compressed public keys
         testnet: Should the address be testnet or mainnet?

    Example:
        TODO
    """

    if testnet:
        bitcoin.SelectParams('testnet')

    redeem_script = CScript(bitcoin.core.x(redeemscript))

    addr = P2SHBitcoinAddress.from_redeemScript(redeem_script)

    return str(addr) 
开发者ID:unchained-capital,项目名称:hermit,代码行数:24,代码来源:bitcoin_signer.py

示例2: validate_request

# 需要导入模块: import bitcoin [as 别名]
# 或者: from bitcoin import SelectParams [as 别名]
def validate_request(self) -> None:
        """Validates a signature request

        Validates

        * the redeem script
        * inputs & outputs
        * fee
        """
        if self.testnet:
            SelectParams('testnet')
        else:
            SelectParams('mainnet')
        self._validate_input_groups()
        self._validate_outputs()
        self._validate_fee() 
开发者ID:unchained-capital,项目名称:hermit,代码行数:18,代码来源:bitcoin_signer.py

示例3: do_execute

# 需要导入模块: import bitcoin [as 别名]
# 或者: from bitcoin import SelectParams [as 别名]
def do_execute(self):

        if self.signing_key is None or self.content_to_verify is None or self.signature_value is None:
            return False
        message = BitcoinMessage(self.content_to_verify)
        try:
            lock.acquire()
            # obtain lock while modifying global state
            bitcoin.SelectParams(chain_to_bitcoin_network(self.chain))
            return VerifyMessage(self.signing_key, message, self.signature_value)
        finally:
            lock.release() 
开发者ID:blockchain-certificates,项目名称:cert-verifier,代码行数:14,代码来源:checks.py

示例4: test_auto_switch_params_decorator

# 需要导入模块: import bitcoin [as 别名]
# 或者: from bitcoin import SelectParams [as 别名]
def test_auto_switch_params_decorator(network):

    if network.name == 'bitcoin':
        assert simple_params_name_return(network) == 'mainnet'
    elif network.name == 'test-bitcoin':
        assert simple_params_name_return(network) == 'testnet'
    else:
        assert simple_params_name_return(network) == network.name

    bitcoin.SelectParams('mainnet') 
开发者ID:Lamden,项目名称:clove,代码行数:12,代码来源:test_network.py

示例5: get_config

# 需要导入模块: import bitcoin [as 别名]
# 或者: from bitcoin import SelectParams [as 别名]
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))

    global CONFIG
    CONFIG = parsed_config
    return parsed_config 
开发者ID:blockchain-certificates,项目名称:cert-issuer,代码行数:33,代码来源:config.py

示例6: setUp

# 需要导入模块: import bitcoin [as 别名]
# 或者: from bitcoin import SelectParams [as 别名]
def setUp(self):
        self.context = Mock()
        self.prepare = Prepare(self.context)

        bitcoin.SelectParams('regtest') 
开发者ID:sbaresearch,项目名称:simcoin,代码行数:7,代码来源:test_prepare.py

示例7: main

# 需要导入模块: import bitcoin [as 别名]
# 或者: from bitcoin import SelectParams [as 别名]
def main():
    cmd_parser = argparse.ArgumentParser(
        description='Simcoin a cryptocurrency simulator.',
        usage='''<command> [<args>]

        The commands are:
        nodes       creates the {} for a simulation
        network     creates the {} for a simulation
        ticks       creates the {} for a simulation
        simulate    executes a simulation based on the {}, {} and {}
        run         runs all above commands
        multi-run   run the simulation multiple times
        '''.format(
            config.nodes_csv_file_name,
            config.network_csv_file_name,
            config.ticks_csv_file_name,
            config.nodes_csv_file_name,
            config.network_csv_file_name,
            config.ticks_csv_file_name,
        ))

    cmd_parser.add_argument('command', help='Subcommand to run')

    # parse_args defaults to [1:] for args, but you need to
    # exclude the rest of the args too, or validation will fail
    args = cmd_parser.parse_args(sys.argv[1:2])
    command = args.command
    if command not in commands:
        print('Unrecognized command')
        cmd_parser.print_help()
        exit(1)
    # use dispatch pattern to invoke method with same name

    if not os.path.exists(config.data_dir):
        os.makedirs(config.data_dir)

    bitcoin.SelectParams('regtest')

    args = _parse_args()
    utils.config_logger(args.verbose)
    logging.info("Arguments called with: {}".format(sys.argv))
    logging.info("Parsed arguments in simcoin.py: {}".format(args))

    logging.info('Executing command={}'.format(command))
    commands[command]() 
开发者ID:sbaresearch,项目名称:simcoin,代码行数:47,代码来源:simcoin.py


注:本文中的bitcoin.SelectParams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。