Skip to main content

serialize_version

Function serialize_version 

Source
pub fn serialize_version(v: &VersionMessage) -> Result<Vec<u8>>
Expand description

Serialize VersionMessage to Bitcoin wire format Format per Bitcoin protocol specification:

  • version: i32 (4 bytes LE)
  • services: u64 (8 bytes LE)
  • timestamp: i64 (8 bytes LE)
  • addr_recv: NetworkAddress (26 bytes)
  • addr_from: NetworkAddress (26 bytes)
  • nonce: u64 (8 bytes LE)
  • user_agent: CompactSize + string bytes
  • start_height: i32 (4 bytes LE)
  • relay: u8 (1 byte, 0 or 1)