Equity
Bitcoin Protocol Library
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Network::VersionMessage Class Reference

A version message. More...

#include <VersionMessage.h>

Inheritance diagram for Network::VersionMessage:
Network::Message P2p::Serializable

Public Member Functions

 VersionMessage::VersionMessage (uint32_t version, uint64_t services, uint64_t timestamp, Address const &to, Address const &from, uint64_t nonce, std::string const &userAgent, uint32_t height, bool relay)
 
 VersionMessage (uint8_t const *&in, size_t &size)
 
Overrides Serializable
virtual void serialize (std::vector< uint8_t > &out) const override
 
virtual json toJson () const override
 
- Public Member Functions inherited from Network::Message
 Message (char const *type)
 
std::string type () const
 Returns the type.
 

Public Attributes

uint32_t version_
 Identifies protocol version being used by the node.
 
uint64_t services_
 bitfield of features to be enabled for this connection
 
uint64_t timestamp_
 standard UNIX timestamp in seconds
 
Address to_
 The network address of the node receiving this message.
 
Address from_
 The network address of the node emitting this message.
 
uint64_t nonce_
 Node random nonce, randomly generated every time a version packet is sent. More...
 
std::string userAgent_
 User Agent(0x00 if string is 0 bytes long)
 
uint32_t height_
 The last block received by the emitting node.
 
bool relay_
 Whether the remote peer should announce relayed transactions or not, see BIP 0037.
 

Static Public Attributes

static char const TYPE [] = "version"
 Message type.
 

Detailed Description

A version message.

When a node creates an outgoing connection, it will immediately advertise its version. The remote node will respond with its version. No further communication is possible until both peers have exchanged their version.

See also
https://github.com/bitcoin/bips/blob/master/bip-0037.mediawiki
Todo:
more work to do with this class

Constructor & Destructor Documentation

VersionMessage::VersionMessage ( uint8_t const *&  in,
size_t &  size 
)
Parameters
[in,out]inpointer to the next byte to deserialize
[in,out]sizenumber of bytes remaining in the serialized stream

Member Function Documentation

Network::VersionMessage::VersionMessage::VersionMessage ( uint32_t  version,
uint64_t  services,
uint64_t  timestamp,
Address const &  to,
Address const &  from,
uint64_t  nonce,
std::string const &  userAgent,
uint32_t  height,
bool  relay 
)
Parameters
versionversion
servicesservices
timestamptimestamp
toto
fromfrom
noncenonce
userAgentuserAgent
heightheight
relayrelay

Member Data Documentation

uint64_t Network::VersionMessage::nonce_

Node random nonce, randomly generated every time a version packet is sent.

This nonce is used < to detect connections to self.


The documentation for this class was generated from the following files: