new BIP143()
- Description:
BIP143 - SegWit Sighash Calculator
- Source:
Methods
(static) calculate(tx, inputIndex, scriptCode, value, sighashTypeopt) → {Buffer}
- Description:
Calculate BIP143 sighash for SegWit inputs
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
tx |
Object | Transaction object |
||
inputIndex |
number | Input being signed |
||
scriptCode |
Buffer | Script code for input |
||
value |
number | Input value in satoshis |
||
sighashType |
number |
<optional> |
0x01
|
Sighash type |
Returns:
32-byte sighash
- Type
- Buffer
(static) forP2WPKH(tx, inputIndex, pubkeyHash, value, sighashTypeopt) → {Buffer}
- Description:
Calculate sighash for P2WPKH input
- Source:
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
tx |
Object | Transaction object |
||
inputIndex |
number | Input index |
||
pubkeyHash |
Buffer | 20-byte public key hash |
||
value |
number | Input value in satoshis |
||
sighashType |
number |
<optional> |
0x01
|
Sighash type |
Returns:
32-byte sighash
- Type
- Buffer
(static) hashOutputs(outputs, inputIndex, sighashType) → {Buffer}
- Description:
Calculate hashOutputs
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
outputs |
Array | Transaction outputs |
inputIndex |
number | Current input index |
sighashType |
number | Sighash type |
Returns:
32-byte hash
- Type
- Buffer
(static) hashPrevouts(inputs, sighashType) → {Buffer}
- Description:
Calculate hashPrevouts
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
inputs |
Array | Transaction inputs |
sighashType |
number | Sighash type |
Returns:
32-byte hash
- Type
- Buffer
(static) hashSequence(inputs, sighashType) → {Buffer}
- Description:
Calculate hashSequence
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
inputs |
Array | Transaction inputs |
sighashType |
number | Sighash type |
Returns:
32-byte hash
- Type
- Buffer