Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface AuthenticationTemplateScenario

An object describing the configuration for a particular scenario within an authentication template.

Hierarchy

  • AuthenticationTemplateScenario

Index

Properties

Optional data

An object defining the data to use while compiling this scenario. The properties specified here are used to extend the existing scenario data based on this scenario's extends property.

Each property is extended individually – to unset a previously-set property, the property must be individually overridden in this object.

Optional description

description: undefined | string

An optionally multi-line, free-form, human-readable description for this scenario (for use in user interfaces). If displayed, this description should use a monospace font to properly render ASCII diagrams.

Optional extends

extends: undefined | string

The identifier of the scenario which this scenario extends. Any data or transaction properties not defined in this scenario inherit from the extended parent scenario.

If undefined, this scenario is assumed to extend the default scenario:

  • The default values for data are set:

    • The identifiers of all Key variables and entities in this template are lexicographically sorted, then each is assigned an incrementing positive integer – beginning with 1 – encoded as an unsigned, 256-bit, big-endian integer (i.e. 0x0000...0001 (32 bytes), 0x0000...0002, 0x0000...0003, etc.). For Keys, this assigned value is used as the private key; For entities, the assigned value is used as the master seed of that entity's HdPrivateKey. If hdKey is set, the addressIndex is set to 0.
    • currentBlockHeight is set to 2. This is the height of the second mined block after the genesis block: 000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd. This default value was chosen to be low enough to simplify the debugging of block height offsets while remaining differentiated from 0 and 1 which are used both as boolean return values and for control flow.
    • currentBlockTime is set to 1231469665. This is the Median Time-Past block time (BIP113) of block 2.
  • Then transaction is set based on use:

    • if the scenario is being used for transaction estimation, all transaction properties are taken from the transaction being estimated.
    • if the scenario is being used for script testing and validation, the default value for each transaction property used.

When a scenario is extended, each property of data and transaction is extended individually: if the extending scenario does not provide a new value for data.bytecode.value or transaction.property, the parent value is used. To avoid inheriting a parent value, each child value must be individually overridden.

Optional name

name: undefined | string

A single-line, Title Case, human-readable name for this scenario for use in user interfaces, e.g.: Delayed Recovery.

Optional transaction

transaction: undefined | { inputs?: AuthenticationTemplateScenarioInput[]; locktime?: undefined | number; outputs?: AuthenticationTemplateScenarioOutput[]; version?: undefined | number }

The transaction within which this scenario should be evaluated. This is used for script testing and validation.

If undefined, inherits the default value for each property:

{
  "inputs": [{ "unlockingBytecode": null }],
  "locktime": 0,
  "outputs": [{ "lockingBytecode": "" }],
  "version": 2
}

Any transaction property which is not set will be inherited from the scenario specified by extends. when specifying the inputs and outputs properties, each input and output extends the default values for inputs and outputs, respectively.

For example, an input of {} is interpreted as:

{
  "outpointIndex": 0,
  "outpointTransactionHash":
    "0000000000000000000000000000000000000000000000000000000000000000",
  "sequenceNumber": 0
}

And an output of {} is interpreted as:

{
  "lockingBytecode": {
    "script": null,
    "overrides": { "hdKeys": { "addressIndex": 1 } }
  },
  "satoshis": 0
}

Optional value

value: number | string

The value in satoshis of the hypothetical output being spent by the input under test in this scenario.

May be encoded as either a number (for values below 2^53-1) or a little-endian, unsigned 64-bit integer in hexadecimal format (a 16-character string).

If undefined, defaults to 0.

Generated using TypeDoc