This section has been updated to Bitcoin Core @ v23.0

Script origins

  1. New scripts are created when creating a new address.

  2. Scripts can be learned about when we receive a new transaction from the P2P network or from a newly-connected block.

  3. With Taproot there may be scripts in alternative Tapscript execution paths which nobody on the network will ever learn about.

Scripts in Bitcoin Core

The primary script objects are found in script.h. An enum over all the permitted OPCODES, enum opcodetype. The CScriptNum class which handles arithmetic operations on integer CScriptNums, whether from a loose int_64t or from a second CScriptNum object. The CScript class which supports serializing data into scripts, along with many helper functions such as returning the script type.

Table of contents