コード例 #1
0
 def redeem_script_to_scriptpubkey(self, redeem_script):
     #witness-version length sha256
     #witness version is always 0, length is always 0x20
     nested_redeemScript = "0020" + bh2u(sha256(bfh(redeem_script)))
     sh = bh2u(hash_160(bfh(nested_redeemScript)))
     #op_hash160 length hash160 op_equal
     return "a914" + sh + "87"
コード例 #2
0
 def redeem_script_to_scriptpubkey(self, redeem_script):
     sh = bh2u(sha256(bfh(redeem_script)))
     #witness-version length sha256
     #witness version is always 0, length is always 0x20
     return "0020" + sh
コード例 #3
0
 def redeem_script_to_scriptpubkey(self, redeem_script):
     sh = bh2u(hash_160(bfh(redeem_script)))
     #op_hash160 length hash160 op_equal
     return "a914" + sh + "87"
コード例 #4
0
 def pubkey_to_scriptpubkey(self, pubkey):
     pkh = bh2u(hash_160(bfh(pubkey)))
     #op_dup op_hash_160 length hash160 op_equalverify op_checksig
     return "76a914" + pkh + "88ac"
コード例 #5
0
 def pubkey_to_scriptpubkey(self, pubkey):
     #witness-version length pubkeyhash
     #witness version is always 0, length is always 0x14
     redeem_script = '0014' + bh2u(hash_160(bfh(pubkey)))
     sh = bh2u(hash_160(bfh(redeem_script)))
     return "a914" + sh + "87"
コード例 #6
0
 def pubkey_to_scriptpubkey(self, pubkey):
     pkh = bh2u(hash_160(bfh(pubkey)))
     #witness-version length hash160
     #witness version is always 0, length is always 0x14
     return "0014" + pkh