1

I have seen that someone had asked a similar question: Possible to check who signed the transaction in a multi-sig transaction case?

But I'm currently unable to parse/read the redeem script. When I use the blockdozer API to get the details of the transaction I obtain the "hex" and "asm".

How do I need to parse the "hex" to identify who has signed the transaction? Please find below the transaction ID (it's a Bitcoin Cash transaction, but I believe the multisig part would be the similar): 3a91cd0a55270972d12a42156a24c6a318c39fedce942f2ff28114d63fda5aad

Any help is highly appreciated.

blockdozer.com/api/tx/3a91cd0a55270972d12a42156a24c6a318c39fedce942f2ff28114d63fda5aad

1 Answer 1

1

How do I need to parse the "hex" to identify who has signed the transaction?

In this example, the transaction is fully signed, but there are more n than m (m-of-n) so it's unclear who signed the transaction. Since the signature is done with the user's private key, the only way is to actually validate each signature cryptographically with each public key to see which ones are valid. To parse the hex to get these values, there are many tools, but see below for one way to do it:

  1. Get the raw transaction from https://bitcoincash.blockexplorer.com/api/rawtx/3a91cd0a55270972d12a42156a24c6a318c39fedce942f2ff28114d63fda5aad

0100000001d6ccc50f26df8e894e3411653ab1bfeb2d73c8ddfb956349a3153be852f0997d00000000fd390200483045022100d5d6f8171274750b2ce900cbb6e8110f3b3414607b474bd11f30162b5ebd195b02206ce99cf0296bb3690f278bc0938a7616ee9012d5459cee31b4056a71bd81a60441473044022066597d1177e98e98766551dc92c7f130143af8db83733a5bc02d8fc279c6864b022043144ca986c393d1fb6a7d892444f84235f2c4cf16c0f26681b9d19e21b7f19b414830450221009dd0bb808279283b40b75f75cc2bbd951251ba78cf48676e8009e3a348cde38102202b048321711d84054eec2d4c8e0722d17d1704a9ada1505de6f3a59dff445936414730440220387be39b92918716d3c7f3020a09d145ac12eb0ad5759ea530bd49bf6a8d3ef4022005e949c872c2ad5711b6477cef727c1edd5ef6cad199aea3ec8ff20b0771c33d414d130154210209097c648cfadb3e99bffb0c6f988533635b672c92f20b16453a4bd03ebbe7a82102335c9fbf1276ab297a79acf90a4b2ea6a1c2d73e6e2df94bd4582290e26902d121024c9653527997e36331d831d2229e33b236551033a745c4cf564c3e4db1e3646721026f991aecffecc9c7eaa7f5744bd0fdfc6e88a326601ad015e560c444cba4d0d82102c28b534269e084995c03518a9f10b0d3f38aaf4d91a58b46b19921a9a931d4ee2102e65ad6cc07306e61ad58f5ce670a85b47c8a26e8cb06f5ab9701e42c4da00b11210315df242f0fdead385ea2a5bd4ffdee43404c4c90345c44b11a17363e3d4e6f4421036504a01757aca5130cf6a4e7636295955ce283a44bdf9ce3b6bd3a5523e19ced58aefeffffff01aab40100000000001976a914689b5342b6875ba1df76710dda796f51926ac46c88ac38030800

  1. Decode transaction using bitcoin-cli

$ bitcoin-cli decoderawtransaction <raw-tx-above>

{
  "txid": "3a91cd0a55270972d12a42156a24c6a318c39fedce942f2ff28114d63fda5aad",
  "hash": "3a91cd0a55270972d12a42156a24c6a318c39fedce942f2ff28114d63fda5aad",
  "version": 1,
  "size": 656,
  "vsize": 656,
  "weight": 2624,
  "locktime": 525112,
  "vin": [
    {
      "txid": "7d99f052e83b15a3496395fbddc8732debbfb13a6511344e898edf260fc5ccd6",
      "vout": 0,
      "scriptSig": {
        "asm": "0 3045022100d5d6f8171274750b2ce900cbb6e8110f3b3414607b474bd11f30162b5ebd195b02206ce99cf0296bb3690f278bc0938a7616ee9012d5459cee31b4056a71bd81a60441 3044022066597d1177e98e98766551dc92c7f130143af8db83733a5bc02d8fc279c6864b022043144ca986c393d1fb6a7d892444f84235f2c4cf16c0f26681b9d19e21b7f19b41 30450221009dd0bb808279283b40b75f75cc2bbd951251ba78cf48676e8009e3a348cde38102202b048321711d84054eec2d4c8e0722d17d1704a9ada1505de6f3a59dff44593641 30440220387be39b92918716d3c7f3020a09d145ac12eb0ad5759ea530bd49bf6a8d3ef4022005e949c872c2ad5711b6477cef727c1edd5ef6cad199aea3ec8ff20b0771c33d41 54210209097c648cfadb3e99bffb0c6f988533635b672c92f20b16453a4bd03ebbe7a82102335c9fbf1276ab297a79acf90a4b2ea6a1c2d73e6e2df94bd4582290e26902d121024c9653527997e36331d831d2229e33b236551033a745c4cf564c3e4db1e3646721026f991aecffecc9c7eaa7f5744bd0fdfc6e88a326601ad015e560c444cba4d0d82102c28b534269e084995c03518a9f10b0d3f38aaf4d91a58b46b19921a9a931d4ee2102e65ad6cc07306e61ad58f5ce670a85b47c8a26e8cb06f5ab9701e42c4da00b11210315df242f0fdead385ea2a5bd4ffdee43404c4c90345c44b11a17363e3d4e6f4421036504a01757aca5130cf6a4e7636295955ce283a44bdf9ce3b6bd3a5523e19ced58ae",
        "hex": "00483045022100d5d6f8171274750b2ce900cbb6e8110f3b3414607b474bd11f30162b5ebd195b02206ce99cf0296bb3690f278bc0938a7616ee9012d5459cee31b4056a71bd81a60441473044022066597d1177e98e98766551dc92c7f130143af8db83733a5bc02d8fc279c6864b022043144ca986c393d1fb6a7d892444f84235f2c4cf16c0f26681b9d19e21b7f19b414830450221009dd0bb808279283b40b75f75cc2bbd951251ba78cf48676e8009e3a348cde38102202b048321711d84054eec2d4c8e0722d17d1704a9ada1505de6f3a59dff445936414730440220387be39b92918716d3c7f3020a09d145ac12eb0ad5759ea530bd49bf6a8d3ef4022005e949c872c2ad5711b6477cef727c1edd5ef6cad199aea3ec8ff20b0771c33d414d130154210209097c648cfadb3e99bffb0c6f988533635b672c92f20b16453a4bd03ebbe7a82102335c9fbf1276ab297a79acf90a4b2ea6a1c2d73e6e2df94bd4582290e26902d121024c9653527997e36331d831d2229e33b236551033a745c4cf564c3e4db1e3646721026f991aecffecc9c7eaa7f5744bd0fdfc6e88a326601ad015e560c444cba4d0d82102c28b534269e084995c03518a9f10b0d3f38aaf4d91a58b46b19921a9a931d4ee2102e65ad6cc07306e61ad58f5ce670a85b47c8a26e8cb06f5ab9701e42c4da00b11210315df242f0fdead385ea2a5bd4ffdee43404c4c90345c44b11a17363e3d4e6f4421036504a01757aca5130cf6a4e7636295955ce283a44bdf9ce3b6bd3a5523e19ced58ae"
      },
      "sequence": 4294967294
    }
  ],
  "vout": [
    {
      "value": 0.00111786,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 689b5342b6875ba1df76710dda796f51926ac46c OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914689b5342b6875ba1df76710dda796f51926ac46c88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "mq44eC2t6nt6KbmWGsM1RxjmhvP7ZWVVLq"
        ]
      }
    }
  ]
}

