1

Running decodescript on d1a076722d11ddfd0fadb96d6d960b8b2ad6c6369570cd00df70a801a6be9e44 is returning:

{
  "asm": "0 30440220278ee027abaf4720f580ce469139d75e330e120f91ff52b2c73955a712b96f3902204f11b7b1541dee5497cffd50291347b796e44ab1b6dac845d43a7185fdda184901 3045022100c3602c2872248e73f543fbf21ddc9fa3b73052261f619452fd5254852c9ea55102202c1323830f38a6fe149e0eccb18f92eba962165733285812deb96bcb8482de5d01 30450221008caaadf9b887828d02911ff22df335606c372f968d5c2ea0fa2f8c1a083fe5f502204c55eb85c0f06e10d488d7643a5c571bbabdeb935acc917836d44e755db6b1f601 532102939a016f9a4cfc4c73ba395c2baf16382a4de078dadf2bafaaac6846d786ed392102c7cf0bd62fb500d8f6ed39a46c7e72dc1b5185754e1a48d25a22195f113b35d8210306179c491a25d6db330a3a3e3ba0788b3ccea45aebfa2a06fc114787aadc01532103b8a79bd499afbc0f4b68e4c0e175176a013b1e2143da6ec95772add5c6728d6d2103bec7b18285d7af85b4f2c0936a106b746eaad14071f41788257fdffeb2e68e9a2103e4fda639ffcf2d996dc372db5eda18857afdd21054009d65ddd17ce96d5feed22103f5d1065abd2a8b5adc6ecda48712d2a572a24130b786f538629ff834b298379857ae",
  "type": "nonstandard",
  "p2sh": "32QZxW8qHSufifvr5UzXpzGG6jdcgnTCSF",
  "segwit": {
    "asm": "0 59d0d03149e611e8f8e879ab7c1133c99091ec09758ed29a9111341e424d9891",
    "hex": "002059d0d03149e611e8f8e879ab7c1133c99091ec09758ed29a9111341e424d9891",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "bc1qt8gdqv2fucg7378g0x4hcyfnexgfrmqfwk8d9x53zy6pusjdnzgsdvlm7s"
    ],
    "p2sh-segwit": "36sk1CLrrv8HXgE1d1CKkNkwnK2tWKeWSL"
  }
}

The original Hex:

004730440220278ee027abaf4720f580ce469139d75e330e120f91ff52b2c73955a712b96f3902204f11b7b1541dee5497cffd50291347b796e44ab1b6dac845d43a7185fdda184901483045022100c3602c2872248e73f543fbf21ddc9fa3b73052261f619452fd5254852c9ea55102202c1323830f38a6fe149e0eccb18f92eba962165733285812deb96bcb8482de5d014830450221008caaadf9b887828d02911ff22df335606c372f968d5c2ea0fa2f8c1a083fe5f502204c55eb85c0f06e10d488d7643a5c571bbabdeb935acc917836d44e755db6b1f6014cf1532102939a016f9a4cfc4c73ba395c2baf16382a4de078dadf2bafaaac6846d786ed392102c7cf0bd62fb500d8f6ed39a46c7e72dc1b5185754e1a48d25a22195f113b35d8210306179c491a25d6db330a3a3e3ba0788b3ccea45aebfa2a06fc114787aadc01532103b8a79bd499afbc0f4b68e4c0e175176a013b1e2143da6ec95772add5c6728d6d2103bec7b18285d7af85b4f2c0936a106b746eaad14071f41788257fdffeb2e68e9a2103e4fda639ffcf2d996dc372db5eda18857afdd21054009d65ddd17ce96d5feed22103f5d1065abd2a8b5adc6ecda48712d2a572a24130b786f538629ff834b298379857ae

Blockstream explorer is returning the script in form of OP_CODEs, my question is, is there any python library that can decode it to the same state?

enter image description here

1 Answer 1

1

There are at least two I'm aware of: Python-bitcoinlib and bitcoin_tools

2
  • 1
    Thanks, I was aware of the libraries, and Peter Todd's one looks legit for this case, but all the methods there relates to script evaluation/serialization rather than to decoding the content of decoderawtransaction into SCRIPT. I am just confused on which method to use to get the result that's being shown by blockchain explorer.
    – Tony Sanak
    Nov 16, 2019 at 1:42
  • 1
    Not sure what method you should use in Python-bitcoinlib. You can construct a transaction or script from hex in bitcoin_tools and call the deserialize to get that representation: github.com/sr-gi/bitcoin_tools/blob/master/bitcoin_tools/core/…
    – sr_gi
    Nov 17, 2019 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.