Using
bip16 it's possible to take any script and "wrap" it with a p2sh script (has a standard address), so that there's a simple way to accept payment even to more advanced scripts with the burden of setting up the redemption terms moved to the person getting paid.
The
decodescript example above shows how it can be used:
run:
bitcoin-cli -testnet decodescript 21036622CF5134172EE134EA77A181AAD2D544D3E084AF105423779C94545F96508EAC
The output is :
{
"asm": "036622cf5134172ee134ea77a181aad2d544d3e084af105423779c94545f96508e OP_CHECKSIG",
"reqSigs": 1,
"type": "pubkey",
"addresses": [
"mi9ipdx2Ddx4ARbBJ5o5UPv82uRqSZSRPm"
],
"p2sh": "2N6HiGdMTTxS8yp6puVN7Roz9HCNcnwU2PH"
}
Note the p2sh address.
The scriptpubkey that is known to have this address type is made out of a push of a
hash160 of the redeemscript, and an
op_equal. You can read more on the bip16 link.
You can now run:
bitcoin-cli -testnet validateaddress 2N6HiGdMTTxS8yp6puVN7Roz9HCNcnwU2PH
And see that :
...
"scriptPubKey": "a9148f121357dc6d9130f3a19b3edd965998b6b23e5687",
...
Which is what is used in the 21 mil. redemption.