Class: Input

primitives.Input(options)

Input Represents a transaction input.

Constructor

new Input(options)

Create transaction input.

Parameters:
Name Type Description
options Object
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:

(private) fromJSON(json)

Inject properties from a JSON object.

Parameters:
Name Type Description
json Object
Source:

(private) fromOptions(options)

Inject properties from options object.

Parameters:
Name Type Description
options Object
Source:

(private) fromOutpoint(outpoint)

Inject properties from outpoint.

Parameters:
Name Type Description
outpoint Outpoint
Source:

(private) fromTX(tx, index)

Inject properties from transaction.

Parameters:
Name Type Description
tx TX
index Number
Source:

getAddress(coinnullable) → (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 <nullable>
Source:
Returns:

addr

Type
Address

getHash(coinnullable) → {Hash}

Get the address hash.

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

hash

Type
Hash

getJSON(network, coin, path) → {Object}

Convert the input to an object suitable for JSON serialization.

Parameters:
Name Type Description
network Network
coin Coin
path Path
Source:
Returns:
Type
Object

getSize() → {Number}

Calculate size of serialized input.

Source:
Returns:
Type
Number

inject() → {Input}

Clone the input.

Source:
Returns:
Type
Input

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

(private) read(br)

Inject properties from buffer reader.

Parameters:
Name Type Description
br BufferReader
Source:

write(bw)

Write the input to a buffer writer.

Parameters:
Name Type Description
bw BufferWriter
Source: