Could you provide the generated code? I’m struggling to generate the P2SH-P2WSH address from the specified redemption script. In reality, there is no key to the witness program. …In this case I just wanted to double check if the generated address and the specified address were the same
Transaction Spec
Private Key 1: 39dc0a9f0b185a2ee56349691f34716e6e0cda06a7f9707742ac113c4e2317bf
Private Key 2: 5077ccd9c558b7d04a81920d38aa11b4a9f9de3b23fab45c3ef28039920fdd6d
Redeem Script (ASM): OP_2 032ff8c5df0bc00fe1ac2319c3b8070d6d1e04cfbf4fedda499ae7b775185ad53b 039bbc8d24f89e5bc44c5b0d1980d6658316a6b2440023117c3c03a4975b04dd56 OP_2 OP_CHECKMULTISIG
Redeem Script (HEX): 5221032ff8c5df0bc00fe1ac2319c3b8070d6d1e04cfbf4fedda499ae7b775185ad53b21039bbc8d24f89e5bc44c5b0d1980d6658316a6b2440023117c3c03a4975b04dd5652ae
Transaction should contain exactly 1 input with:
Outpoint:
Hash: 0000000000000000000000000000000000000000000000000000000000000000
Index: 0
Sequence: 0xffffffff
Transaction should contain exactly 1 output with:
Value: 0.001
Address: 325UUecEQuyrTd28Xs2hvAxdAjHM7XzqVF
Locktime: 0
I’m doing this in Python
# Given Redeem Script (HEX)
redeem_script_hex = "5221032ff8c5df0bc00fe1ac2319c3b8070d6d1e04cfbf4fedda499ae7b775185ad53b21039bbc8d24f89e5bc44c5b0d1980d6658316a6b2440023117c3c03a4975b04dd5652ae"
script_bytes = bytes.fromhex(redeem_script_hex)
sha256_hash = hashlib.sha256(script_bytes).digest()
redeem_script_hash = hashlib.new("ripemd160", sha256_hash).digest()
prefixed_hash = b'\x05' + redeem_script_hash
checksum = hashlib.sha256(hashlib.sha256(prefixed_hash).digest()).digest()(:4)
final_data = prefixed_hash + checksum
address = base58.b58encode(final_data).decode()
print(address)
Putput appears
h-multisig-tx-jatin-2708/python$ python main.py
39C5GaHDocqYVgyCq2TrMfknTL45LPPcKF
But it should come
Address: 325UUecEQuyrTd28Xs2hvAxdAjHM7XzqVF (as given in ques)
Can anyone explain why the addresses are different, as the witness appears to be missing…?
Discover more from Earlybirds Invest
Subscribe to get the latest posts sent to your email.