Optional
bytecode?: { A map of full identifiers to pre-computed bytecode for this compilation.
This is always used to provide bytecode for AddressData
and WalletData
,
and it can also be used to provide public keys and signatures that have
been pre-computed by other entities (e.g. when computing these would
require access to private keys held by another entity).
The provided fullIdentifier
should match the complete identifier for
each item, e.g. some_wallet_data
, variable_id.public_key
, or
variable_id.schnorr_signature.all_outputs
.
To provide AddressData
or WalletData
from advanced user interfaces,
consider parsing input with compileCashAssembly
.
It is security-critical that only identifiers provided by the entities expected to provide them are included here. For example:
When generating a lockingBytecode
for a 2-of-2 wallet, a
malicious entity could provide a pre-computed value for us.public_key
that is equal to them.public_key
such that the resulting
lockingBytecode
is entirely controlled by that entity.
When generating an unlockingBytecode
that includes a data signature,
if a malicious entity can provide a pre-computed value for identifiers
present in the message, the malicious entity can trick the compiling entity
into signing an unintended message, e.g. creating a false attestation or
releasing funds from an unrelated wallet. (This can be partially mitigated
by avoiding key reuse.)
To safely include identifiers from external entities, the compilation must first be evaluated only with trusted information (variables owned by or previously validated by the compiling entity). On unsuccessful compilations, missing variables can be extracted with extractMissingVariables, and each missing variable should be filled only by bytecode values provided by entities from which they were expected.
Optional
compilationThe CompilationContext expected by this particular compiler for any operations used in the compilation.
Optional
currentThe current block height at address creation time.
Optional
currentThe current MTP block time as a UNIX timestamp at address creation time.
Note, this is never a current timestamp, but rather the median timestamp of the last 11 blocks. It is therefore approximately one hour in the past.
Every block has a precise MTP block time, much like a block height. See BIP113 for details.
Optional
hdAn object describing the settings used for WalletTemplateHdKey variables in this compilation.
Optional
addressThe current address index to be used for this compilation. The
addressIndex
gets added to each
WalletTemplateHdKey.addressOffset to calculate
the dynamic index (i
) used in each
WalletTemplateHdKey.privateDerivationPath or
WalletTemplateHdKey.publicDerivationPath.
This is required for any compiler operation that requires derivation. Typically, the value is incremented by one for each address in a wallet.
Optional
hdA map of entity IDs to HD private keys. These HD private keys are used to
derive each HdKey
variable assigned to that entity (as
specified in CompilerConfiguration.entityOwnership) according to
its WalletTemplateHdKey.privateDerivationPath.
HD private keys may be encoded for either mainnet or testnet (the network information is ignored).
If both an HD private key (in hdPrivateKeys
) and HD public key (in
hdPublicKeys
) are provided for the same entity in the same compilation
(not recommended), only the HD private key is used.
Optional
hdA map of entity IDs to HD public keys. These HD public keys are used to
derive public keys for each HdKey
variable assigned to that entity (as
specified in CompilerConfiguration.entityOwnership) according to
its WalletTemplateHdKey.publicDerivationPath.
HD public keys may be encoded for either mainnet or testnet (the network information is ignored).
If both an HD private key (in hdPrivateKeys
) and HD public key (in
hdPublicKeys
) are provided for the same entity in the same compilation
(not recommended), the HD private key is used.
Optional
keys?: { An object describing the settings used for WalletTemplateKey variables in this compilation.
Note that public keys are not provided in this object. Instead, public keys
are provided directly via the bytecode
object; this is because – much
like signatures or address data – public keys require no further processing
by collaborating entities once shared by their owning entity.
Optional
privateA map of Key
variable IDs to their private keys for this compilation.
Generated using TypeDoc
Data required at compilation time to generate the bytecode for a particular CashAssembly Template script.