Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
698 B
4
Indexable
Never
from bitcoinutils.setup import setup
from bitcoinutils.keys import P2shAddress, PublicKey, Address
from bitcoinutils.script import Script

# Setup the network
setup('testnet')

# This script ask the user 3 Public Keys in order to create a P2SH address with a 2-of-3 multisig

# Collect the 3 public keys
pkey1 = "027822baac734226f2bdecf7b483531e83c3400fcdbad6726b91a5cb9788260b7e"
pkey2 = "03c86fef055997c3b6f1b151bb2d6e3ad18c49d70b6c44c7704c952baf021ba746"
pkey3 = "03d0d743102243a76d4efc12b808c1cc78aa1ebefe108ea3398d001808fb5dd251"


redeem_script = Script(['OP2', pkey1, pkey2, pkey3, 'OP3', 'OP_CHECKMULTISIG'])
print(redeem_script)

print((P2shAddress.from_script(redeem_script)).to_string())