<p>It depends on whether its a "Pay to Script Hash" (see <a href="https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki" rel="nofollow">BIP 16</a>) multi-signature transaction or just a bare multi-signature transaction. </p>

<p>If it's a "Pay to Script Hash", you need to know all the other public keys involved including your own so you can figure out the script hash. </p>

<p>If it's a bare transaction, than you just need to know your own public key as each public key involved in the multi-signature transaction is listed in the output script. </p>

CC BY-SA 3.0
2014-08-08T22:46:13.547Z
2014-08-08T22:46:13.547Z
k kurokawa
<p>I did this before - move through the blockchain doing getblock() on each block.. For each tx, decode it, and loop through each output. Analyze the scriptPubKey of each output - if it matches 'OP_HASH160  OP_EQUAL' then you know that the output is paying to a pay-to-script-hash address.</p>

<p>An important note - scripts aren't revealed in the funding transaction, so you don't know if the tx IS a multisig just by looking at the funding output, only that it's pay-to-script-hash. </p>

<p>If it's for a wallet:
A wallet can only realize multisig coins belong to it when it has all the public keys, and can produce the necessary script. Wallets are simply scrapers for Pay-to-pubkey-hash or Pay-to-script-hash transactions where you have a pubkey hash or script hash respectively, in your wallet already.</p>

<p>If you're researching these tx's:
You can learn the redeemScript when the funds are redeemed. I think there were 14000 multisig outputs that weren't spam, but only 7000 of these were ever redeemed. So, you can only learn if these 7000 were multisig. </p>

<p><a href="http://www.coindesk.com/year-multisig-so-far/" rel="nofollow">http://www.coindesk.com/year-multisig-so-far/</a> has some graphs on my analysis. I can give you PHP code to repeat this, although DB queries slowed it down massively - I needed to log all txids with multisig outputs, and then check every input in every transaction if they spent a tx I knew to be a P2SH. I aborted and asked someone else to produce the data...</p>

CC BY-SA 3.0
2014-08-09T09:45:07.327Z
2014-08-09T09:45:07.327Z
karimkorun
<p>How do you scan the UTXO set for multisig UTXOs that you have the keys to sign (or partially sign)?</p>

<p>In other words, how do the wallets know they are part of a multisig transaction?</p>

<multi-signature>
Find Multisig coins
user18688
# Find Multisig coins

(Asked by: username_0 on 2014-08-08)

How do you scan the UTXO set for multisig UTXOs that you have the keys to sign (or partially sign)?

In other words, how do the wallets know they are part of a multisig transaction?

**Tags:** multi-signature


---

## 2 answers

### Answer by username_1 on 2014-08-08. Score: 2

It depends on whether its a "Pay to Script Hash" (see [BIP 16](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki)) multi-signature transaction or just a bare multi-signature transaction.

If it's a "Pay to Script Hash", you need to know all the other public keys involved including your own so you can figure out the script hash.

If it's a bare transaction, than you just need to know your own public key as each public key involved in the multi-signature transaction is listed in the output script.


---

### Answer by username_2 on 2014-08-09. Score: 1

I did this before - move through the blockchain doing getblock() on each block.. For each tx, decode it, and loop through each output. Analyze the scriptPubKey of each output - if it matches 'OP\_HASH160 OP\_EQUAL' then you know that the output is paying to a pay-to-script-hash address.

An important note - scripts aren't revealed in the funding transaction, so you don't know if the tx IS a multisig just by looking at the funding output, only that it's pay-to-script-hash.

If it's for a wallet:
A wallet can only realize multisig coins belong to it when it has all the public keys, and can produce the necessary script. Wallets are simply scrapers for Pay-to-pubkey-hash or Pay-to-script-hash transactions where you have a pubkey hash or script hash respectively, in your wallet already.

If you're researching these tx's:
You can learn the redeemScript when the funds are redeemed. I think there were 14000 multisig outputs that weren't spam, but only 7000 of these were ever redeemed. So, you can only learn if these 7000 were multisig.

<http://www.coindesk.com/year-multisig-so-far/> has some graphs on my analysis. I can give you PHP code to repeat this, although DB queries slowed it down massively - I needed to log all txids with multisig outputs, and then check every input in every transaction if they spent a tx I knew to be a P2SH. I aborted and asked someone else to produce the data...


---

