<p><code>bitcoind</code> has a <code>decodescript</code> method.</p>

<pre><code>$ 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"
  }
}
</code></pre>

CC BY-SA 4.0
2019-03-28T03:05:42.200Z
This particular script is a multisig script, which happens to require 1 of 2 signatures to be valid
Raghav Sood
CC BY-SA 4.0
2019-03-28T11:37:37.693Z
So only one of `1CmMoanE9uahYETLahBTGZSFZSQGV8ADrR` and `12z2brRNYFkqJe3zP58uoiGcLqDxfk6J7r` is required to unlock funds ?
user2284570
CC BY-SA 4.0
2019-03-28T16:01:34.163Z
user2284570, yes
amaclin
CC BY-SA 4.0
2024-03-18T08:49:28.100Z
Annoying that it can't handle large hex strings since on CLI, "Argument list too long" on Linux.
Ciro Santilli OurBigBook.com
CC BY-SA 4.0
2019-03-28T01:36:06.330Z
2019-03-28T01:36:06.330Z
Raghav Sood
<p>There are many explorers which allows to dissamble a transaction back into opcodes.</p>

<p>But what about scripts which aren’t broadcasted yet like this redeem script :<code>512102974ffd58d960908d6f2930fbcc4aa288580d05b35a70869e9a8ada3d080acf392103ef884166c7bd20324fd7f959dc680989a6a8b0d62c348defa900fcd4d31200f152ae</code> ?</p>

CC BY-SA 4.0
2019-03-27T23:26:32.453Z
If possible, I’d like something which don’t needs to be installed.
user2284570
CC BY-SA 4.0
2024-01-31T08:54:04.107Z
For Googlers, if you have a full node and want to dissemble all scripts of a transaction locally, you can use `bitcoin-core.cli getrawtransaction 75b431e0a8c4617ca8adefe593ba66aa30907742b6dc8772761bfe7edabd74b4 true`., docs: https://bitcoincore.org/en/doc/22.0.0/rpc/rawtransactions/getrawtransaction/ This produces better output than some online tracker disassembles e.g. https://www.blockchain.com/explorer/transactions/btc/75b431e0a8c4617ca8adefe593ba66aa30907742b6dc8772761bfe7edabd74b4 which sometimes fail to show things correctly for non standard transactions.
Ciro Santilli OurBigBook.com
<transactions><script>
How to disassemble a bitcoin script?
user2284570
# How to disassemble a bitcoin script?

(Asked by: username_0 on 2019-03-27)

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` ?

**Tags:** transactions, script

> **Comments:**
> **username_0**: If possible, I’d like something which don’t needs to be installed.  
> **username_1**: For Googlers, if you have a full node and want to dissemble all scripts of a transaction locally, you can use `bitcoin-core.cli getrawtransaction 75b431e0a8c4617ca8adefe593ba66aa30907742b6dc8772761bfe7edabd74b4 true`., docs: https://bitcoincore.org/en/doc/22.0.0/rpc/rawtransactions/getrawtransaction/ This produces better output than some online tracker disassembles e.g. https://www.blockchain.com/explorer/transactions/btc/75b431e0a8c4617ca8adefe593ba66aa30907742b6dc8772761bfe7edabd74b4 which sometimes fail to show things correctly for non standard transactions.  

---

## 1 answers

### Answer by username_2 on 2019-03-28. Score: 5 | Accepted answer

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"
  }
}

> **Comments:**
> **username_2**: This particular script is a multisig script, which happens to require 1 of 2 signatures to be valid  
> **username_0**: So only one of `1CmMoanE9uahYETLahBTGZSFZSQGV8ADrR` and `12z2brRNYFkqJe3zP58uoiGcLqDxfk6J7r` is required to unlock funds ?  
> **username_3**: username_0, yes  
> **username_1**: Annoying that it can't handle large hex strings since on CLI, "Argument list too long" on Linux.  

---

