Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface CompilationData<TransactionContext>

Data required at compilation time to generate the bytecode for a particular Bitauth Template script.

Type parameters

  • TransactionContext

Hierarchy

  • CompilationData

Index

Properties

Optional bytecode

bytecode: undefined | {}

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 which have been pre-computed by other entities (e.g. when computing these would require access to private keys held by another entities).

The provided fullIdentifier should match the complete identifier for each item, e.g. some_wallet_data, variable_id.public_key, or variable_id.signature.all_outputs.

To provide AddressData or WalletData from advanced user interfaces, consider parsing input with compileBtl.

remarks

It is security-critical that only identifiers provided by the entities expected to provide them are included here. For example:

  1. When generating a lockingBytecode for a 2-of-2 wallet, a malicious entity could provide a pre-computed value for us.public_key which is equal to them.public_key such that the resulting lockingBytecode is entirely controlled by that entity.

  2. When generating an unlockingBytecode which 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 currentBlockHeight

currentBlockHeight: undefined | number

The current block height at address creation time.

Optional currentBlockTime

currentBlockTime: undefined | number

The 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 hdKeys

hdKeys: undefined | { addressIndex?: undefined | number; hdPrivateKeys?: undefined | {}; hdPublicKeys?: undefined | {} }

An object describing the settings used for HdKey variables in this compilation.

Optional keys

keys: undefined | { privateKeys?: undefined | {} }

An object describing the settings used for Key variables in this compilation.

Optional transactionContext

transactionContext: TransactionContext

The TransactionContext expected by this particular compiler for any operations used in the compilation.

Generated using TypeDoc