<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.bitmessage.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dissem</id>
	<title>Bitmessage Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bitmessage.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dissem"/>
	<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php/Special:Contributions/Dissem"/>
	<updated>2026-05-01T05:49:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=Talk:Extended_encoding&amp;diff=47569</id>
		<title>Talk:Extended encoding</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=Talk:Extended_encoding&amp;diff=47569"/>
		<updated>2016-12-11T12:14:52Z</updated>

		<summary type="html">&lt;p&gt;Dissem: Created page with &amp;quot;Is there any order in the map entries? For parsing it would be very useful if the message type was guaranteed to be the first entry. --~~~~&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Is there any order in the map entries? For parsing it would be very useful if the message type was guaranteed to be the first entry.&lt;br /&gt;
--[[User:Dissem|Dissem]] ([[User talk:Dissem|talk]]) 07:14, 11 December 2016 (EST)&lt;/div&gt;</summary>
		<author><name>Dissem</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=Developer_Reference&amp;diff=30475</id>
		<title>Developer Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=Developer_Reference&amp;diff=30475"/>
		<updated>2015-05-29T08:11:43Z</updated>

		<summary type="html">&lt;p&gt;Dissem: /* Other Implementations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page is intended to provide information and other resources that are useful for Bitmessage developers. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Protocol Information==&lt;br /&gt;
&lt;br /&gt;
Protocol specification: https://bitmessage.org/wiki/Protocol_specification&lt;br /&gt;
&lt;br /&gt;
Encryption scheme: https://bitmessage.org/wiki/Encryption&lt;br /&gt;
&lt;br /&gt;
Proof of Work scheme: https://bitmessage.org/wiki/Proof_of_work&lt;br /&gt;
&lt;br /&gt;
Bitmessage White Paper: https://bitmessage.org/bitmessage.pdf&lt;br /&gt;
&lt;br /&gt;
Bitmessage Technical Paper (Note: not updated for protocol version 3): https://bitmessage.org/Bitmessage%20Technical%20Paper.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
&lt;br /&gt;
===Full Node Implementations===&lt;br /&gt;
&lt;br /&gt;
PyBitmessage (Reference Client) (Python): https://github.com/bitmessage/pybitmessage&lt;br /&gt;
&lt;br /&gt;
bitmessaged (C++): https://github.com/Thomas-Astade/bitmessaged&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lite Client Implementations===&lt;br /&gt;
&lt;br /&gt;
Bitseal (Java): https://github.com/jonathancoe/bitseal&lt;br /&gt;
&lt;br /&gt;
Notbit (C): https://github.com/bpeel/notbit&lt;br /&gt;
&lt;br /&gt;
Bmr (Javascript): https://github.com/chovy/bmr&lt;br /&gt;
&lt;br /&gt;
bitmessage-web (Javascript): https://github.com/jclement/bitmessage-web&lt;br /&gt;
&lt;br /&gt;
Bitpost (Objective-C): https://github.com/Voluntarynet/Bitpost&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Web Clients===&lt;br /&gt;
&lt;br /&gt;
Blinked (Javascript): https://blinked.ca&lt;br /&gt;
&lt;br /&gt;
Bitmsg.me (Javascript): https://bitmsg.me&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Gateway Services===&lt;br /&gt;
&lt;br /&gt;
https://bitmessage.ch&lt;br /&gt;
&lt;br /&gt;
http://bitmessage.mobi&lt;br /&gt;
&lt;br /&gt;
https://mailchuck.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Other Implementations===&lt;br /&gt;
&lt;br /&gt;
Please note that some of these other implementations may be incomplete or not up-to-date with the current Bitmessage protocol. &lt;br /&gt;
&lt;br /&gt;
libbitmessage (C++): https://github.com/corebob/libbitmessage&lt;br /&gt;
&lt;br /&gt;
bitmessage-go (Go): https://github.com/corebob/bitmessage-go&lt;br /&gt;
&lt;br /&gt;
cppbitmessage (C++): https://github.com/bashrc/cppbitmessage&lt;br /&gt;
&lt;br /&gt;
JBitmessage (Java): https://github.com/ISibboI/JBitmessage&lt;br /&gt;
&lt;br /&gt;
Jabit (Java): https://github.com/Dissem/Jabit&lt;br /&gt;
&lt;br /&gt;
SharpBitmessage (C#): https://github.com/sharpbitmessage/SharpBitmessage&lt;br /&gt;
&lt;br /&gt;
Bitmessage-js (Javascript): https://github.com/indigots/Bitmessage-js&lt;br /&gt;
&lt;br /&gt;
bitmessage-ruby (Ruby): https://github.com/staii/bitmessage-ruby&lt;br /&gt;
&lt;br /&gt;
bitchan (Javascript): https://github.com/bitchan&lt;br /&gt;
&lt;br /&gt;
==Scripts and Utilities==&lt;br /&gt;
&lt;br /&gt;
===PyBitmessage Utilities===&lt;br /&gt;
&lt;br /&gt;
Bitmessage PHP class - Bitmessage PHP Class to control PyBitmessage daemon using xmlrpc - https://github.com/Conver/class.bitmessage.php&lt;br /&gt;
&lt;br /&gt;
bmwrapper - Email wrapper for PyBitmessage: https://github.com/Arceliar/bmwrapper&lt;br /&gt;
&lt;br /&gt;
BitCrypt - Encrypts and decrypts PyBitmessage .dat files: https://github.com/AyrA/BitCrypt&lt;br /&gt;
&lt;br /&gt;
BitUpdate - Automatically update PyBitmessage: https://github.com/AyrA/BitUpdate&lt;br /&gt;
&lt;br /&gt;
NIIP-BitMessageLib - A .NET implementation of the API exposed by PyBitmessage: https://bitbucket.org/niip/niip-bitmessagelib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Others===&lt;br /&gt;
&lt;br /&gt;
bitmessage-powfaster - Bitmessage Proof Of Work optimizations including OpenCL and C based PoW code: https://github.com/grant-olson/bitmessage-powfaster&lt;br /&gt;
&lt;br /&gt;
BitMailServer - Bitmesssage to Email Gateway: https://github.com/AyrA/BitMailServer&lt;br /&gt;
&lt;br /&gt;
BitDNS - Bitmessage DNS and Namecoin integration: https://github.com/AyrA/BitDNS&lt;br /&gt;
&lt;br /&gt;
BitCenter - Powerful Bitmessage message processing: https://github.com/AyrA/BitCenter&lt;br /&gt;
&lt;br /&gt;
BitHTTP - HTTP proxy over Bitmessage: https://github.com/AyrA/BitHTTP&lt;br /&gt;
&lt;br /&gt;
BinSend - Send and decode binary attachments via Bitmessage: https://github.com/AyrA/BinSend&lt;br /&gt;
&lt;br /&gt;
BitMessageForum - Browse your bitmessages via a forum-like UI: https://github.com/grant-olson/BitMessageForum&lt;/div&gt;</summary>
		<author><name>Dissem</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=Protocol_specification&amp;diff=30407</id>
		<title>Protocol specification</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=Protocol_specification&amp;diff=30407"/>
		<updated>2015-05-22T18:28:04Z</updated>

		<summary type="html">&lt;p&gt;Dissem: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;All objects sent on the network should support protocol v3 starting on Sun, 16 Nov 2014 22:00:00 GMT. &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Common standards==&lt;br /&gt;
&lt;br /&gt;
=== Hashes ===&lt;br /&gt;
&lt;br /&gt;
Most of the time [http://en.wikipedia.org/wiki/SHA-2 SHA-512] hashes are used, however [http://en.wikipedia.org/wiki/RIPEMD RIPEMD-160] is also used when creating an address.&lt;br /&gt;
&lt;br /&gt;
A double-round of SHA-512 is used for the Proof Of Work. Example of double-SHA-512 encoding of string &amp;quot;hello&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 hello&lt;br /&gt;
 9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043(first round of sha-512)&lt;br /&gt;
 0592a10584ffabf96539f3d780d776828c67da1ab5b169e9e8aed838aaecc9ed36d49ff1423c55f019e050c66c6324f53588be88894fef4dcffdb74b98e2b200(second round of sha-512)&lt;br /&gt;
&lt;br /&gt;
For Bitmessage addresses (RIPEMD-160) this would give:&lt;br /&gt;
&lt;br /&gt;
 hello&lt;br /&gt;
 9b71d224bd62f3785d96d46ad3ea3d73319bfbc2890caadae2dff72519673ca72323c3d99ba5c11d7c7acc6e14b8c5da0c4663475c2e5c3adef46f73bcdec043(first round is sha-512)&lt;br /&gt;
 79a324faeebcbf9849f310545ed531556882487e (with ripemd-160)&lt;br /&gt;
&lt;br /&gt;
== Common structures ==&lt;br /&gt;
&lt;br /&gt;
All integers are encoded in big endian. (This is different from Bitcoin). &lt;br /&gt;
&lt;br /&gt;
=== Message structure ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 4 || magic || uint32_t || Magic value indicating message origin network, and used to seek to next message when stream state is unknown&lt;br /&gt;
|-&lt;br /&gt;
| 12 || command || char[12] || ASCII string identifying the packet content, NULL padded (non-NULL padding results in packet rejected)&lt;br /&gt;
|-&lt;br /&gt;
| 4 || length || uint32_t || Length of payload in number of bytes. Because of other restrictions, there is no reason why this length would ever be larger than 1600003 bytes. Some clients include a sanity-check to avoid processing messages which are larger than this.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || checksum || uint32_t || First 4 bytes of sha512(payload)&lt;br /&gt;
|-&lt;br /&gt;
| ? || message_payload || uchar[] || The actual data, a [[#Message_types|message]] or an [[#object|object]]. Not to be confused with objectPayload.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Known magic values:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Magic value !! Sent over wire as&lt;br /&gt;
|-&lt;br /&gt;
| 0xE9BEB4D9 || E9 BE B4 D9&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Variable length integer ===&lt;br /&gt;
&lt;br /&gt;
Integer can be encoded depending on the represented value to save space.  Variable length integers always precede an array/vector of a type of data that may vary in length. Varints MUST use the minimum possible number of bytes to encode a value. For example; the value 6 can be encoded with one byte therefore a varint that uses three bytes to encode the value 6 is malformed and the decoding task must be aborted.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Storage length !! Format&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt; 0xfd || 1 || uint8_t&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;= 0xffff || 3 || 0xfd followed by the integer as uint16_t&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;= 0xffffffff || 5 || 0xfe followed by the integer as uint32_t&lt;br /&gt;
|-&lt;br /&gt;
| - || 9 || 0xff followed by the integer as uint64_t&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Variable length string ===&lt;br /&gt;
&lt;br /&gt;
Variable length string can be stored using a variable length integer followed by the string itself.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || length || [[Protocol_specification#Variable_length_integer|var_int]] || Length of the string&lt;br /&gt;
|-&lt;br /&gt;
| ? || string || char[] || The string itself (can be empty)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Variable length list of integers===&lt;br /&gt;
&lt;br /&gt;
n integers can be stored using n+1 [[Protocol_specification#Variable_length_integer|variable length integers]] where the first var_int equals n.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || count|| [[Protocol_specification#Variable_length_integer|var_int]] || Number of var_ints below&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || || var_int || The first value stored&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || || var_int || The second value stored...&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || || var_int || etc...&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Network address ===&lt;br /&gt;
&lt;br /&gt;
When a network address is needed somewhere, this structure is used.  Network addresses are not prefixed with a timestamp or stream in the version message.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 8 || time || uint32 || the Time.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || stream|| uint32 || Stream number for this node&lt;br /&gt;
|-&lt;br /&gt;
| 8 || services || uint64_t || same service(s) listed in [[#version|version]]&lt;br /&gt;
|-&lt;br /&gt;
| 16 || IPv6/4 || char[16] || IPv6 address. IPv4 addresses are written into the message as a 16 byte [http://en.wikipedia.org/wiki/IPv6#IPv4-mapped_IPv6_addresses IPv4-mapped IPv6 address]&lt;br /&gt;
(12 bytes ''00 00 00 00  00 00 00 00  00 00 FF FF'', followed by the 4 bytes of the IPv4 address).&lt;br /&gt;
|-&lt;br /&gt;
| 2 || port || uint16_t || port number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Inventory Vectors ===&lt;br /&gt;
&lt;br /&gt;
Inventory vectors are used for notifying other nodes about objects they have or data which is being requested. Two rounds of SHA-512 are used, resulting in a 64 byte hash. Only the first 32 bytes are used; the later 32 bytes are ignored.&lt;br /&gt;
&lt;br /&gt;
Inventory vectors consist of the following data format:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 32 || hash || char[32] || Hash of the object&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Encrypted payload ===&lt;br /&gt;
&lt;br /&gt;
Bitmessage uses [https://en.wikipedia.org/wiki/Integrated_Encryption_Scheme ECIES] to encrypt its messages. For more information see [[Encryption]]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 16||IV||uchar[]||Initialization Vector used for AES-256-CBC&lt;br /&gt;
|-&lt;br /&gt;
| 2||uint16_t||Curve type||Elliptic Curve type 0x02CA (714)&lt;br /&gt;
|-&lt;br /&gt;
| 2||uint16_t||X length||Length of X component of public key R&lt;br /&gt;
|-&lt;br /&gt;
| X length||uchar[]||X||X component of public key R&lt;br /&gt;
|-&lt;br /&gt;
| 2||uint16_t||Y length||Length of Y component of public key R&lt;br /&gt;
|-&lt;br /&gt;
| Y length||uchar[]||Y||Y component of public key R&lt;br /&gt;
|-&lt;br /&gt;
| ?||encrypted||uchar[]||Cipher text&lt;br /&gt;
|-&lt;br /&gt;
| 32||MAC|| uchar[]||HMACSHA256 Message Authentication Code&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Unencrypted Message Data ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 1+||msg_version||var_int||Message format version. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;This field is not included after the protocol v3 upgrade period.&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 1+||address_version||var_int||Sender's address version number. This is needed in order to calculate the sender's address to show in the UI, and also to allow for forwards compatible changes to the public-key data included below.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||stream||var_int||Sender's stream number&lt;br /&gt;
|-&lt;br /&gt;
| 4||behavior bitfield||uint32_t||A bitfield of optional behaviors and features that can be expected from the node with this pubkey included in this msg message (the sender's pubkey). &lt;br /&gt;
|-&lt;br /&gt;
| 64||public signing key||uchar[]||The ECC public key used for signing (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 64||public encryption key||uchar[]||The ECC public key used for encryption (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 1+||nonce_trials_per_byte||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is the average number of nonce trials a node will have to perform to meet the Proof of Work requirement. 1000 is the network minimum so any lower values will be automatically raised to 1000. '''This field is new and is only included when the address_version &amp;gt;= 3.'''&lt;br /&gt;
|-&lt;br /&gt;
| 1+||extra_bytes||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is added to the data length to make sending small messages more difficult. 1000 is the network minimum so any lower values will be automatically raised to 1000. '''This field is new and is only included when the address_version &amp;gt;= 3.'''&lt;br /&gt;
|-&lt;br /&gt;
| 20||destination ripe||uchar[]||The ripe hash of the public key of the receiver of the message&lt;br /&gt;
|-&lt;br /&gt;
| 1+||encoding||var_int||[[Protocol_specification#Message_Encodings|Message Encoding]] type&lt;br /&gt;
|-&lt;br /&gt;
| 1+||message_length||var_int||Message Length&lt;br /&gt;
|-&lt;br /&gt;
| message_length||message||uchar[]||The message.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||ack_length||var_int||Length of the acknowledgement data&lt;br /&gt;
|-&lt;br /&gt;
| ack_length||ack_data||uchar[]||The acknowledgement data to be transmitted. This takes the form of a Bitmessage protocol message, like another msg message. The POW therein must already be completed.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||sig_length||var_int||Length of the signature&lt;br /&gt;
|-&lt;br /&gt;
| sig_length||signature||uchar[]||The ECDSA signature which covers the object header starting with the time, appended with the data described in this table down to the ack_data. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Message Encodings====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || IGNORE || Any data with this number may be ignored. The sending node might simply be sharing its public key with you.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || TRIVIAL|| UTF-8. No 'Subject' or 'Body' sections. Useful for simple strings of data, like URIs or magnet links.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || SIMPLE || UTF-8. Uses 'Subject' and 'Body' sections. No MIME is used. &lt;br /&gt;
&amp;lt;code&amp;gt;messageToTransmit = 'Subject:' + subject + '\n' + 'Body:' + message&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Further values for the message encodings can be decided upon by the community. Any MIME or MIME-like encoding format, should they be used, should make use of Bitmessage's 8-bit bytes.&lt;br /&gt;
&lt;br /&gt;
====Pubkey bitfield features====&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit!! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 0 || undefined || The most significant bit at the beginning of the structure. Undefined&lt;br /&gt;
|-&lt;br /&gt;
| 1 || undefined || The next most significant bit. Undefined&lt;br /&gt;
|-&lt;br /&gt;
| ... || ... || ...&lt;br /&gt;
|-&lt;br /&gt;
| 30 || include_destination || Receiving node expects that the RIPE hash encoded in their address preceedes the encrypted message data of msg messages bound for them. &lt;br /&gt;
|-&lt;br /&gt;
| 31 || does_ack|| If true, the receiving node does send acknowledgements (rather than dropping them).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Message types ==&lt;br /&gt;
Undefined messages received on the wire must be ignored.&lt;br /&gt;
&lt;br /&gt;
=== version ===&lt;br /&gt;
&lt;br /&gt;
When a node creates an outgoing connection, it will immediately advertise its version. The remote node will respond with its version. No futher communication is possible until both peers have exchanged their version.&lt;br /&gt;
&lt;br /&gt;
Payload:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 4 || version || int32_t || Identifies protocol version being used by the node. Should equal 3. Nodes should disconnect if the remote node's version is lower but continue with the connection if it is higher.&lt;br /&gt;
|-&lt;br /&gt;
| 8 || services || uint64_t || bitfield of features to be enabled for this connection&lt;br /&gt;
|-&lt;br /&gt;
| 8 || timestamp || int64_t || standard UNIX timestamp in seconds&lt;br /&gt;
|-&lt;br /&gt;
| 26 || addr_recv || net_addr || The network address of the node receiving this message (not including the time or stream number)&lt;br /&gt;
|-&lt;br /&gt;
| 26 || addr_from || net_addr || The network address of the node emitting this message (not including the time or stream number and the ip itself is ignored by the receiver)&lt;br /&gt;
|-&lt;br /&gt;
| 8 || nonce || uint64_t || Random nonce used to detect connections to self.&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || user_agent || [[#Variable length string|var_str]] || [[User Agent]] (0x00 if string is 0 bytes long). Sending nodes must not include a user_agent longer than 5000 bytes.&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || stream_numbers || [[#Variable length list of integers|var_int_list]] || The stream numbers that the emitting node is interested in. Sending nodes must not include more than 160000 stream numbers.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A &amp;quot;verack&amp;quot; packet shall be sent if the version packet was accepted. Once you have sent and received a verack messages with the remote node, send an addr message advertising up to 1000 peers of which you are aware, and one or more inv messages advertising all of the valid objects of which you are aware.&lt;br /&gt;
&lt;br /&gt;
The following services are currently assigned:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 1 || NODE_NETWORK || This is a normal network node.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== verack ===&lt;br /&gt;
&lt;br /&gt;
The ''verack'' message is sent in reply to ''version''.  This message consists of only a [[#Message structure|message header]] with the command string &amp;quot;verack&amp;quot;. The TCP timeout starts out at 20 seconds; after verack messages are exchanged, the timeout is raised to 10 minutes.&lt;br /&gt;
&lt;br /&gt;
=== addr ===&lt;br /&gt;
&lt;br /&gt;
Provide information on known nodes of the network. Non-advertised nodes should be forgotten after typically 3 hours&lt;br /&gt;
&lt;br /&gt;
Payload:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || count || [[Protocol_specification#Variable_length_integer|var_int]] || Number of address entries (max: 1000)&lt;br /&gt;
|-&lt;br /&gt;
| 38 || addr_list || [[Protocol_specification#Network_address|net_addr]] || Address of other nodes on the network. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== inv ===&lt;br /&gt;
&lt;br /&gt;
Allows a node to advertise its knowledge of one or more objects. &lt;br /&gt;
Payload (maximum payload length: 50000 items):&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| ? || count || [[Protocol_specification#Variable_length_integer|var_int]] || Number of inventory entries&lt;br /&gt;
|-&lt;br /&gt;
| 32x? || inventory || [[Protocol specification#Inventory Vectors|inv_vect]][] || Inventory vectors&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== getdata ===&lt;br /&gt;
&lt;br /&gt;
getdata is used in response to an ''inv'' message to retrieve the content of a specific object after filtering known elements.&lt;br /&gt;
&lt;br /&gt;
Payload (maximum payload length: 50000 entries):&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| ? || count || [[Protocol_specification#Variable_length_integer|var_int]] || Number of inventory entries&lt;br /&gt;
|-&lt;br /&gt;
| 32x? || inventory || [[Protocol specification#Inventory Vectors|inv_vect]][] || Inventory vectors&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== object ===&lt;br /&gt;
&lt;br /&gt;
An object is a message which is shared throughout a stream. It is the only message which propagates; all others are only between two nodes. Objects have a type, like 'msg', or 'broadcast'. To be a valid object, the [[Proof of work|Proof Of Work]] must be done. The maximum allowable length of an object (not to be confused with the objectPayload) is 2&amp;lt;sup&amp;gt;18&amp;lt;/sup&amp;gt; bytes.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 8||nonce||uint64_t||&lt;br /&gt;
Random nonce used for the [[Proof of work|Proof Of Work]]&lt;br /&gt;
|-&lt;br /&gt;
| 8||expiresTime||uint64_t||&lt;br /&gt;
The &amp;quot;end of life&amp;quot; time of this object (be aware, in version 2 of the protocol this was the generation time). Objects shall be shared with peers until its end-of-life time has been reached. The node should store the inventory vector of that object for some extra period of time to avoid reloading it from another node with a small time delay. The time may be no further than 28 days + 3 hours in the future.&lt;br /&gt;
|-&lt;br /&gt;
| 4||objectType||uint32_t||&lt;br /&gt;
Four values are currently defined: 0-&amp;quot;getpubkey&amp;quot;, 1-&amp;quot;pubkey&amp;quot;, 2-&amp;quot;msg&amp;quot;, 3-&amp;quot;broadcast&amp;quot;. All other values are reserved. Nodes should relay objects even if they use an undefined object type.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||version||var_int||The object's version. Note that msg objects won't contain a version until Sun, 16 Nov 2014 22:00:00 GMT.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||stream number||var_int||The stream number in which this object may propagate&lt;br /&gt;
|-&lt;br /&gt;
| ?||objectPayload||uchar[]||&lt;br /&gt;
This field varies depending on the object type; see below.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Object types ==&lt;br /&gt;
Here are the payloads for various object types.&lt;br /&gt;
&lt;br /&gt;
=== getpubkey === &lt;br /&gt;
&lt;br /&gt;
When a node has the hash of a public key (from an address) but not the public key itself, it must send out a request for the public key.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;font color=&amp;quot;#666666&amp;quot;&amp;gt;20||&amp;lt;font color=&amp;quot;#666666&amp;quot;&amp;gt;ripe||&amp;lt;font color=&amp;quot;#666666&amp;quot;&amp;gt;uchar[]||&amp;lt;font color=&amp;quot;#666666&amp;quot;&amp;gt;The ripemd hash of the public key. This field is only included when the address version is &amp;lt;= 3.&amp;lt;/font&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 32||tag||uchar[]||The tag derived from the address version, stream number, and ripe. This field is only included when the address version is &amp;gt;= 4.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== pubkey === &lt;br /&gt;
&lt;br /&gt;
A version 2 pubkey. This is still in use and supported by current clients but ''new'' v2 addresses are not generated by clients.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 4||[[Protocol_specification#Pubkey_bitfield_features|behavior bitfield]]||uint32_t||A bitfield of optional behaviors and features that can be expected from the node receiving the message. &lt;br /&gt;
|-&lt;br /&gt;
| 64||public signing key||uchar[]||The ECC public key used for signing (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 64||public encryption key||uchar[]||The ECC public key used for encryption (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A version 3 pubkey&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 4||[[Protocol_specification#Pubkey_bitfield_features|behavior bitfield]]||uint32_t||A bitfield of optional behaviors and features that can be expected from the node receiving the message. &lt;br /&gt;
|-&lt;br /&gt;
| 64||public signing key||uchar[]||The ECC public key used for signing (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 64||public encryption key||uchar[]||The ECC public key used for encryption (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 1+||nonce_trials_per_byte||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is the average number of nonce trials a node will have to perform to meet the Proof of Work requirement. 1000 is the network minimum so any lower values will be automatically raised to 1000. &lt;br /&gt;
|-&lt;br /&gt;
| 1+||extra_bytes||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is added to the data length to make sending small messages more difficult. 1000 is the network minimum so any lower values will be automatically raised to 1000.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||sig_length||var_int||Length of the signature&lt;br /&gt;
|-&lt;br /&gt;
| sig_length||signature||uchar[]||The ECDSA signature which, &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;as of protocol v3, covers the object header starting with the time, appended with the data described in this table down to the extra_bytes.&amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A version 4 pubkey&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 32||tag||uchar[]||The tag, made up of bytes 32-64 of the double hash of the address data (see example python code below)&lt;br /&gt;
|-&lt;br /&gt;
| ?||encrypted||uchar[]||Encrypted pubkey data.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When version 4 pubkeys are created, most of the data in the pubkey is encrypted. This is done in such a way that only someone who has the Bitmessage address which corresponds to a pubkey can decrypt and use that pubkey. This prevents people from gathering pubkeys sent around the network and using the data from them to create messages to be used in spam or in flooding attacks. &lt;br /&gt;
&lt;br /&gt;
In order to encrypt the pubkey data, a double SHA-512 hash is calculated from the address version number, stream number, and ripe hash of the Bitmessage address that the pubkey corresponds to. The first 32 bytes of this hash are used to create a public and private key pair with which to encrypt and decrypt the pubkey data, using the same algorithm as message encryption (see [[Encryption]]). The remaining 32 bytes of this hash are added to the unencrypted part of the pubkey and used as a tag, as above. This allows nodes to determine which pubkey to decrypt when they wish to send a message. &lt;br /&gt;
&lt;br /&gt;
In PyBitmessage, the double hash of the address data is calculated using the python code below:&lt;br /&gt;
&lt;br /&gt;
doubleHashOfAddressData = hashlib.sha512(hashlib.sha512(encodeVarint(addressVersionNumber) + encodeVarint(streamNumber) + hash).digest()).digest()&lt;br /&gt;
&lt;br /&gt;
Encrypted data in version 4 pubkeys:&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
| 4||[[Protocol_specification#Pubkey_bitfield_features|behavior bitfield]]||uint32_t||A bitfield of optional behaviors and features that can be expected from the node receiving the message. &lt;br /&gt;
|-&lt;br /&gt;
| 64||public signing key||uchar[]||The ECC public key used for signing (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 64||public encryption key||uchar[]||The ECC public key used for encryption (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 1+||nonce_trials_per_byte||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is the average number of nonce trials a node will have to perform to meet the Proof of Work requirement. 1000 is the network minimum so any lower values will be automatically raised to 1000. &lt;br /&gt;
|-&lt;br /&gt;
| 1+||extra_bytes||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is added to the data length to make sending small messages more difficult. 1000 is the network minimum so any lower values will be automatically raised to 1000.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||sig_length||var_int||Length of the signature&lt;br /&gt;
|-&lt;br /&gt;
| sig_length||signature||uchar[]||The ECDSA signature which covers everything from the object header starting with the time, then appended with the decrypted data down to the extra_bytes. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;This was changed in protocol v3. &amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== msg ===&lt;br /&gt;
Used for person-to-person messages. Note that msg objects won't contain a version in the object header until Sun, 16 Nov 2014 22:00:00 GMT.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| ?||encrypted||uchar[]||Encrypted data. See [[Protocol_specification#Encrypted_payload|Encrypted payload]]. See also [[Protocol_specification#Unencrypted_Message_Data|Unencrypted Message Data Format]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== broadcast ===&lt;br /&gt;
Users who are subscribed to the sending address will see the message appear in their inbox. Broadcasts are &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;version 4 or 5.&amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Pubkey objects and v5 broadcast objects are encrypted the same way: The data encoded in the sender's Bitmessage address is hashed twice. The first 32 bytes of the resulting hash constitutes the &amp;quot;private&amp;quot; encryption key and the last 32 bytes constitute a '''tag''' so that anyone listening can easily decide if this particular message is interesting. The sender calculates the public key from the private key and then encrypts the object with this public key. Thus anyone who knows the Bitmessage address of the sender of a broadcast or pubkey object can decrypt it. &lt;br /&gt;
&lt;br /&gt;
The version of broadcast objects was previously 2 or 3 &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;but was changed to 4 or 5 for protocol v3. &amp;lt;/span&amp;gt; Having a broadcast version of 5 indicates that a tag is used which, in turn, is used when the sender's address version is &amp;gt;=4.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 32 || tag|| uchar[]||The tag. This field is new and only included when the broadcast version is &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&amp;gt;= 5. Changed in protocol v3&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ?||encrypted||uchar[]||Encrypted broadcast data. The keys are derived as described in the paragraph above. See [[Protocol_specification#Encrypted_payload|Encrypted payload]] for details about the encryption algorithm itself.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unencrypted data format:&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field Size !! Description !! Data type !! Comments&lt;br /&gt;
|-&lt;br /&gt;
| 1+|| broadcast version|| var_int||&amp;lt;span style=&amp;quot;color:grey&amp;quot;&amp;gt;The version number of this broadcast protocol message which is equal to 2 or 3. This is included here so that it can be signed.&amp;lt;/span&amp;gt; &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;This is no longer included in protocol v3&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || address version|| var_int||The sender's address version&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || stream number|| var_int||The sender's stream number&lt;br /&gt;
|-&lt;br /&gt;
| 4||[[Protocol_specification#Pubkey_bitfield_features|behavior bitfield]]||uint32_t||A bitfield of optional behaviors and features that can be expected from the owner of this pubkey. &lt;br /&gt;
|-&lt;br /&gt;
| 64||public signing key||uchar[]||The ECC public key used for signing (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 64||public encryption key||uchar[]||The ECC public key used for encryption (uncompressed format; normally prepended with \x04 )&lt;br /&gt;
|-&lt;br /&gt;
| 1+||nonce_trials_per_byte||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is the average number of nonce trials a node will have to perform to meet the Proof of Work requirement. 1000 is the network minimum so any lower values will be automatically raised to 1000. This field is new and is only included when the address_version &amp;gt;= 3.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||extra_bytes||var_int||Used to calculate the difficulty target of messages accepted by this node. The higher this value, the more difficult the Proof of Work must be before this individual will accept the message. This number is added to the data length to make sending small messages more difficult. 1000 is the network minimum so any lower values will be automatically raised to 1000. This field is new and is only included when the address_version &amp;gt;= 3.&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || [[Protocol_specification#Message_Encodings|encoding]]|| var_int||The [[Protocol_specification#Message_Encodings|encoding type]] of the message&lt;br /&gt;
|-&lt;br /&gt;
| 1+ ||messageLength || var_int||The message length in bytes&lt;br /&gt;
|-&lt;br /&gt;
| messageLength || message||uchar[] ||The message&lt;br /&gt;
|-&lt;br /&gt;
| 1+||sig_length||var_int||Length of the signature&lt;br /&gt;
|-&lt;br /&gt;
| sig_length|| signature||uchar[] ||The signature which &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;did&amp;lt;/span&amp;gt; cover the unencrypted data from the broadcast version down through the message. &amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;In protocol v3, it covers the unencrypted object header starting with the time, all appended with the decrypted data.&amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Dissem</name></author>
		
	</entry>
</feed>