Members
(static) flags :Number
Script and locktime flags. See VerifyFlags.
Type:
- Number
Properties:
Name | Type | Description |
---|---|---|
VERIFY_NONE |
Number | |
VERIFY_P2SH |
Number | |
VERIFY_STRICTENC |
Number | |
VERIFY_DERSIG |
Number | |
VERIFY_LOW_S |
Number | |
VERIFY_NULLDUMMY |
Number | |
VERIFY_SIGPUSHONLY |
Number | |
VERIFY_MINIMALDATA |
Number | |
VERIFY_DISCOURAGE_UPGRADABLE_NOPS |
Number | |
VERIFY_CLEANSTACK |
Number | |
VERIFY_CHECKLOCKTIMEVERIFY |
Number | |
VERIFY_CHECKSEQUENCEVERIFY |
Number | |
VERIFY_WITNESS |
Number | |
VERIFY_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM |
Number | |
VERIFY_MINIMALIF |
Number | |
VERIFY_NULLFAIL |
Number | |
VERIFY_WITNESS_PUBKEYTYPE |
Number | |
VERIFY_MAST |
Number |
- Source:
(static) hashType :SighashType
Sighash Types.
Type:
Properties:
Name | Type | Description |
---|---|---|
ALL |
SighashType | |
NONE |
SighashType | |
SINGLE |
SighashType | |
ANYONECANPAY |
SighashType |
- Default Value:
{"ALL":1,"NONE":2,"SINGLE":3,"ANYONECANPAY":128}
- Source:
(static, constant) hashTypeByVal :RevMap
Sighash types by value.
Type:
- Source:
(static) opcodes :Number
Script opcodes.
Type:
- Number
Properties:
Name | Type | Description |
---|---|---|
OP_FALSE |
Number | |
OP_0 |
Number | |
OP_PUSHDATA1 |
Number | |
OP_PUSHDATA2 |
Number | |
OP_PUSHDATA4 |
Number | |
OP_1NEGATE |
Number | |
OP_RESERVED |
Number | |
OP_TRUE |
Number | |
OP_1 |
Number | |
OP_2 |
Number | |
OP_3 |
Number | |
OP_4 |
Number | |
OP_5 |
Number | |
OP_6 |
Number | |
OP_7 |
Number | |
OP_8 |
Number | |
OP_9 |
Number | |
OP_10 |
Number | |
OP_11 |
Number | |
OP_12 |
Number | |
OP_13 |
Number | |
OP_14 |
Number | |
OP_15 |
Number | |
OP_16 |
Number | |
OP_NOP |
Number | |
OP_VER |
Number | |
OP_IF |
Number | |
OP_NOTIF |
Number | |
OP_VERIF |
Number | |
OP_VERNOTIF |
Number | |
OP_ELSE |
Number | |
OP_ENDIF |
Number | |
OP_VERIFY |
Number | |
OP_RETURN |
Number | |
OP_TOALTSTACK |
Number | |
OP_FROMALTSTACK |
Number | |
OP_2DROP |
Number | |
OP_2DUP |
Number | |
OP_3DUP |
Number | |
OP_2OVER |
Number | |
OP_2ROT |
Number | |
OP_2SWAP |
Number | |
OP_IFDUP |
Number | |
OP_DEPTH |
Number | |
OP_DROP |
Number | |
OP_DUP |
Number | |
OP_NIP |
Number | |
OP_OVER |
Number | |
OP_PICK |
Number | |
OP_ROLL |
Number | |
OP_ROT |
Number | |
OP_SWAP |
Number | |
OP_TUCK |
Number | |
OP_CAT |
Number | |
OP_SUBSTR |
Number | |
OP_LEFT |
Number | |
OP_RIGHT |
Number | |
OP_SIZE |
Number | |
OP_INVERT |
Number | |
OP_AND |
Number | |
OP_OR |
Number | |
OP_XOR |
Number | |
OP_EQUAL |
Number | |
OP_EQUALVERIFY |
Number | |
OP_RESERVED1 |
Number | |
OP_RESERVED2 |
Number | |
OP_1ADD |
Number | |
OP_1SUB |
Number | |
OP_2MUL |
Number | |
OP_2DIV |
Number | |
OP_NEGATE |
Number | |
OP_ABS |
Number | |
OP_NOT |
Number | |
OP_0NOTEQUAL |
Number | |
OP_ADD |
Number | |
OP_SUB |
Number | |
OP_MUL |
Number | |
OP_DIV |
Number | |
OP_MOD |
Number | |
OP_LSHIFT |
Number | |
OP_RSHIFT |
Number | |
OP_BOOLAND |
Number | |
OP_BOOLOR |
Number | |
OP_NUMEQUAL |
Number | |
OP_NUMEQUALVERIFY |
Number | |
OP_NUMNOTEQUAL |
Number | |
OP_LESSTHAN |
Number | |
OP_GREATERTHAN |
Number | |
OP_LESSTHANOREQUAL |
Number | |
OP_GREATERTHANOREQUAL |
Number | |
OP_MIN |
Number | |
OP_MAX |
Number | |
OP_WITHIN |
Number | |
OP_RIPEMD160 |
Number | |
OP_SHA1 |
Number | |
OP_SHA256 |
Number | |
OP_HASH160 |
Number | |
OP_HASH256 |
Number | |
OP_CODESEPARATOR |
Number | |
OP_CHECKSIG |
Number | |
OP_CHECKSIGVERIFY |
Number | |
OP_CHECKMULTISIG |
Number | |
OP_CHECKMULTISIGVERIFY |
Number | |
OP_EVAL |
Number | |
OP_NOP1 |
Number | |
OP_NOP2 |
Number | |
OP_CHECKLOCKTIMEVERIFY |
Number | |
OP_NOP3 |
Number | |
OP_CHECKSEQUENCEVERIFY |
Number | |
OP_NOP4 |
Number | |
OP_NOP5 |
Number | |
OP_NOP6 |
Number | |
OP_NOP7 |
Number | |
OP_NOP8 |
Number | |
OP_NOP9 |
Number | |
OP_NOP10 |
Number | |
OP_PUBKEYHASH |
Number | |
OP_PUBKEY |
Number | |
OP_INVALIDOPCODE |
Number |
- Default Value:
{"OP_FALSE":0,"OP_0":0,"OP_PUSHDATA1":76,"OP_PUSHDATA2":77,"OP_PUSHDATA4":78,"OP_1NEGATE":79,"OP_RESERVED":80,"OP_TRUE":81,"OP_1":81,"OP_2":82,"OP_3":83,"OP_4":84,"OP_5":85,"OP_6":86,"OP_7":87,"OP_8":88,"OP_9":89,"OP_10":90,"OP_11":91,"OP_12":92,"OP_13":93,"OP_14":94,"OP_15":95,"OP_16":96,"OP_NOP":97,"OP_VER":98,"OP_IF":99,"OP_NOTIF":100,"OP_VERIF":101,"OP_VERNOTIF":102,"OP_ELSE":103,"OP_ENDIF":104,"OP_VERIFY":105,"OP_RETURN":106,"OP_TOALTSTACK":107,"OP_FROMALTSTACK":108,"OP_2DROP":109,"OP_2DUP":110,"OP_3DUP":111,"OP_2OVER":112,"OP_2ROT":113,"OP_2SWAP":114,"OP_IFDUP":115,"OP_DEPTH":116,"OP_DROP":117,"OP_DUP":118,"OP_NIP":119,"OP_OVER":120,"OP_PICK":121,"OP_ROLL":122,"OP_ROT":123,"OP_SWAP":124,"OP_TUCK":125,"OP_CAT":126,"OP_SUBSTR":127,"OP_LEFT":128,"OP_RIGHT":129,"OP_SIZE":130,"OP_INVERT":131,"OP_AND":132,"OP_OR":133,"OP_XOR":134,"OP_EQUAL":135,"OP_EQUALVERIFY":136,"OP_RESERVED1":137,"OP_RESERVED2":138,"OP_1ADD":139,"OP_1SUB":140,"OP_2MUL":141,"OP_2DIV":142,"OP_NEGATE":143,"OP_ABS":144,"OP_NOT":145,"OP_0NOTEQUAL":146,"OP_ADD":147,"OP_SUB":148,"OP_MUL":149,"OP_DIV":150,"OP_MOD":151,"OP_LSHIFT":152,"OP_RSHIFT":153,"OP_BOOLAND":154,"OP_BOOLOR":155,"OP_NUMEQUAL":156,"OP_NUMEQUALVERIFY":157,"OP_NUMNOTEQUAL":158,"OP_LESSTHAN":159,"OP_GREATERTHAN":160,"OP_LESSTHANOREQUAL":161,"OP_GREATERTHANOREQUAL":162,"OP_MIN":163,"OP_MAX":164,"OP_WITHIN":165,"OP_RIPEMD160":166,"OP_SHA1":167,"OP_SHA256":168,"OP_HASH160":169,"OP_HASH256":170,"OP_CODESEPARATOR":171,"OP_CHECKSIG":172,"OP_CHECKSIGVERIFY":173,"OP_CHECKMULTISIG":174,"OP_CHECKMULTISIGVERIFY":175,"OP_EVAL":176,"OP_NOP1":176,"OP_NOP2":177,"OP_CHECKLOCKTIMEVERIFY":177,"OP_NOP3":178,"OP_CHECKSEQUENCEVERIFY":178,"OP_NOP4":179,"OP_NOP5":180,"OP_NOP6":181,"OP_NOP7":182,"OP_NOP8":183,"OP_NOP9":184,"OP_NOP10":185,"OP_PUBKEYHASH":253,"OP_PUBKEY":254,"OP_INVALIDOPCODE":255}
- Source:
(static, constant) opcodesByVal :RevMap
Opcodes by value.
Type:
- Source:
(static, constant) STACK_FALSE :Buffer
False stack return value.
Type:
- Buffer
- Source:
(static, constant) STACK_NEGATE :Buffer
-1 stack return value.
Type:
- Buffer
- Source:
(static, constant) STACK_TRUE :Buffer
True stack return value.
Type:
- Buffer
- Source:
(static) types :Number
Output script types.
Type:
- Number
Properties:
Name | Type | Description |
---|---|---|
NONSTANDARD |
Number | |
PUBKEY |
Number | |
PUBKEYHASH |
Number | |
SCRIPTHASH |
Number | |
MULTISIG |
Number | |
NULLDATA |
Number | |
WITNESSMALFORMED |
Number | |
WITNESSSCRIPTHASH |
Number | |
WITNESSPUBKEYHASH |
Number | |
WITNESSMASTHASH |
Number |
- Source:
(static, constant) typesByVal :RevMap
Output script types by value.
Type:
- Source:
Methods
(static) array(value) → {Buffer}
Create a script array. Will convert Numbers and big numbers to a little-endian buffer while taking into account negative zero, minimaldata, etc.
Parameters:
Name | Type | Description |
---|---|---|
value |
Number | BN |
- Source:
Returns:
- Type
- Buffer
Example
assert.deepEqual(Script.array(0), new Buffer(0));
assert.deepEqual(Script.array(0xffee), new Buffer('eeff00', 'hex'));
assert.deepEqual(Script.array(new BN(0xffee)), new Buffer('eeff00', 'hex'));
assert.deepEqual(Script.array(new BN(0x1e).ineg()), new Buffer('9e', 'hex'));
(static) formatASM(code, decodenullable) → {String}
Format script code into bitcoind asm format.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
code |
Array | ||
decode |
Boolean |
<nullable> |
Attempt to decode hash types. |
- Source:
Returns:
Human-readable string.
- Type
- String
(static) formatCode(code) → {String}
Format script code into a human readable-string.
Parameters:
Name | Type | Description |
---|---|---|
code |
Array |
- Source:
Returns:
Human-readable string.
- Type
- String
(static) formatItem(code, decodenullable) → {String}
Format script code into bitcoind asm format.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
code |
Array | ||
decode |
Boolean |
<nullable> |
Attempt to decode hash types. |
- Source:
Returns:
Human-readable string.
- Type
- String
(static) formatStack(code) → {String}
Format script code into a human readable-string.
Parameters:
Name | Type | Description |
---|---|---|
code |
Array |
- Source:
Returns:
Human-readable string.
- Type
- String
(static) formatStackASM(code, decodenullable) → {String}
Format script code into bitcoind asm format.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
code |
Array | ||
decode |
Boolean |
<nullable> |
Attempt to decode hash types. |
- Source:
Returns:
Human-readable string.
- Type
- String
(static) isCompressedEncoding(key) → {Boolean}
Test whether the data element is a compressed key.
Parameters:
Name | Type | Description |
---|---|---|
key |
Buffer |
- Source:
Returns:
- Type
- Boolean
(static) isDummy(datanullable) → {Boolean}
Test whether the data element is a null dummy (a zero-length array).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
Buffer |
<nullable> |
- Source:
Returns:
- Type
- Boolean
(static) isHash(hashnullable) → {Boolean}
Test whether the data element is a ripemd160 hash.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
hash |
Buffer |
<nullable> |
- Source:
Returns:
- Type
- Boolean
(static) isKey(keynullable) → {Boolean}
Test whether the data element is a public key. Note that this does not verify the format of the key, only the length.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
key |
Buffer |
<nullable> |
- Source:
Returns:
- Type
- Boolean
(static) isKeyEncoding(key) → {Boolean}
Test whether the data element is a valid key.
Parameters:
Name | Type | Description |
---|---|---|
key |
Buffer |
- Source:
Returns:
- Type
- Boolean
(static) isSignature(signullable) → {Boolean}
Test whether the data element is a signature. Note that this does not verify the format of the signature, only the length.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
sig |
Buffer |
<nullable> |
- Source:
Returns:
- Type
- Boolean
(static) isSignatureEncoding(sig) → {Boolean}
Test a signature to see if it abides by BIP66.
Parameters:
Name | Type | Description |
---|---|---|
sig |
Buffer |
- Source:
- See:
Returns:
- Type
- Boolean
(static) num(value, flagsnullable, sizenullable) → {BN}
Create a CScriptNum.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
Buffer | ||
flags |
Number |
<nullable> |
Script standard flags. |
size |
Number |
<nullable> |
Max size in bytes. |
- Source:
Throws:
Returns:
- Type
- BN