How to disassemble a bitcoin script?

2

There are many explorers which allows to dissamble a transaction back into opcodes.

But what about scripts which aren’t broadcasted yet like this redeem script :512102974ffd58d960908d6f2930fbcc4aa288580d05b35a70869e9a8ada3d080acf392103ef884166c7bd20324fd7f959dc680989a6a8b0d62c348defa900fcd4d31200f152ae ?

user2284570

Posted 2019-03-27T23:26:11.210

Reputation: 189

If possible, I’d like something which don’t needs to be installed.user2284570 2019-03-27T23:26:32.453

Answers

3

bitcoind has a decodescript method.

$ bitcoin-cli decodescript "512102974ffd58d960908d6f2930fbcc4aa288580d05b35a70869e9a8ada3d080acf392103ef884166c7bd20324fd7f959dc680989a6a8b0d62c348defa900fcd4d31200f152ae"
{
  "asm": "1 02974ffd58d960908d6f2930fbcc4aa288580d05b35a70869e9a8ada3d080acf39 03ef884166c7bd20324fd7f959dc680989a6a8b0d62c348defa900fcd4d31200f1 2 OP_CHECKMULTISIG",
  "reqSigs": 1,
  "type": "multisig",
  "addresses": [
    "1CmMoanE9uahYETLahBTGZSFZSQGV8ADrR",
    "12z2brRNYFkqJe3zP58uoiGcLqDxfk6J7r"
  ],
  "p2sh": "34EJTjAmEPbPGXAPQWU7sn4beoZyGTTxBw",
  "segwit": {
    "asm": "0 a45407120f912ef91ecd7e66a27cb4dc106f962172470b1b39c1bb5008898277",
    "hex": "0020a45407120f912ef91ecd7e66a27cb4dc106f962172470b1b39c1bb5008898277",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "bc1q532qwys0jyh0j8kd0en2yl95msgxl93pwfrskxeecxa4qzyfsfmsfgd3m5"
    ],
    "p2sh-segwit": "32KAK2XxwcYPc5iu3tNoXv3ksu4Gf3NsH3"
  }
}

Raghav Sood

Posted 2019-03-27T23:26:11.210

Reputation: 10 897

Thank you. But what the reqSigs field means ?user2284570 2019-03-28T01:45:18.570

This particular script is a multisig script, which happens to require 1 of 2 signatures to be validRaghav Sood 2019-03-28T03:05:42.200

So only one of 1CmMoanE9uahYETLahBTGZSFZSQGV8ADrR and 12z2brRNYFkqJe3zP58uoiGcLqDxfk6J7r is required to unlock funds ?user2284570 2019-03-28T11:37:37.693

user2284570, yesamaclin 2019-03-28T16:01:34.163