I am trying to extract the address from ScriptSig as per the below script and also tried another way to confirm the result using this (
https://cryptofrontline.com/Tools/Upload/tool/pubkey-to-address) but the result is not as the same as multichain explorer:
ScriptSig :304502210083c7e3ae2d881fe41160ce480897435ba237285f8080ee7d84dacbeb606fc67d02206c713fc4c331ec53b6a6c7a4ec42f8dd1798329a37fc9abcbf0610a3da886d4301 02006a8c25a8ac1e90cb6a8881e59b8829b400bf45b8f2ee28d3fcb32d15a2c6e8
#!/usr/bin/env python
from hashlib import *
from base58 import *
def SHA256D(bstr):
return sha256(sha256(bstr).digest()).digest()
def ConvertPKHToAddress(prefix, addr):
data = prefix + addr
return b58encode(data + SHA256D(data)[:4])
def PubkeyToAddress(pubkey_hex):
pubkey = bytearray.fromhex(pubkey_hex)
round1 = sha256(pubkey).digest()
h = new('ripemd160')
h.update(round1)
pubkey_hash = h.digest()
return ConvertPKHToAddress(b'\x00', pubkey_hash)
pubkey = "02006a8c25a8ac1e90cb6a8881e59b8829b400bf45b8f2ee28d3fcb32d15a2c6e8"
print("Address: %s" % PubkeyToAddress(pubkey))
the result from the script and the website is:18EMD4PCBYtVRnjimj3yrNwKVHErnjkXTS
the result from the explorer is: 1Bihmhz9qgBmmbVtRGAzMSeqVn7SPBcp4E3B3f