additional data available to compiler operations, e.g. transaction signing serialization components
a list of valid compiler operations for
Key
and HdKey
variables, e.g. 'public_key' | 'signature'
, or false
if
only a single compiler operation is used for all instances
a list of valid compiler
operations for Key
and HdKey
variables, e.g.
"version" | "transaction_outpoints" | ...
, or false
if only a single
compiler operation is used for all signing_serialization
instances
a list of valid compiler
operations for AddressData
variables or false
if only a single compiler
operation is used for all AddressData
instances (default: false
)
a list of valid compiler
operations for WalletData
variables or false
if only a single compiler
operation is used for all WalletData
instances (default: false
)
a list of valid compiler
operations for current_block_height
variables or false
if only a single
compiler operation is used for all instances (default: false
)
a list of valid compiler
operations for current_block_time
variables or false
if only a single
compiler operation is used for all instances (default: false
)
Optional
createA method that accepts the compiled bytecode contents of a CashAssembly evaluation and produces the equivalent AuthenticationProgram to be evaluated by the VM. This method is used internally to compute CashAssembly evaluations. See createAuthenticationProgramEvaluationCommon for details.
A method that accepts the compiled bytecode contents of a CashAssembly evaluation and produces the equivalent AuthenticationProgram to be evaluated by the VM. This method is used internally to compute CashAssembly evaluations. See createAuthenticationProgramEvaluationCommon for details.
Optional
entityAn object mapping template variable identifiers to the entity identifiers
responsible for them. This is required for HdKey
support, as each entity
uses a single HD private key (provided in hdKeys.hdPrivateKeys
) or HD
public key (provided in hdKeys.hdPublicKeys
) per compilation, and each
HdKey
variable is derived from this key.
To avoid compilation errors, this object must contain all HdKey
variables
referenced by the script being compiled (including in child scripts). To
enable support for error handling like extractMissingVariables,
it's recommended that all variables be provided here.
Optional
lockingAn object mapping the script identifiers of locking scripts to their
locking script type, either standard
or p2sh20
.
This is used to transform compilation results into the proper structure for P2SH20 locking and unlocking scripts.
When compiling locking scripts of type p2sh20
, the result will be placed
in a P2SH20 "redeemScript" format:
OP_HASH160 <$(<result> OP_HASH160)> OP_EQUAL
When compiling unlocking scripts that unlock locking scripts of type
p2sh20
, the result will be transformed into the P2SH20 unlocking format:
result <locking_script>
(where locking_script
is the compiled bytecode
of the locking script, without the "redeemScript" transformation.)
By default, all scripts are assumed to have the type standard
.
Optional
opcodes?: { An object mapping opcode identifiers to the bytecode they generate.
Optional
operations?: { An object specifying the operations made available by this compiler
configuration for each variable type. For example, keys typically support
public key derivation (.public_key
) and several signature types.
Compiler operations can be specified as a single operation for all
instances of a variable type (as is the default for AddressData
or
WalletData
), or they can be specified as an object, where each key is a
valid operation name (as is the default for Key
and HdKey
).
Optional
addressOptional
currentOptional
currentOptional
hdOptional
key?: CompilerKeyOperations extends stringOptional
signingOptional
walletOptional
ripemd160?: { An implementation of ripemd160 is required for any scripts that include
HdKey
s. This can be instantiated with instantiateRipemd160.
Optional
scenarios?: { An object mapping scenario identifiers to the WalletTemplateScenarios they represent.
An object mapping script identifiers to the text of script in CashAssembly.
To avoid compilation errors, this object must contain all scripts referenced by the script being compiled (including children of children).
Optional
secp256k1?: { An implementation of secp256k1 is required for any scripts that include signatures. This can be instantiated with instantiateSecp256k1.
Optional
sha256?: { An implementation of sha256 is required for any scripts that include signatures. This can be instantiated with instantiateSha256.
Optional
sha512?: { An implementation of sha512 is required for any scripts that include
HdKey
s. This can be instantiated with instantiateSha512.
Optional
sourceOnly for use when recursively calling compileScript (e.g. in compiler operations).
The "breadcrumb" path of script IDs currently being compiled, including the
current script. (E.g. ["grandparentId", "parentId", "scriptId"]
)
CashAssembly identifier resolution must be acyclic. To prevent an infinite
loop, IdentifierResolutionFunctions must abort resolution if they
encounter their own id
while resolving another identifier. Likewise,
child scripts being resolved by a parent script may not reference any
script that is already in the process of being resolved.
Optional
unlockingAn object mapping the identifiers of unlocking scripts to their
timeLockType
.
The timestamp
type indicates that the transaction's locktime is provided
as a UNIX timestamp (the locktime
value is greater than or equal to
500000000
).
The height
type indicates that the transaction's locktime is provided as
a block height (the locktime
value is less than 500000000
).
See WalletTemplateScript.timeLockType for details.
Optional
unlockingAn object mapping the identifiers of unlocking scripts to the identifiers
of the locking scripts they unlock. This is used to identify the
coveredBytecode
used in signing serializations, and it is required for
all signature operations and many signing serialization operations.
Optional
variables?: { An object mapping template variable identifiers to the WalletTemplateVariable describing them.
To avoid compilation errors, this object must contain all variables referenced by the script being compiled (including in child scripts).
Optional
vm?: AuthenticationVirtualMachine<any, any, any>The AuthenticationVirtualMachine on which CashAssembly evaluation
results will be computed.
A CompilerConfiguration must include a subset of the script's WalletTemplate – all the variables and scripts referenced (including children of children) by the script in question.
The context must also include an object mapping of opcode identifiers to the bytecode they generate.
If keys are used, an implementation of sha256
and secp256k1
is
required. If the script requires evaluations during compilation, the
evaluating AuthenticationVirtualMachine must also be included.
Generated using TypeDoc
The full context required to compile a given CashAssembly Template script – everything required for the compiler to understand the CompilationData and generate the compiled bytecode (targeting a specific AuthenticationVirtualMachine).