Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I list all unique scripts in the block chain, and their count (n-times-used)?

share|improve this question
up vote 1 down vote accepted

If you are looking for actual input scripts then the answer is simple: if there are n outputs being claimed then there are exactly n distinct scripts that are used exactly once. This is because each script includes a signature for a particular output that is being claimed, and they should be unique (that is excluding random collision, which are extremely unlikely).

If you are looking for output scripts then the number of distinct scripts is likely to be the number of addresses that received an incoming transaction, as they contain the addresses that may claim the output.

This is ofcourse just for the standard transactions in which you put up a claiming condition by requiring a single signature from an address and then provide the matching signature when claiming it.

More interesting could be the number of distinct script formats. That is counting the unique types of scripts, for example by just replacing all signatures and hashes with a placeholder and then counting them.

As far as I know does not currently offer such a functionality, but they might be interested to include it.

share|improve this answer
Like this item, "scriptPubKey":"OP_DUP OP_HASH160 2d56f654aa5353bc05587a30e3f16e15cf7aaf99 OP_EQUALVERIFY OP_CHECKSIG" – Mar 6 '13 at 10:49
That would be the second option, which would have a new script for each address that ever received an incoming transaction. – cdecker Mar 6 '13 at 11:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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