Constructor
new Coin(options)
Create a coin.
Extends:
- Output
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
Properties:
Name | Type | Description |
---|---|---|
version |
Number | |
height |
Number | |
value |
Amount | |
script |
Script | |
coinbase |
Boolean | |
hash |
Hash | |
index |
Number |
- Source:
Extends
- Output
Methods
(static) fromKey(key) → {Coin}
Instantiate coin from hash table key.
Parameters:
Name | Type | Description |
---|---|---|
key |
String |
- Source:
Returns:
- Type
- Coin
(static) fromTX(tx, index) → {Coin}
Instantiate a coin from a TX
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX | |
index |
Number | Output index. |
- Source:
Returns:
- Type
- Coin
(static) isCoin(obj) → {Boolean}
Test an object to see if it is a Coin.
Parameters:
Name | Type | Description |
---|---|---|
obj |
Object |
- Source:
Returns:
- Type
- Boolean
(private) clone() → {Coin}
Clone the coin.
- Source:
Returns:
- Type
- Coin
format() → {Object}
Convert the coin to a more user-friendly object.
- Source:
Returns:
- Type
- Object
(private) fromJSON(json)
Inject JSON properties into coin.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object |
- Source:
(private) fromKey(key) → {Coin}
Inject properties from hash table key.
Parameters:
Name | Type | Description |
---|---|---|
key |
String |
- Source:
Returns:
- Type
- Coin
(private) fromOptions(options)
Inject options into coin.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
fromTX(tx, index)
Inject properties from TX.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX | |
index |
Number |
- Source:
getDepth(heightnullable) → {Number}
Calculate number of confirmations since coin was created.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
height |
Number |
<nullable> |
Current chain height. Network height is used if not passed in. |
- Source:
Returns:
- Type
- Number
getJSON(network, minimal) → {Object}
Convert the coin to an object suitable for JSON serialization.
Parameters:
Name | Type | Description |
---|---|---|
network |
Network | |
minimal |
Boolean |
- Source:
Returns:
- Type
- Object
getSize() → {Number}
Calculate size of coin.
- Source:
Returns:
- Type
- Number
(private) read(br)
Inject properties from serialized buffer writer.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
toKey() → {String}
Serialize coin to a key suitable for a hash table.
- Source:
Returns:
- Type
- String
txid() → {Hash}
Get little-endian hash.
- Source:
Returns:
- Type
- Hash
write(bw)
Write the coin to a buffer writer.
Parameters:
Name | Type | Description |
---|---|---|
bw |
BufferWriter |
- Source: