Is it possible to add a hook for custom validation of transactions with a special script "tag" in them? If so, How? In essence, I want to add something similar in functionality to bitcoin script, but far more complex that what that supports. It doesn't matter if most clients/servers will not recognize the extended bitcoin script , provided they will ignore it.

The idea is that a node, when seeing a transaction with a special script payload, would call some external validation routine and only if that succeeded would it then run the standard integrity checks.

Are there supported hooks for this in the JSON-RPC API, any of the various clients, or would it require extensive modification of the source ?

  • 1
    I don't think this will have the effect you expect it to have. All this will do is cause your client to ignore some bitcoins that other clients consider valid -- and this would apply to all bitcoins that ever "passed through" a transaction your logic rejects. Commented Jul 7, 2012 at 8:21

3 Answers 3


If you want the standard client to ignore a part of a script, you should add it in with OP_PUSH and remove with OP_DROP, essentially making it a comment. This schema is similar to how HTML and javascript work. As long as the rest of the transaction confirms to the Bitcoin Protocol, you can put whatever data you want between those two operations, allowing you to create custom scripts.

However, such functionality is very non-standard. You would need to develop your own software for handling such scripts, and as far as I know, there isn't a program that allows you to encode messages in transaction comments easily (I've been looking for one for a long time and I wasn't able to find it).

Alternatively, you could create your own version of Bitcoin and incorporate your non-standard scripts into it, similarly to how Namecoin operates. This would take more effort, but offer a lot more freedom.


It would require a change in the protocol to allow for the use of external validation routines, or any bitcoins spent using the "special" script will never again be spendable by any standard Bitcoin client.

None of the currently available clients offer this feature.


The only data belonging in the block chain is what is necessary for the world to verify it is valid. Anything else is essentially private information between the sender and the receiver.

I don't think there is much point in having nodes with local stricter additional validation rules. What if a transaction is sent that you yourself don't accept, but the rest of the world does?


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.