Class: Input

primitives.Input(optionsopt, nullable)

Input Represents a transaction input.

Constructor

new Input(optionsopt, nullable)

Create transaction input.

Parameters:
Name Type Attributes Description
options Object <optional>
<nullable>
Properties:
Name Type Description
prevout Outpoint

Outpoint.

script Script

Input script / scriptSig.

sequence Number

nSequence.

witness Witness

Witness (empty if not present).

Source:

Methods

(static) fromCoin(coin) → {Input}

Instantiate input from coin.

Parameters:
Name Type Description
coin Coin
Source:
Returns:
Type
Input

(static) fromOutpoint(outpoint) → {Input}

Instantiate input from outpoint.

Parameters:
Name Type Description
outpoint Outpoint
Source:
Returns:
Type
Input

(static) fromTX(tx, index) → {Input}

Instantiate input from tx.

Parameters:
Name Type Description
tx TX
index Number
Source:
Returns:
Type
Input

(static) isInput(obj) → {Boolean}

Test an object to see if it is an Input.

Parameters:
Name Type Description
obj Object
Source:
Returns:
Type
Boolean

compare(input) → {Number}

Compare against another input (BIP69).

Parameters:
Name Type Description
input Input
Source:
Returns:
Type
Number

equals(input) → {Boolean}

Test equality against another input.

Parameters:
Name Type Description
input Input
Source:
Returns:
Type
Boolean

format(coinnullable) → {Object}

Convert the input to a more user-friendly object.

Parameters:
Name Type Attributes Description
coin Coin <nullable>
Source:
Returns:
Type
Object

(private) fromCoin(coin)

Inject properties from coin.

Parameters:
Name Type Description
coin Coin
Source:

fromJSON(json) → {this}

Inject properties from a JSON object.

Parameters:
Name Type Description
json InputJSON
Source:
Returns:
Type
this

fromOptions(options)

Inject properties from options object.

Parameters:
Name Type Description
options Object
Source:

fromOutpoint(outpoint) → {this}

Inject properties from outpoint.

Parameters:
Name Type Description
outpoint Outpoint
Source:
Returns:
Type
this

fromTX(tx, index)

Inject properties from transaction.

Parameters:
Name Type Description
tx TX
index Number
Source:

getAddress(coinopt, nullable) → (nullable) {Address}

Get the previous output script's address. Will "guess" based on the input script and/or witness if coin is not available.

Parameters:
Name Type Attributes Description
coin Coin <optional>
<nullable>
Source:
Returns:

addr

Type
Address

getHash(coinopt, nullable) → (nullable) {Hash}

Get the address hash.

Parameters:
Name Type Attributes Description
coin Coin <optional>
<nullable>
Source:
Returns:

hash

Type
Hash

getJSON(networkopt, coinopt, pathopt)

Convert the input to an object suitable for JSON serialization.

Parameters:
Name Type Attributes Description
network NetworkType | Network <optional>
coin Coin <optional>
path Path <optional>
Source:

getSize() → {Number}

Calculate size of serialized input.

Source:
Returns:
Type
Number

inject(input) → {this}

Clone the input.

Parameters:
Name Type Description
input this
Source:
Returns:
Type
this

isCoinbase() → {Boolean}

Test to see if outpoint is null.

Source:
Returns:
Type
Boolean

isFinal() → {Boolean}

Test to see if nSequence is equal to uint32max.

Source:
Returns:
Type
Boolean

read(br) → {this}

Inject properties from buffer reader.

Parameters:
Name Type Description
br bio.BufferReader
Source:
Returns:
Type
this

write(bw) → {BufioWriter}

Write the input to a buffer writer.

Parameters:
Name Type Description
bw BufioWriter
Source:
Returns:
Type
BufioWriter