Constructor
new VersionPacket(optionsnullable)
Create a version packet.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<nullable> |
Properties
|
Properties:
Name | Type | Description |
---|---|---|
version |
Number | Protocol version. |
services |
Number | Service bits. |
time |
Number | Timestamp of discovery. |
local |
NetAddress | Our address. |
remote |
NetAddress | Their address. |
nonce |
Buffer | |
agent |
String | User agent string. |
height |
Number | Chain height. |
noRelay |
Boolean | Whether transactions should be relayed immediately. |
- Source:
Extends
- Packet
Methods
(static) fromOptions(options) → {VersionPacket}
Instantiate version packet from options.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Returns:
- Type
- VersionPacket
(static) fromRaw(data, encnullable) → {VersionPacket}
Instantiate version packet from serialized data.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
data |
Buffer | ||
enc |
String |
<nullable> |
- Source:
Returns:
- Type
- VersionPacket
(static) fromReader(br) → {VersionPacket}
Instantiate version packet from buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
Returns:
- Type
- VersionPacket
(private) fromOptions(options)
Inject properties from options.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
(private) fromRaw(data)
Inject properties from serialized data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
(private) fromReader(br)
Inject properties from buffer reader.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
getSize() → {Number}
Get serialization size.
- Source:
Returns:
- Type
- Number
toRaw() → {Buffer}
Serialize version packet.
- Source:
Returns:
- Type
- Buffer
toWriter(bw)
Write version packet to buffer writer.
Parameters:
Name | Type | Description |
---|---|---|
bw |
BufferWriter |
- Source: