示例#1
0
def extract_txout_bytestr_address(txout):
    script_type = identify_script(txout.script)
    # if unknown script type, return None
    if (script_type is None):
        raise Exception("Unknown script type")
    if script_type == TX_PUBKEYHASH:
        return tx_pubkeyhash_get_address(txout.script)
    if script_type == TX_PUBKEY:
        return hash160(tx_pubkey_get_pubkey(txout.script))
    raise Exception("Unexpected script type")
示例#2
0
文件: address.py 项目: sirk390/coinpy
def extract_txout_bytestr_address(txout):
    script_type = identify_script(txout.script)
    # if unknown script type, return None
    if (script_type is None): 
        raise Exception("Unknown script type")
    if script_type == TX_PUBKEYHASH:
        return tx_pubkeyhash_get_address(txout.script)
    if script_type == TX_PUBKEY:
        return hash160(tx_pubkey_get_pubkey(txout.script))
    raise Exception("Unexpected script type")
示例#3
0
文件: address.py 项目: sirk390/coinpy
def extract_txout_address(txout, runmode):
    script_type = identify_script(txout.script)
    # if unknown script type, return None
    if (script_type is None): 
        return None 
    if script_type == TX_PUBKEYHASH:
        return BitcoinAddress(tx_pubkeyhash_get_address(txout.script), runmode)
    if script_type == TX_PUBKEY:
        return BitcoinAddress.from_publickey(tx_pubkey_get_pubkey(txout.script), runmode)
    return None 
示例#4
0
def extract_txout_address(txout, runmode):
    script_type = identify_script(txout.script)
    # if unknown script type, return None
    if (script_type is None):
        return None
    if script_type == TX_PUBKEYHASH:
        return BitcoinAddress(tx_pubkeyhash_get_address(txout.script), runmode)
    if script_type == TX_PUBKEY:
        return BitcoinAddress.from_publickey(
            tx_pubkey_get_pubkey(txout.script), runmode)
    return None
示例#5
0
def sign_transaction(tx, txout_list, secret_list):
    for idx, (txout, secret) in enumerate(zip(txout_list, secret_list)):
        input_script_type = identify_script(txout.script)
        sign_transaction_input(tx, idx, txout.script, input_script_type, secret)
示例#6
0
def sign_transaction(tx, txout_list, secret_list):
    for idx, (txout, secret) in enumerate(zip(txout_list, secret_list)):
        input_script_type = identify_script(txout.script)
        sign_transaction_input(tx, idx, txout.script, input_script_type,
                               secret)