Exemplo n.º 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")
Exemplo n.º 2
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")
Exemplo n.º 3
0
def op_hash160(vm, instr):
    if not vm.stack:
        raise Exception("OP_HASH160: Argument required")
    vm.stack.append(hash160(vm.stack.pop()))
Exemplo n.º 4
0
 def from_publickey(public_key, runmode):
     return BitcoinAddress(hash160(public_key),
                           AddressVersion.from_runmode(runmode))
Exemplo n.º 5
0
def op_hash160(vm, instr):
    if not vm.stack:
        raise Exception("OP_HASH160: Argument required")
    vm.stack.append(hash160(vm.stack.pop()))
Exemplo n.º 6
0
 def from_publickey(public_key, runmode):
     return BitcoinAddress(hash160(public_key), AddressVersion.from_runmode(runmode))