Come creare un address P2SH–P2PK Bitcoin

Pay To Script Hash — Pay To Public Key

Come creare un address P2SH–P2PK
Bitcoin–In–Action–Copertina-Rigida
Bitcoin In Action — SegWit, Bitcoin Script e Smart Contracts

In Action

Address P2SH–P2PK Bitcoin
$ cat compressed_public_key_1.txt
PBLENGTH=$(char2hex.sh $(cat compressed_public_key_1.txt | wc -c))#P2PK Script
#PB LENGTH - PB - OP_CHECKSIG
SCRIPT=$PBLENGTH$(cat compressed_public_key_1.txt)"AC"printf $SCRIPT > redeem_script.txt
#---------- scriptPubKey ---------ADDR_SHA=`printf $SCRIPT | xxd -r -p | openssl sha256| sed 's/^.* //'`ADDR_RIPEMD160=`printf $ADDR_SHA |xxd -r -p | openssl ripemd160 | sed 's/^.* //'`printf $ADDR_RIPEMD160 > scriptPubKey.txt
#ADDRESSVERSION_PREFIX_ADDRESS=C4ADDR=`printf $VERSION_PREFIX_ADDRESS$ADDR_RIPEMD160 | xxd -p -r | base58 -c`echo $ADDR > address_P2SH.txt
$ cat redeem_script.txt210250a1991342dd7f57792df122baa02c6a5c98aa8daeb8e106ae7d2345d020f082AC
$ cat scriptPubKey.txt3647d6bf3fb8e75f26f15888a471808cb4253afb
$ cat address_P2SH.txt---------- 🔑 ADDRESS P2SH ---------2MxCEY6QTacDQhHFx9rmNeXkpfXEQ17xZQM
bitcoin-cli decodescript $(cat redeem_script.txt){"asm": "02329013c3c2c6bd4a5b1597b008a1ce6e750aa43cf8d2e509e8497bc491c6cb64 OP_CHECKSIG","type": "pubkey","p2sh": "2MxWUqeZaaBgKyNMxx9PzLJywr8LqkRUUor","segwit": {"asm": "0 83e34929132fffbdcffe251c289b68fb178fda06","hex": "001483e34929132fffbdcffe251c289b68fb178fda06","reqSigs": 1,"type": "witness_v0_keyhash","addresses": ["bcrt1qs035j2gn9llmmnl7y5wz3xmglvtclksx2j0yk6"],"p2sh-segwit": "2N7G1k7HomEQA8GZemXQQN3JLRPUDY75Keq"}}

--

--

bitcoininaction.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store