address of a multisignature who signed a transaction

+2 votes
Dear MC team,

in my scenario I have a 1-of-3 mutlisignature address who owns an asset.

Now this multisignature adress sends it to a new address.

The transaction is offline signed by one of the the three address and the transaction is broadcated and validated by the network.

How can I get the address who signed it once I know the txid?

Thanks for your help.

  Fabio
asked Mar 15 by Fabio

1 Answer

0 votes

First, use this to decode the transaction:

getrawtransaction <txid> true

Then extract from this JSON the hexadecimal string after the space in the asm field of the scriptSig of the input in vin whose signature you are interested in knowing (probably there is only one input so the first).

Finally, pass this string (which is a hexadecimal public key) to validateaddress to get the corresponding address.

answered Mar 16 by MultiChain
Thanks team.
Actually my json is the following:
    "vin" : [
        {
            "txid" : "c957fcbbe90590a6dce54ab61618a03193fb9799ef4820455d1db00ccc3ff4e2",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "0 3045022100db30f7d023c65f3920c6bde7a722304310618be4610fe85fe76e0de537a68541022017140739c6259a7a1d87801471da494407f20616dbba4e807deac37030c90a6f01 512102ac597f3662902130bc452378a76f39036021df9bb0172c350900586763713288210303dac8ea0daa1711bfeeb377abeb099b1f67e16926f706c1bde471d679165df42102b0e74cfeb618f6099bc4c740fda5db01ea9f2f9ad8a3458a4d3946dc5e582e8153ae",
                "hex" : "00483045022100db30f7d023c65f3920c6bde7a722304310618be4610fe85fe76e0de537a68541022017140739c6259a7a1d87801471da494407f20616dbba4e807deac37030c90a6f014c69512102ac597f3662902130bc452378a76f39036021df9bb0172c350900586763713288210303dac8ea0daa1711bfeeb377abeb099b1f67e16926f706c1bde471d679165df42102b0e74cfeb618f6099bc4c740fda5db01ea9f2f9ad8a3458a4d3946dc5e582e8153ae"
            },
            "sequence" : 4294967295
        }

so the asm field:
                "asm" : "0 3045022100db30f7d023c65f3920c6bde7a722304310618be4610fe85fe76e0de537a68541022017140739c6259a7a1d87801471da494407f20616dbba4e807deac37030c90a6f01 512102ac597f3662902130bc452378a76f39036021df9bb0172c350900586763713288210303dac8ea0daa1711bfeeb377abeb099b1f67e16926f706c1bde471d679165df42102b0e74cfeb618f6099bc4c740fda5db01ea9f2f9ad8a3458a4d3946dc5e582e8153ae

which is in the form:
0<sig><redeem script>

The ASM is fine in fact I can match with the related previous tx vout:
OP_HAS160 <20 byte hash of redeem script> EQUAL

But I cannot understand which one of the 3 addresses forming the P2SH signed it because:
validateaddress 3045022100db30f7d023c65f3920c6bde7a722304310618be4610fe85fe76e0de537a68541022017140739c6259a7a1d87801471da494407f20616dbba4e807deac37030c90a6f01

or
validateaddress 512102ac597f3662902130bc452378a76f39036021df9bb0172c350900586763713288210303dac8ea0daa1711bfeeb377abeb099b1f67e16926f706c1bde471d679165df42102b0e74cfeb618f6099bc4c740fda5db01ea9f2f9ad8a3458a4d3946dc5e582e8153ae

gives me

{
    "isvalid" : false
}

How can I do that?
You're right, it's more complicated if it's a multisig. You can extract the verification script itself using decodescript <second field in asm> but this will just show the required addresses, not who actually signed it. I'll see if I can get you a better answer.
So I'm afraid there's no simple way to do this using MultiChain APIs, because it would require reproducing the behavior of multisig checking (as per OP_CHECKMULTISIG in the redeem script), to find out which of the public keys matches the signature in the input. But you may be able to find solutions out there for bitcoin multisig decoding, which will also work with MultiChain, with the only difference being the final step of converting the correct public key to an address (and for that you can use validateaddress).
...