Spending one-OP-code-long scripts
One simple example is an OP_TRUE (0x51) script which decoded by bitcoin-cli
on any testnet (incl. signet) network says following:
$ bitcoin-cli -testnet4 decodescript 51
{
"asm": "1",
"desc": "raw(51)#8lvh9jxk",
"type": "nonstandard",
"p2sh": "2ND8PB9RrfCaAcjfjP1Y6nAgFd9zWHYX4DN",
"segwit": {
"asm": "0 4ae81572f06e1b88fd5ced7a1a000945432e83e1551e6f721ee9c00b8cc33260",
"desc": "addr(tb1qft5p2uhsdcdc3l2ua4ap5qqfg4pjaqlp250x7us7a8qqhrxrxfsqaqh7jw)#gtc05zpf",
"hex": "00204ae81572f06e1b88fd5ced7a1a000945432e83e1551e6f721ee9c00b8cc33260",
"address": "tb1qft5p2uhsdcdc3l2ua4ap5qqfg4pjaqlp250x7us7a8qqhrxrxfsqaqh7jw",
"type": "witness_v0_scripthash",
"p2sh-segwit": "2N3i4C56DiqfpdcAJsAdZd2xYpCQMRAroye"
}
}
It can be spent by using 02 0151
as a script length and scriptsig. This is how it looks in a full raw hex transaction present on Testnet4:
VERSION: 02000000
INPUTS: 01
2221fab941cdb15ed1cc9dbd7511f55fec5044821a5053034b066bcc38d91bf5 01000000 02 0151 fdffffff
OUTPUTS: 01
ff02000000000000 04 51024e73
LOCKTIME: 15700000
The transaction can be easily reconstructed from this readable hex format into a long one-line hex string on a *NIX terminal just by using tr -d ' [A-Z]:\n-' | grep .
, i.e. removing any spaces, upper-case letters, colons, newlines and hyphens.
Spending the same from P2WSH or P2SH-Segwit address is very similar, just instead of adding to scriptsig one would use the input's witness instead.
I know how to spend from scripts that use just one op-code when it is from range 51
- 61
(hex), but I have no idea how to spend (or even if it is possible at all to do it) in this way from addresses belonging to 00
, 4f
, 63
(OP_IF
) and many others with higher-number op-codes where addresses for them exist. Some like 62
are giving this output so it is very easy to not even try:
{
"asm": "OP_VER",
"desc": "raw(62)#ttuhp9rg",
"type": "nonstandard"
}
Is it possible to spend from addresses belonging to the other (see above) scripts only-one op-code (or one octet) long*? How?
* For example from 2NDNfojz7c4GS1RKxqUHKm8mk5URLskt65L
from Recent Questions - Bitcoin Stack Exchange https://ift.tt/U4Cu5Ff
via IFTTT