Class: Stack

script.Stack(itemsopt, nullable)

Stack Represents the stack of a Script during execution.

Constructor

new Stack(itemsopt, nullable)

Create a stack.

Parameters:
Name Type Attributes Description
items Array.<Buffer> <optional>
<nullable>

Stack items.

Properties:
Name Type Description
items Array.<Buffer>

Stack items.

length Number

Size of stack.

Source:

Members

length

Get length.

Source:

length

Set length.

Source:

Methods

(static) isStack(obj) → {Boolean}

Test an object to see if it is a Stack.

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

clear() → {Stack}

Clear the stack.

Source:
Returns:
Type
Stack

entries()

Instantiate a key and value iterator.

Source:

erase(start, end) → {Array.<Buffer>}

Erase stack items.

Parameters:
Name Type Description
start Number
end Number
Source:
Returns:
Type
Array.<Buffer>

format() → {String}

Inspect the stack.

Source:
Returns:

Human-readable stack.

Type
String

get(index) → {Buffer|null}

Get a stack item by index.

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
Buffer | null

inject(stack) → {this}

Clone the stack.

Parameters:
Name Type Description
stack this
Source:
Returns:

Cloned stack.

Type
this

insert(index, item) → {this}

Insert an item.

Parameters:
Name Type Description
index Number
item Buffer
Source:
Returns:
Type
this

pop() → {Buffer|null}

Pop a stack item.

Source:
See:
  • Array#pop
Returns:
Type
Buffer | null

push(item) → {this}

Push item onto stack.

Parameters:
Name Type Description
item Buffer
Source:
See:
  • Array#push
Returns:
Type
this

remove(index) → {Buffer}

Remove an item.

Parameters:
Name Type Description
index Number
Source:
Returns:
Type
Buffer

set(index, item) → {this}

Set stack item at index.

Parameters:
Name Type Description
index Number
item Buffer
Source:
Returns:
Type
this

shift() → {Buffer|null}

Shift a stack item.

Source:
See:
  • Array#shift
Returns:
Type
Buffer | null

swap(i1, i2)

Swap stack values.

Parameters:
Name Type Description
i1 Number

Index 1.

i2 Number

Index 2.

Source:

Symbol.iterator() → {IterableIterator.<Buffer>}

Instantiate a value-only iterator.

Source:
Returns:
Type
IterableIterator.<Buffer>

toASM(decodenullable) → {String}

Format the stack as bitcoind asm.

Parameters:
Name Type Attributes Description
decode Boolean <nullable>

Attempt to decode hash types.

Source:
Returns:

Human-readable script.

Type
String

toString() → {String}

Convert the stack to a string.

Source:
Returns:

Human-readable stack.

Type
String

unshift(item) → {this}

Unshift item from stack.

Parameters:
Name Type Description
item Buffer
Source:
See:
  • Array#unshift
Returns:
Type
this

values() → {IterableIterator.<Buffer>}

Instantiate a value-only iterator.

Source:
Returns:
Type
IterableIterator.<Buffer>