The scriptSig field of the first input contains the signatures and the redeemScript. You can see that there are 4 signatures after the leading 0, and then the redeemScript.

  1. Parse redeemScript

You can parse the redeemScript, for example, using a library I wrote to parse scripts into readable ASM:

$ npm i --save bscript-parser
$ node
> const bs = require('bscript-parser')
undefined
> bs.parseRawScript('54210209097c648cfadb3e99bffb0c6f988533635b672c92f20b16453a4bd03ebbe7a82102335c9fbf1276ab297a79acf90a4b2ea6a1c2d73e6e2df94bd4582290e26902d121024c9653527997e36331d831d2229e33b236551033a745c4cf564c3e4db1e3646721026f991aecffecc9c7eaa7f5744bd0fdfc6e88a326601ad015e560c444cba4d0d82102c28b534269e084995c03518a9f10b0d3f38aaf4d91a58b46b19921a9a931d4ee2102e65ad6cc07306e61ad58f5ce670a85b47c8a26e8cb06f5ab9701e42c4da00b11210315df242f0fdead385ea2a5bd4ffdee43404c4c90345c44b11a17363e3d4e6f4421036504a01757aca5130cf6a4e7636295955ce283a44bdf9ce3b6bd3a5523e19ced58ae', 'hex')

'OP_4 PUSHDATA(33)[0209097c648cfadb3e99bffb0c6f988533635b672c92f20b16453a4bd03ebbe7a8] PUSHDATA(33)[02335c9fbf1276ab297a79acf90a4b2ea6a1c2d73e6e2df94bd4582290e26902d1] PUSHDATA(33)[024c9653527997e36331d831d2229e33b236551033a745c4cf564c3e4db1e36467] PUSHDATA(33)[026f991aecffecc9c7eaa7f5744bd0fdfc6e88a326601ad015e560c444cba4d0d8] PUSHDATA(33)[02c28b534269e084995c03518a9f10b0d3f38aaf4d91a58b46b19921a9a931d4ee] PUSHDATA(33)[02e65ad6cc07306e61ad58f5ce670a85b47c8a26e8cb06f5ab9701e42c4da00b11] PUSHDATA(33)[0315df242f0fdead385ea2a5bd4ffdee43404c4c90345c44b11a17363e3d4e6f44] PUSHDATA(33)[036504a01757aca5130cf6a4e7636295955ce283a44bdf9ce3b6bd3a5523e19ced] OP_8 OP_CHECKMULTISIG'

The redeem script is a 4-of-8 multisig.

Your Answer

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

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