<?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=Ax64ax</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=Ax64ax"/>
	<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php/Special:Contributions/Ax64ax"/>
	<updated>2026-05-26T11:44:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19691</id>
		<title>API Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19691"/>
		<updated>2013-08-20T10:33:21Z</updated>

		<summary type="html">&lt;p&gt;Ax64ax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
The PyBitmessage API uses [https://en.wikipedia.org/wiki/XML-RPC XML-RPC]. &lt;br /&gt;
&lt;br /&gt;
=== Enable the API ===&lt;br /&gt;
To enable the API, copy and paste these lines into the bitmessagesettings section of the [[keys.dat]] file (the values &amp;quot;username&amp;quot; and &amp;quot;password&amp;quot; are merely examples):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apienabled = true&lt;br /&gt;
apiport = 8442&lt;br /&gt;
apiinterface = 127.0.0.1&lt;br /&gt;
apiusername = username&lt;br /&gt;
apipassword = password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Additionally, you may optionally include an additional entry which will specify a program which Bitmessage will run when certain events occur.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apinotifypath = c:\\example\\example.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
One of these arguments will be passed to your program: startingUp, newMessage, newBroadcast. Be sure your program doesn't crash when given newer arguments introduced in the future as this list will likely expand.&lt;br /&gt;
&lt;br /&gt;
=== Remote Access ===&lt;br /&gt;
To access the Bitmessage API from a remote location, change the apiinterface value from '''127.0.0.1''' to '''0.0.0.0'''. &lt;br /&gt;
&lt;br /&gt;
The following Python code offers a demonstration of how to create a client that can connect to the PyBitmessage API. &lt;br /&gt;
&lt;br /&gt;
In this example, the username is &amp;quot;username&amp;quot;, the password is &amp;quot;password&amp;quot;, the IP address of the server running PyBitmessage is 105.168.1.0 (a random example), and the port number which PyBitmessage has been configured to listen on is 8442. In order to connect with the remote copy of PyBitmessage, these settings must match those in PyBitmessage's &amp;quot;keys.dat&amp;quot; file. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import xmlrpclib&lt;br /&gt;
import json&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
api = xmlrpclib.ServerProxy(&amp;quot;http://username:password@105.168.1.0:8442/&amp;quot;)&lt;br /&gt;
print api.add(2,3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A more complete example can be found in the [https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py api_client.py] file in the PyBitmessage source code. &lt;br /&gt;
&lt;br /&gt;
=== List of Operations ===&lt;br /&gt;
Required arguments are denoted inside &amp;lt; and &amp;gt;  Optional arguments are inside [ and ]. &lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Parameters !! Minimum Version !! Description&lt;br /&gt;
|-&lt;br /&gt;
| helloWorld || &amp;lt;firstWord&amp;gt; &amp;lt;secondWord&amp;gt; || 0.2.7 || returns 'firstWord-secondWord'. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| add || &amp;lt;integer&amp;gt; &amp;lt;integer&amp;gt; || 0.2.7 || returns the sum of the integers. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| statusBar || &amp;lt;message&amp;gt; || 0.2.7 || Displays the message in the status bar on the GUI&lt;br /&gt;
|-&lt;br /&gt;
| listAddresses|| || 0.2.7 || Lists all addresses shown on the Your Identities tab. Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* stream (integer)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|-&lt;br /&gt;
| createRandomAddress || &amp;lt;label&amp;gt; [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || 0.2.7 || Creates one address using the random number generator. label should be base64 encoded. eighteenByteRipe is a boolean telling Bitmessage whether to generate an address with an 18 byte RIPE hash(as opposed to a 19 byte hash). This is the same setting as the &amp;quot;Do extra work to make the address 1 or 2 characters shorter&amp;quot; in the user interface. Using False is recommended if you are running some sort of website and will be generating a lot of addresses. Note that even if you don't ask for it, there is still a 1 in 256 chance that you will get an address with an 18 byte RIPE hash so if you actually ''need'' an address with a 19 byte RIPE hash for some reason, you will need to check for it. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns the address.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make an address at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|createDeterministicAddresses ||&amp;lt;passphrase&amp;gt; [numberOfAddresses] [addressVersionNumber] [streamNumber] [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || 0.3.4 || Similar to createRandomAddress except that you may generate many addresses in one go. passphrase should be base64 encoded. numberOfAddresses defaults to 1. addressVersionNumber and streamNumber may be set to 0 which will tell Bitmessage to use the most up-to-date addressVersionNumber and the most available streamNumber. Using zero for each of these fields is recommended. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns a list of new addresses.  This list will be empty if the addresses already existed.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|getDeterministicAddress ||&amp;lt;passphrase&amp;gt; &amp;lt;addressVersionNumber&amp;gt; &amp;lt;streamNumber&amp;gt;  || 0.3.1 || Similar to createDeterministicAddresses except that the one address that is returned will not be added to the Bitmessage user interface or the keys.dat file. passphrase should be base64 encoded. addressVersionNumber should be set to 3 as this is the only one currently supported. streamNumber must be set to 1 as this is the only one currently supported. &lt;br /&gt;
&lt;br /&gt;
Returns a single address. &lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both this API command and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;getAllInboxMessages&amp;lt;/code&amp;gt;|| || 0.2.7 || Does not include trashed messages. Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it is shown in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getInboxMessageByID || &amp;lt;msgid&amp;gt; || 0.3.4 || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it should be given in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByAckData || &amp;lt;ackData&amp;gt; || 0.3.4 || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getAllSentMessages || || 0.3.4 || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByID || &amp;lt;msgid&amp;gt; || 0.3.4 || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessagesBySender|| &amp;lt;fromAddress&amp;gt; || 0.3.4 || Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| trashMessage || &amp;lt;msgid&amp;gt; || 0.2.7 || returns a simple message saying that the message was trashed assuming it ever even existed. Prior existence is not checked. msgid is encoded in hex just like in the getAllInboxMessages function.&lt;br /&gt;
|-&lt;br /&gt;
| sendMessage || &amp;lt;toAddress&amp;gt; &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || 0.2.7 || returns ackdata encoded in hex. subject and message must be encoded in base64 which may optionally include line breaks. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| sendBroadcast || &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || 0.2.7 || returns ackData encoded in hex. subject and message must be encoded in base64. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| getStatus || &amp;lt;ackData&amp;gt; || 0.3.0 || returns one of these strings: &amp;lt;strike&amp;gt;notFound, findingPubkey, doingPOW, sentMessage, or ackReceived&amp;lt;/strike&amp;gt; notfound, msgqueued, broadcastqueued, broadcastsent, doingpubkeypow, awaitingpubkey, doingmsgpow, forcepow, msgsent, msgsentnoackexpected, or ackreceived. &lt;br /&gt;
|-&lt;br /&gt;
| addSubscription|| &amp;lt;address&amp;gt; [label] || 0.3.1 || Subscribe to an address. label must be base64-encoded.&lt;br /&gt;
|-&lt;br /&gt;
| deleteSubscription|| &amp;lt;address&amp;gt; || 0.3.1 || Unsubscribe from an address. The program does not check to see whether you were subscribed in the first place.&lt;br /&gt;
|-&lt;br /&gt;
| listSubscriptions||  || Source || Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Version &amp;quot;source&amp;quot; indicates, that the function is only available in the source version of PyBitmessage and has not yet been included in a precompiled binary.&lt;br /&gt;
&lt;br /&gt;
==== Possible error values ====&lt;br /&gt;
&lt;br /&gt;
Here are the various error numbers and descriptions you might see.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error Number!! Message&lt;br /&gt;
|- &lt;br /&gt;
|0000 || API Error 0000: I need parameters!&lt;br /&gt;
|-&lt;br /&gt;
| 0001 || API Error 0001: The specified passphrase is blank.&lt;br /&gt;
|-&lt;br /&gt;
| 0002 || API Error 0002: The address version number currently must be 3 (or 0 which means auto-select).&lt;br /&gt;
|- &lt;br /&gt;
| 0003 || API Error 0003: The stream number must be 1 (or 0 which means auto-select). Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0004 || API Error 0004: Why would you ask me to generate 0 addresses for you?&lt;br /&gt;
|-&lt;br /&gt;
| 0005 || API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.&lt;br /&gt;
|- &lt;br /&gt;
| 0006 || API Error 0006: The encoding type must be 2 because that is the only one this program currently supports.&lt;br /&gt;
|- &lt;br /&gt;
| 0007 || API Error 0007: Could not decode address&lt;br /&gt;
|- &lt;br /&gt;
| 0008 || API Error 0008: Checksum failed for address&lt;br /&gt;
|- &lt;br /&gt;
| 0009 || API Error 0009: Invalid characters in address&lt;br /&gt;
|-&lt;br /&gt;
| 0010 || API Error 0010: Address version number too high (or zero) in address&lt;br /&gt;
|-&lt;br /&gt;
| 0011 || API Error 0011: The address version number currently must be 2 or 3. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0012 || API Error 0012: The stream number must be 1. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0013 || API Error 0013: Could not find your fromAddress in the keys.dat file.&lt;br /&gt;
|- &lt;br /&gt;
| 0014 || API Error 0014: Your fromAddress is disabled. Cannot send.&lt;br /&gt;
|-&lt;br /&gt;
| 0015 || API Error 0015: The length of ackData should be 32 bytes (encoded in hex thus 64 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0016 || API Error 0016: You are already subscribed to that address.&lt;br /&gt;
|-&lt;br /&gt;
| 0017 || API Error 0017: Label is not valid UTF-8 data.&lt;br /&gt;
|-&lt;br /&gt;
| 0018 || API Error 0018: Chan name does not match address.&lt;br /&gt;
|-&lt;br /&gt;
| 0019 || API Error 0019: The length of hash should be 20 bytes (encoded in hex thus 40 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0020 || API Error 0020: Invalid method: asdfasdf&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ax64ax</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=Protocol_specification&amp;diff=19690</id>
		<title>Protocol specification</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=Protocol_specification&amp;diff=19690"/>
		<updated>2013-08-20T10:31:59Z</updated>

		<summary type="html">&lt;p&gt;Ax64ax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&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-256)&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&lt;br /&gt;
|-&lt;br /&gt;
| 4 || checksum || uint32_t || First 4 bytes of sha512(payload)&lt;br /&gt;
|-&lt;br /&gt;
| ? || payload || uchar[] || The actual data, a [[#Message_types|message]] or an [[#Object_types|object]]&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.&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 length as uint16_t&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;= 0xffffffff || 5 || 0xfe followed by the length as uint32_t&lt;br /&gt;
|-&lt;br /&gt;
| - || 9 || 0xff followed by the length 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.  This protocol and structure supports IPv6, '''but note that the original client currently only supports IPv4 networking'''. 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;
| 4 (or 8)|| time || uint32 || the Time. Protocol version 1 clients use 4 byte time while protocol version 2 clients use 8 byte 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. The original client only supports IPv4 and only reads the last 4 bytes to get the IPv4 address. However, the IPv4 address is 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&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. 320 is the network minimum so any lower values will be automatically raised to 320. '''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. 14000 is the network minimum so any lower values will be automatically raised to 14000. '''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 everything from the msg_version 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;
&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&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)&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.&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;.&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;
| 34x? || 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 types ==&lt;br /&gt;
Objects are a subset of network messages. They are shared throughout a stream.  A client should advertise objects that are not older than 2.5 days. To be a valid object, the [[Proof of work|Proof Of Work]] has to be done.&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;
| 8||POW nonce||uint64_t||Random nonce used for the [[Proof of work|Proof Of Work]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 (or 8)||time||uint32_t||The time that this message was generated and broadcast. We are transitioning to 8 byte time.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||address version||var_int||The address' version&lt;br /&gt;
|-&lt;br /&gt;
| 1+||stream number||var_int||The address' stream number&lt;br /&gt;
|-&lt;br /&gt;
| 20||pub key hash||uchar[]||The ripemd hash of the public key&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== pubkey === &lt;br /&gt;
&lt;br /&gt;
A version 2 public key. This is still in use and supported by current clients but ''new'' v2 addresses are not generated by clients.&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;
| 8||POW nonce||uint64_t||Random nonce used for the [[Proof of work|Proof Of Work]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 (or 8)||time||uint32_t||The time that this message was generated and broadcast. We are transitioning to 8 byte time.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||address version||var_int||The address' version which is set to 2.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||stream number||var_int||The address' 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 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;
|-&lt;br /&gt;
| 8||POW nonce||uint64_t||Random nonce used for the [[Proof of work|Proof Of Work]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 (or 8)||time||uint32_t||The time that this message was generated and broadcast. We are transitioning to 8 byte time.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||address version||var_int||The address' version which is set to 3.&lt;br /&gt;
|-&lt;br /&gt;
| 1+||stream number||var_int||The address' 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 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. 320 is the network minimum so any lower values will be automatically raised to 320. &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. 14000 is the network minimum so any lower values will be automatically raised to 14000.&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 time to the extra_bytes. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== msg ===&lt;br /&gt;
Used for person-to-person messages. &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||POW nonce||uint64_t||Random nonce used for the [[Proof of work|Proof Of Work]]&lt;br /&gt;
|-&lt;br /&gt;
| 4 (or 8)||time||uint32_t||The time that this message was generated and broadcast. We are transitioning to 8 byte time.&lt;br /&gt;
|-&lt;br /&gt;
| 1+ ||streamNumber||var_int||The stream number of the destination address.&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;
Version 1 broadcast messages are sent in-the-clear. Version 2 are encrypted. Users who are subscribed to the sending address will see the message appear in their inbox. &lt;br /&gt;
&lt;br /&gt;
Version 1 broadcast 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;
| 8 || POW nonce|| uint64_t|| The [[Proof of work|Proof Of Work]] nonce&lt;br /&gt;
|-&lt;br /&gt;
| 4 (or 8) || time|| uint32_t|| The time that the message was broadcast. We are transitioning to 8 byte time.&lt;br /&gt;
|-&lt;br /&gt;
| 1+|| broadcast version|| var_int||The version number of this broadcast protocol message which is equal to 1 in this case.&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;
| 20 || address hash|| uchar[]||The sender's address hash. This is included so that nodes can more cheaply detect whether this is a broadcast message for which they are listening, although it must be verified with the public key above.&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 covers everything from the broadcast version down through the message.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Version 2 broadcasts:&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 || POW nonce|| uint64_t|| The [[Proof of work|Proof Of Work]] nonce&lt;br /&gt;
|-&lt;br /&gt;
| 4 (or 8) || time|| uint32_t|| The time that the message was broadcast. We are transitioning to 8 byte time.&lt;br /&gt;
|-&lt;br /&gt;
| 1+|| broadcast version|| var_int||The version number of this broadcast protocol message which is equal to 2 in this case.&lt;br /&gt;
|-&lt;br /&gt;
| 1+ || stream number|| var_int||The sender's stream number&lt;br /&gt;
|-&lt;br /&gt;
| ?||encrypted||uchar[]||Encrypted broadcast data. See [[Protocol_specification#Encrypted_payload|Encrypted payload]]. See also [[Protocol_specification#Unencrypted_Broadcast_Data|Unencrypted Broadcast Data Format]]&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||The version number of this broadcast protocol message which is equal to 2 in this case. This is included here so that it can be signed. &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. 320 is the network minimum so any lower values will be automatically raised to 320. '''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. 14000 is the network minimum so any lower values will be automatically raised to 14000. '''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 covers everything from the broadcast version down through the message.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ax64ax</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19478</id>
		<title>API Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19478"/>
		<updated>2013-08-06T12:41:54Z</updated>

		<summary type="html">&lt;p&gt;Ax64ax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
The PyBitmessage API uses [https://en.wikipedia.org/wiki/XML-RPC XML-RPC]. &lt;br /&gt;
&lt;br /&gt;
=== Enable the API ===&lt;br /&gt;
To enable the API, copy and paste these lines into the bitmessagesettings section of the [[keys.dat]] file (the values &amp;quot;bradley&amp;quot; and &amp;quot;password&amp;quot; are merely examples):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apienabled = true&lt;br /&gt;
apiport = 8442&lt;br /&gt;
apiinterface = 127.0.0.1&lt;br /&gt;
apiusername = bradley&lt;br /&gt;
apipassword = password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Additionally, you may optionally include an additional entry which will specify a program which Bitmessage will run when certain events occur.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apinotifypath = c:\\example\\example.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
One of these arguments will be passed to your program: startingUp, newMessage, newBroadcast. Be sure your program doesn't crash when given newer arguments introduced in the future as this list will likely expand.&lt;br /&gt;
&lt;br /&gt;
=== Remote Access ===&lt;br /&gt;
To access the Bitmessage API from a remote location, change the apiinterface value from '''127.0.0.1''' to '''0.0.0.0'''. &lt;br /&gt;
&lt;br /&gt;
The following Python code offers a demonstration of how to create a client that can connect to the PyBitmessage API. &lt;br /&gt;
&lt;br /&gt;
In this example, the username is &amp;quot;bradley&amp;quot;, the password is &amp;quot;password&amp;quot;, the IP address of the server running PyBitmessage is 105.168.1.0 (a random example), and the port number which PyBitmessage has been configured to listen on is 8442. In order to connect with the remote copy of PyBitmessage, these settings must match those in PyBitmessage's &amp;quot;keys.dat&amp;quot; file. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import xmlrpclib&lt;br /&gt;
import json&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
api = xmlrpclib.ServerProxy(&amp;quot;http://bradley:password@105.168.1.0:8442/&amp;quot;)&lt;br /&gt;
print api.add(2,3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A more complete example can be found in the [https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py api_client.py] file in the PyBitmessage source code. &lt;br /&gt;
&lt;br /&gt;
=== List of Operations ===&lt;br /&gt;
Required arguments are denoted inside &amp;lt; and &amp;gt;  Optional arguments are inside [ and ]. &lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Parameters !! Description&lt;br /&gt;
|-&lt;br /&gt;
| helloWorld || &amp;lt;firstWord&amp;gt; &amp;lt;secondWord&amp;gt; || returns 'firstWord-secondWord'. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| add || &amp;lt;integer&amp;gt; &amp;lt;integer&amp;gt; || returns the sum of the integers. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| statusBar || &amp;lt;message&amp;gt; || Displays the message in the status bar on the GUI&lt;br /&gt;
|-&lt;br /&gt;
| listAddresses|| || Lists all addresses shown on the Your Identities tab. Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* stream (integer)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|-&lt;br /&gt;
| createRandomAddress || &amp;lt;label&amp;gt; [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Creates one address using the random number generator. label should be base64 encoded. eighteenByteRipe is a boolean telling Bitmessage whether to generate an address with an 18 byte RIPE hash(as opposed to a 19 byte hash). This is the same setting as the &amp;quot;Do extra work to make the address 1 or 2 characters shorter&amp;quot; in the user interface. Using False is recommended if you are running some sort of website and will be generating a lot of addresses. Note that even if you don't ask for it, there is still a 1 in 256 chance that you will get an address with an 18 byte RIPE hash so if you actually ''need'' an address with a 19 byte RIPE hash for some reason, you will need to check for it. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns the address.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make an address at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|createDeterministicAddresses ||&amp;lt;passphrase&amp;gt; [numberOfAddresses] [addressVersionNumber] [streamNumber] [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Similar to createRandomAddress except that you may generate many addresses in one go. passphrase should be base64 encoded. numberOfAddresses defaults to 1. addressVersionNumber and streamNumber may be set to 0 which will tell Bitmessage to use the most up-to-date addressVersionNumber and the most available streamNumber. Using zero for each of these fields is recommended. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns a list of new addresses.  This list will be empty if the addresses already existed.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|getDeterministicAddress ||&amp;lt;passphrase&amp;gt; &amp;lt;addressVersionNumber&amp;gt; &amp;lt;streamNumber&amp;gt;  || Similar to createDeterministicAddresses except that the one address that is returned will not be added to the Bitmessage user interface or the keys.dat file. passphrase should be base64 encoded. addressVersionNumber should be set to 3 as this is the only one currently supported. streamNumber must be set to 1 as this is the only one currently supported. &lt;br /&gt;
&lt;br /&gt;
Returns a single address. &lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both this API command and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;getAllInboxMessages&amp;lt;/code&amp;gt;|| || Does not include trashed messages. Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it is shown in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getInboxMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it should be given in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByAckData || &amp;lt;ackData&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getAllSentMessages || || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessagesBySender|| &amp;lt;fromAddress&amp;gt; || Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| trashMessage || &amp;lt;msgid&amp;gt; || returns a simple message saying that the message was trashed assuming it ever even existed. Prior existence is not checked. msgid is encoded in hex just like in the getAllInboxMessages function.&lt;br /&gt;
|-&lt;br /&gt;
| sendMessage || &amp;lt;toAddress&amp;gt; &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackdata encoded in hex. subject and message must be encoded in base64 which may optionally include line breaks. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| sendBroadcast || &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackData encoded in hex. subject and message must be encoded in base64. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| getStatus || &amp;lt;ackData&amp;gt; || returns one of these strings: &amp;lt;strike&amp;gt;notFound, findingPubkey, doingPOW, sentMessage, or ackReceived&amp;lt;/strike&amp;gt; notfound, msgqueued, broadcastqueued, broadcastsent, doingpubkeypow, awaitingpubkey, doingmsgpow, forcepow, msgsent, msgsentnoackexpected, or ackreceived. &lt;br /&gt;
|-&lt;br /&gt;
| addSubscription|| &amp;lt;address&amp;gt; [label] || Subscribe to an address. label must be base64-encoded.&lt;br /&gt;
|-&lt;br /&gt;
| deleteSubscription|| &amp;lt;address&amp;gt; || Unsubscribe from an address. The program does not check to see whether you were subscribed in the first place.&lt;br /&gt;
|-&lt;br /&gt;
| listSubscriptions||  || Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Possible error values ====&lt;br /&gt;
&lt;br /&gt;
Here are the various error numbers and descriptions you might see.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error Number!! Message&lt;br /&gt;
|- &lt;br /&gt;
|0000 || API Error 0000: I need parameters!&lt;br /&gt;
|-&lt;br /&gt;
| 0001 || API Error 0001: The specified passphrase is blank.&lt;br /&gt;
|-&lt;br /&gt;
| 0002 || API Error 0002: The address version number currently must be 3 (or 0 which means auto-select).&lt;br /&gt;
|- &lt;br /&gt;
| 0003 || API Error 0003: The stream number must be 1 (or 0 which means auto-select). Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0004 || API Error 0004: Why would you ask me to generate 0 addresses for you?&lt;br /&gt;
|-&lt;br /&gt;
| 0005 || API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.&lt;br /&gt;
|- &lt;br /&gt;
| 0006 || API Error 0006: The encoding type must be 2 because that is the only one this program currently supports.&lt;br /&gt;
|- &lt;br /&gt;
| 0007 || API Error 0007: Could not decode address&lt;br /&gt;
|- &lt;br /&gt;
| 0008 || API Error 0008: Checksum failed for address&lt;br /&gt;
|- &lt;br /&gt;
| 0009 || API Error 0009: Invalid characters in address&lt;br /&gt;
|-&lt;br /&gt;
| 0010 || API Error 0010: Address version number too high (or zero) in address&lt;br /&gt;
|-&lt;br /&gt;
| 0011 || API Error 0011: The address version number currently must be 2 or 3. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0012 || API Error 0012: The stream number must be 1. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0013 || API Error 0013: Could not find your fromAddress in the keys.dat file.&lt;br /&gt;
|- &lt;br /&gt;
| 0014 || API Error 0014: Your fromAddress is disabled. Cannot send.&lt;br /&gt;
|-&lt;br /&gt;
| 0015 || API Error 0015: The length of ackData should be 32 bytes (encoded in hex thus 64 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0016 || API Error 0016: You are already subscribed to that address.&lt;br /&gt;
|-&lt;br /&gt;
| 0017 || API Error 0017: Label is not valid UTF-8 data.&lt;br /&gt;
|-&lt;br /&gt;
| 0018 || API Error 0018: Chan name does not match address.&lt;br /&gt;
|-&lt;br /&gt;
| 0019 || API Error 0019: The length of hash should be 20 bytes (encoded in hex thus 40 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0020 || API Error 0020: Invalid method: asdfasdf&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ax64ax</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19477</id>
		<title>API Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19477"/>
		<updated>2013-08-06T12:40:43Z</updated>

		<summary type="html">&lt;p&gt;Ax64ax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
The PyBitmessage API uses [https://en.wikipedia.org/wiki/XML-RPC XML-RPC]. &lt;br /&gt;
&lt;br /&gt;
=== Enable the API ===&lt;br /&gt;
To enable the API, copy and paste these lines into the bitmessagesettings section of the [[keys.dat]] file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apienabled = true&lt;br /&gt;
apiport = 8442&lt;br /&gt;
apiinterface = 127.0.0.1&lt;br /&gt;
apiusername = bradley&lt;br /&gt;
apipassword = password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Additionally, you may optionally include an additional entry which will specify a program which Bitmessage will run when certain events occur.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apinotifypath = c:\\example\\example.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
One of these arguments will be passed to your program: startingUp, newMessage, newBroadcast. Be sure your program doesn't crash when given newer arguments introduced in the future as this list will likely expand.&lt;br /&gt;
&lt;br /&gt;
=== Remote Access ===&lt;br /&gt;
To access the Bitmessage API from a remote location, change the apiinterface value from '''127.0.0.1''' to '''0.0.0.0'''. &lt;br /&gt;
&lt;br /&gt;
The following Python code offers a demonstration of how to create a client that can connect to the PyBitmessage API. &lt;br /&gt;
&lt;br /&gt;
In this example, the username is &amp;quot;bradley&amp;quot;, the password is &amp;quot;password&amp;quot;, the IP address of the server running PyBitmessage is 105.168.1.0 (a random example), and the port number which PyBitmessage has been configured to listen on is 8442. In order to connect with the remote copy of PyBitmessage, these settings must match those in PyBitmessage's &amp;quot;keys.dat&amp;quot; file. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import xmlrpclib&lt;br /&gt;
import json&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
api = xmlrpclib.ServerProxy(&amp;quot;http://bradley:password@105.168.1.0:8442/&amp;quot;)&lt;br /&gt;
print api.add(2,3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A more complete example can be found in the [https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py api_client.py] file in the PyBitmessage source code. &lt;br /&gt;
&lt;br /&gt;
=== List of Operations ===&lt;br /&gt;
Required arguments are denoted inside &amp;lt; and &amp;gt;  Optional arguments are inside [ and ]. &lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Parameters !! Description&lt;br /&gt;
|-&lt;br /&gt;
| helloWorld || &amp;lt;firstWord&amp;gt; &amp;lt;secondWord&amp;gt; || returns 'firstWord-secondWord'. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| add || &amp;lt;integer&amp;gt; &amp;lt;integer&amp;gt; || returns the sum of the integers. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| statusBar || &amp;lt;message&amp;gt; || Displays the message in the status bar on the GUI&lt;br /&gt;
|-&lt;br /&gt;
| listAddresses|| || Lists all addresses shown on the Your Identities tab. Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* stream (integer)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|-&lt;br /&gt;
| createRandomAddress || &amp;lt;label&amp;gt; [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Creates one address using the random number generator. label should be base64 encoded. eighteenByteRipe is a boolean telling Bitmessage whether to generate an address with an 18 byte RIPE hash(as opposed to a 19 byte hash). This is the same setting as the &amp;quot;Do extra work to make the address 1 or 2 characters shorter&amp;quot; in the user interface. Using False is recommended if you are running some sort of website and will be generating a lot of addresses. Note that even if you don't ask for it, there is still a 1 in 256 chance that you will get an address with an 18 byte RIPE hash so if you actually ''need'' an address with a 19 byte RIPE hash for some reason, you will need to check for it. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns the address.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make an address at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|createDeterministicAddresses ||&amp;lt;passphrase&amp;gt; [numberOfAddresses] [addressVersionNumber] [streamNumber] [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Similar to createRandomAddress except that you may generate many addresses in one go. passphrase should be base64 encoded. numberOfAddresses defaults to 1. addressVersionNumber and streamNumber may be set to 0 which will tell Bitmessage to use the most up-to-date addressVersionNumber and the most available streamNumber. Using zero for each of these fields is recommended. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns a list of new addresses.  This list will be empty if the addresses already existed.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|getDeterministicAddress ||&amp;lt;passphrase&amp;gt; &amp;lt;addressVersionNumber&amp;gt; &amp;lt;streamNumber&amp;gt;  || Similar to createDeterministicAddresses except that the one address that is returned will not be added to the Bitmessage user interface or the keys.dat file. passphrase should be base64 encoded. addressVersionNumber should be set to 3 as this is the only one currently supported. streamNumber must be set to 1 as this is the only one currently supported. &lt;br /&gt;
&lt;br /&gt;
Returns a single address. &lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both this API command and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;getAllInboxMessages&amp;lt;/code&amp;gt;|| || Does not include trashed messages. Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it is shown in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getInboxMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it should be given in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByAckData || &amp;lt;ackData&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getAllSentMessages || || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessagesBySender|| &amp;lt;fromAddress&amp;gt; || Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| trashMessage || &amp;lt;msgid&amp;gt; || returns a simple message saying that the message was trashed assuming it ever even existed. Prior existence is not checked. msgid is encoded in hex just like in the getAllInboxMessages function.&lt;br /&gt;
|-&lt;br /&gt;
| sendMessage || &amp;lt;toAddress&amp;gt; &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackdata encoded in hex. subject and message must be encoded in base64 which may optionally include line breaks. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| sendBroadcast || &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackData encoded in hex. subject and message must be encoded in base64. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| getStatus || &amp;lt;ackData&amp;gt; || returns one of these strings: &amp;lt;strike&amp;gt;notFound, findingPubkey, doingPOW, sentMessage, or ackReceived&amp;lt;/strike&amp;gt; notfound, msgqueued, broadcastqueued, broadcastsent, doingpubkeypow, awaitingpubkey, doingmsgpow, forcepow, msgsent, msgsentnoackexpected, or ackreceived. &lt;br /&gt;
|-&lt;br /&gt;
| addSubscription|| &amp;lt;address&amp;gt; [label] || Subscribe to an address. label must be base64-encoded.&lt;br /&gt;
|-&lt;br /&gt;
| deleteSubscription|| &amp;lt;address&amp;gt; || Unsubscribe from an address. The program does not check to see whether you were subscribed in the first place.&lt;br /&gt;
|-&lt;br /&gt;
| listSubscriptions||  || Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Possible error values ====&lt;br /&gt;
&lt;br /&gt;
Here are the various error numbers and descriptions you might see.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error Number!! Message&lt;br /&gt;
|- &lt;br /&gt;
|0000 || API Error 0000: I need parameters!&lt;br /&gt;
|-&lt;br /&gt;
| 0001 || API Error 0001: The specified passphrase is blank.&lt;br /&gt;
|-&lt;br /&gt;
| 0002 || API Error 0002: The address version number currently must be 3 (or 0 which means auto-select).&lt;br /&gt;
|- &lt;br /&gt;
| 0003 || API Error 0003: The stream number must be 1 (or 0 which means auto-select). Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0004 || API Error 0004: Why would you ask me to generate 0 addresses for you?&lt;br /&gt;
|-&lt;br /&gt;
| 0005 || API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.&lt;br /&gt;
|- &lt;br /&gt;
| 0006 || API Error 0006: The encoding type must be 2 because that is the only one this program currently supports.&lt;br /&gt;
|- &lt;br /&gt;
| 0007 || API Error 0007: Could not decode address&lt;br /&gt;
|- &lt;br /&gt;
| 0008 || API Error 0008: Checksum failed for address&lt;br /&gt;
|- &lt;br /&gt;
| 0009 || API Error 0009: Invalid characters in address&lt;br /&gt;
|-&lt;br /&gt;
| 0010 || API Error 0010: Address version number too high (or zero) in address&lt;br /&gt;
|-&lt;br /&gt;
| 0011 || API Error 0011: The address version number currently must be 2 or 3. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0012 || API Error 0012: The stream number must be 1. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0013 || API Error 0013: Could not find your fromAddress in the keys.dat file.&lt;br /&gt;
|- &lt;br /&gt;
| 0014 || API Error 0014: Your fromAddress is disabled. Cannot send.&lt;br /&gt;
|-&lt;br /&gt;
| 0015 || API Error 0015: The length of ackData should be 32 bytes (encoded in hex thus 64 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0016 || API Error 0016: You are already subscribed to that address.&lt;br /&gt;
|-&lt;br /&gt;
| 0017 || API Error 0017: Label is not valid UTF-8 data.&lt;br /&gt;
|-&lt;br /&gt;
| 0018 || API Error 0018: Chan name does not match address.&lt;br /&gt;
|-&lt;br /&gt;
| 0019 || API Error 0019: The length of hash should be 20 bytes (encoded in hex thus 40 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0020 || API Error 0020: Invalid method: asdfasdf&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ax64ax</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19476</id>
		<title>API Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19476"/>
		<updated>2013-08-06T12:21:26Z</updated>

		<summary type="html">&lt;p&gt;Ax64ax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Introduction ===&lt;br /&gt;
&lt;br /&gt;
The PyBitmessage API uses [https://en.wikipedia.org/wiki/XML-RPC XML-RPC]. &lt;br /&gt;
&lt;br /&gt;
=== Enable the API ===&lt;br /&gt;
To enable the API, copy and paste these lines into the bitmessagesettings section of the [[keys.dat]] file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apienabled = true&lt;br /&gt;
apiport = 8442&lt;br /&gt;
apiinterface = 127.0.0.1&lt;br /&gt;
apiusername = bradley&lt;br /&gt;
apipassword = bradley'spassword&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Additionally, you may optionally include an additional entry which will specify a program which Bitmessage will run when certain events occur.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apinotifypath = c:\\example\\example.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
One of these arguments will be passed to your program: startingUp, newMessage, newBroadcast. Be sure your program doesn't crash when given newer arguments introduced in the future as this list will likely expand.&lt;br /&gt;
&lt;br /&gt;
=== Remote Access ===&lt;br /&gt;
To access the Bitmessage API from a remote location, change the apiinterface value from '''127.0.0.1''' to '''0.0.0.0'''. &lt;br /&gt;
&lt;br /&gt;
The following Python code offers a demonstration of how to create a client that can connect to the PyBitmessage API. &lt;br /&gt;
&lt;br /&gt;
In this example, the username is &amp;quot;bradley&amp;quot;, the password is &amp;quot;password&amp;quot;, the IP address of the server running PyBitmessage is 105.168.1.0 (a random example), and the port number which PyBitmessage has been configured to listen on is 8442. In order to connect with the remote copy of PyBitmessage, these settings must match those in PyBitmessage's &amp;quot;keys.dat&amp;quot; file. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import xmlrpclib&lt;br /&gt;
import json&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
api = xmlrpclib.ServerProxy(&amp;quot;http://bradley:password@105.168.1.0:8442/&amp;quot;)&lt;br /&gt;
print api.add(2,3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A more complete example can be found in the [https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py api_client.py] file in the PyBitmessage source code. &lt;br /&gt;
&lt;br /&gt;
=== List of Operations ===&lt;br /&gt;
Required arguments are denoted inside &amp;lt; and &amp;gt;  Optional arguments are inside [ and ]. &lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Parameters !! Description&lt;br /&gt;
|-&lt;br /&gt;
| helloWorld || &amp;lt;firstWord&amp;gt; &amp;lt;secondWord&amp;gt; || returns 'firstWord-secondWord'. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| add || &amp;lt;integer&amp;gt; &amp;lt;integer&amp;gt; || returns the sum of the integers. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| statusBar || &amp;lt;message&amp;gt; || Displays the message in the status bar on the GUI&lt;br /&gt;
|-&lt;br /&gt;
| listAddresses|| || Lists all addresses shown on the Your Identities tab. Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* stream (integer)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|-&lt;br /&gt;
| createRandomAddress || &amp;lt;label&amp;gt; [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Creates one address using the random number generator. label should be base64 encoded. eighteenByteRipe is a boolean telling Bitmessage whether to generate an address with an 18 byte RIPE hash(as opposed to a 19 byte hash). This is the same setting as the &amp;quot;Do extra work to make the address 1 or 2 characters shorter&amp;quot; in the user interface. Using False is recommended if you are running some sort of website and will be generating a lot of addresses. Note that even if you don't ask for it, there is still a 1 in 256 chance that you will get an address with an 18 byte RIPE hash so if you actually ''need'' an address with a 19 byte RIPE hash for some reason, you will need to check for it. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns the address.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make an address at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|createDeterministicAddresses ||&amp;lt;passphrase&amp;gt; [numberOfAddresses] [addressVersionNumber] [streamNumber] [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Similar to createRandomAddress except that you may generate many addresses in one go. passphrase should be base64 encoded. numberOfAddresses defaults to 1. addressVersionNumber and streamNumber may be set to 0 which will tell Bitmessage to use the most up-to-date addressVersionNumber and the most available streamNumber. Using zero for each of these fields is recommended. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns a list of new addresses.  This list will be empty if the addresses already existed.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|getDeterministicAddress ||&amp;lt;passphrase&amp;gt; &amp;lt;addressVersionNumber&amp;gt; &amp;lt;streamNumber&amp;gt;  || Similar to createDeterministicAddresses except that the one address that is returned will not be added to the Bitmessage user interface or the keys.dat file. passphrase should be base64 encoded. addressVersionNumber should be set to 3 as this is the only one currently supported. streamNumber must be set to 1 as this is the only one currently supported. &lt;br /&gt;
&lt;br /&gt;
Returns a single address. &lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both this API command and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;getAllInboxMessages&amp;lt;/code&amp;gt;|| || Does not include trashed messages. Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it is shown in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getInboxMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it should be given in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByAckData || &amp;lt;ackData&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getAllSentMessages || || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessagesBySender|| &amp;lt;fromAddress&amp;gt; || Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| trashMessage || &amp;lt;msgid&amp;gt; || returns a simple message saying that the message was trashed assuming it ever even existed. Prior existence is not checked. msgid is encoded in hex just like in the getAllInboxMessages function.&lt;br /&gt;
|-&lt;br /&gt;
| sendMessage || &amp;lt;toAddress&amp;gt; &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackdata encoded in hex. subject and message must be encoded in base64 which may optionally include line breaks. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| sendBroadcast || &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackData encoded in hex. subject and message must be encoded in base64. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| getStatus || &amp;lt;ackData&amp;gt; || returns one of these strings: &amp;lt;strike&amp;gt;notFound, findingPubkey, doingPOW, sentMessage, or ackReceived&amp;lt;/strike&amp;gt; notfound, msgqueued, broadcastqueued, broadcastsent, doingpubkeypow, awaitingpubkey, doingmsgpow, forcepow, msgsent, msgsentnoackexpected, or ackreceived. &lt;br /&gt;
|-&lt;br /&gt;
| addSubscription|| &amp;lt;address&amp;gt; [label] || Subscribe to an address. label must be base64-encoded.&lt;br /&gt;
|-&lt;br /&gt;
| deleteSubscription|| &amp;lt;address&amp;gt; || Unsubscribe from an address. The program does not check to see whether you were subscribed in the first place.&lt;br /&gt;
|-&lt;br /&gt;
| listSubscriptions||  || Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Possible error values ====&lt;br /&gt;
&lt;br /&gt;
Here are the various error numbers and descriptions you might see.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error Number!! Message&lt;br /&gt;
|- &lt;br /&gt;
|0000 || API Error 0000: I need parameters!&lt;br /&gt;
|-&lt;br /&gt;
| 0001 || API Error 0001: The specified passphrase is blank.&lt;br /&gt;
|-&lt;br /&gt;
| 0002 || API Error 0002: The address version number currently must be 3 (or 0 which means auto-select).&lt;br /&gt;
|- &lt;br /&gt;
| 0003 || API Error 0003: The stream number must be 1 (or 0 which means auto-select). Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0004 || API Error 0004: Why would you ask me to generate 0 addresses for you?&lt;br /&gt;
|-&lt;br /&gt;
| 0005 || API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.&lt;br /&gt;
|- &lt;br /&gt;
| 0006 || API Error 0006: The encoding type must be 2 because that is the only one this program currently supports.&lt;br /&gt;
|- &lt;br /&gt;
| 0007 || API Error 0007: Could not decode address&lt;br /&gt;
|- &lt;br /&gt;
| 0008 || API Error 0008: Checksum failed for address&lt;br /&gt;
|- &lt;br /&gt;
| 0009 || API Error 0009: Invalid characters in address&lt;br /&gt;
|-&lt;br /&gt;
| 0010 || API Error 0010: Address version number too high (or zero) in address&lt;br /&gt;
|-&lt;br /&gt;
| 0011 || API Error 0011: The address version number currently must be 2 or 3. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0012 || API Error 0012: The stream number must be 1. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0013 || API Error 0013: Could not find your fromAddress in the keys.dat file.&lt;br /&gt;
|- &lt;br /&gt;
| 0014 || API Error 0014: Your fromAddress is disabled. Cannot send.&lt;br /&gt;
|-&lt;br /&gt;
| 0015 || API Error 0015: The length of ackData should be 32 bytes (encoded in hex thus 64 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0016 || API Error 0016: You are already subscribed to that address.&lt;br /&gt;
|-&lt;br /&gt;
| 0017 || API Error 0017: Label is not valid UTF-8 data.&lt;br /&gt;
|-&lt;br /&gt;
| 0018 || API Error 0018: Chan name does not match address.&lt;br /&gt;
|-&lt;br /&gt;
| 0019 || API Error 0019: The length of hash should be 20 bytes (encoded in hex thus 40 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0020 || API Error 0020: Invalid method: asdfasdf&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ax64ax</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19475</id>
		<title>API Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.bitmessage.org/index.php?title=API_Reference&amp;diff=19475"/>
		<updated>2013-08-06T12:18:53Z</updated>

		<summary type="html">&lt;p&gt;Ax64ax: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The PyBitmessage API uses [https://en.wikipedia.org/wiki/XML-RPC XML-RPC]. &lt;br /&gt;
&lt;br /&gt;
=== Enable the API ===&lt;br /&gt;
To enable the API, copy and paste these lines into the bitmessagesettings section of the [[keys.dat]] file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apienabled = true&lt;br /&gt;
apiport = 8442&lt;br /&gt;
apiinterface = 127.0.0.1&lt;br /&gt;
apiusername = bradley&lt;br /&gt;
apipassword = yourSuperWonderfulPassword98a8#5223345&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Additionally, you may optionally include an additional entry which will specify a program which Bitmessage will run when certain events occur.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apinotifypath = c:\\example\\example.exe&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
One of these arguments will be passed to your program: startingUp, newMessage, newBroadcast. Be sure your program doesn't crash when given newer arguments introduced in the future as this list will likely expand.&lt;br /&gt;
&lt;br /&gt;
=== Remote Access ===&lt;br /&gt;
To access the Bitmessage API from a remote location, change the apiinterface value from '''127.0.0.1''' to '''0.0.0.0'''. &lt;br /&gt;
&lt;br /&gt;
The following Python code offers a demonstration of how to create a client that can connect to the PyBitmessage API. &lt;br /&gt;
&lt;br /&gt;
In this example, the username is &amp;quot;bradley&amp;quot;, the password is &amp;quot;password&amp;quot;, the IP address of the server running PyBitmessage is 105.168.1.0 (a random example), and the port number which PyBitmessage has been configured to listen on is 8442. In order to connect with the remote copy of PyBitmessage, these settings must match those in PyBitmessage's &amp;quot;keys.dat&amp;quot; file. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import xmlrpclib&lt;br /&gt;
import json&lt;br /&gt;
import time&lt;br /&gt;
&lt;br /&gt;
api = xmlrpclib.ServerProxy(&amp;quot;http://bradley:password@105.168.1.0:8442/&amp;quot;)&lt;br /&gt;
print api.add(2,3)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A more complete example can be found in the [https://github.com/Bitmessage/PyBitmessage/blob/master/src/api_client.py api_client.py] file in the PyBitmessage source code. &lt;br /&gt;
&lt;br /&gt;
=== List of Operations ===&lt;br /&gt;
Required arguments are denoted inside &amp;lt; and &amp;gt;  Optional arguments are inside [ and ]. &lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Parameters !! Description&lt;br /&gt;
|-&lt;br /&gt;
| helloWorld || &amp;lt;firstWord&amp;gt; &amp;lt;secondWord&amp;gt; || returns 'firstWord-secondWord'. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| add || &amp;lt;integer&amp;gt; &amp;lt;integer&amp;gt; || returns the sum of the integers. Used as a simple test of the API.&lt;br /&gt;
|-&lt;br /&gt;
| statusBar || &amp;lt;message&amp;gt; || Displays the message in the status bar on the GUI&lt;br /&gt;
|-&lt;br /&gt;
| listAddresses|| || Lists all addresses shown on the Your Identities tab. Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* stream (integer)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|-&lt;br /&gt;
| createRandomAddress || &amp;lt;label&amp;gt; [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Creates one address using the random number generator. label should be base64 encoded. eighteenByteRipe is a boolean telling Bitmessage whether to generate an address with an 18 byte RIPE hash(as opposed to a 19 byte hash). This is the same setting as the &amp;quot;Do extra work to make the address 1 or 2 characters shorter&amp;quot; in the user interface. Using False is recommended if you are running some sort of website and will be generating a lot of addresses. Note that even if you don't ask for it, there is still a 1 in 256 chance that you will get an address with an 18 byte RIPE hash so if you actually ''need'' an address with a 19 byte RIPE hash for some reason, you will need to check for it. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns the address.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make an address at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|createDeterministicAddresses ||&amp;lt;passphrase&amp;gt; [numberOfAddresses] [addressVersionNumber] [streamNumber] [eighteenByteRipe] [totalDifficulty] [smallMessageDifficulty] || Similar to createRandomAddress except that you may generate many addresses in one go. passphrase should be base64 encoded. numberOfAddresses defaults to 1. addressVersionNumber and streamNumber may be set to 0 which will tell Bitmessage to use the most up-to-date addressVersionNumber and the most available streamNumber. Using zero for each of these fields is recommended. eighteenByteRipe defaults to False. totalDifficulty and smallMessageDifficulty default to 1.&lt;br /&gt;
&lt;br /&gt;
Returns a list of new addresses.  This list will be empty if the addresses already existed.&lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both the API and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|getDeterministicAddress ||&amp;lt;passphrase&amp;gt; &amp;lt;addressVersionNumber&amp;gt; &amp;lt;streamNumber&amp;gt;  || Similar to createDeterministicAddresses except that the one address that is returned will not be added to the Bitmessage user interface or the keys.dat file. passphrase should be base64 encoded. addressVersionNumber should be set to 3 as this is the only one currently supported. streamNumber must be set to 1 as this is the only one currently supported. &lt;br /&gt;
&lt;br /&gt;
Returns a single address. &lt;br /&gt;
&lt;br /&gt;
Warning: At present, Bitmessage gets confused if you use both this API command and the UI to make addresses at the same time.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;getAllInboxMessages&amp;lt;/code&amp;gt;|| || Does not include trashed messages. Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it is shown in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getInboxMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* receivedTime (integer, Unix time)&lt;br /&gt;
* read (integer representing binary state (0 or 1))&lt;br /&gt;
&lt;br /&gt;
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin) thus it should be given in hex as that is the de facto standard. The base64 encoding Bitmessage uses includes line breaks including one on the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByAckData || &amp;lt;ackData&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getAllSentMessages || || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessageByID || &amp;lt;msgid&amp;gt; || Returns an object with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| getSentMessagesBySender|| &amp;lt;fromAddress&amp;gt; || Returns a list of objects with these properties:&lt;br /&gt;
* msgid (hex)&lt;br /&gt;
* toAddress (ascii/utf-8)&lt;br /&gt;
* fromAddress (ascii/utf-8)&lt;br /&gt;
* subject (base64, decodes into utf-8)&lt;br /&gt;
* message (base64, decodes into utf-8)&lt;br /&gt;
* [[Protocol_specification#Message_Encodings|encodingType]] (integer)&lt;br /&gt;
* lastActionTime (integer, Unix time)&lt;br /&gt;
* status (ascii/utf-8)&lt;br /&gt;
* ackData (hex)&lt;br /&gt;
|-&lt;br /&gt;
| trashMessage || &amp;lt;msgid&amp;gt; || returns a simple message saying that the message was trashed assuming it ever even existed. Prior existence is not checked. msgid is encoded in hex just like in the getAllInboxMessages function.&lt;br /&gt;
|-&lt;br /&gt;
| sendMessage || &amp;lt;toAddress&amp;gt; &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackdata encoded in hex. subject and message must be encoded in base64 which may optionally include line breaks. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| sendBroadcast || &amp;lt;fromAddress&amp;gt; &amp;lt;subject&amp;gt; &amp;lt;message&amp;gt; [encodingType] || returns ackData encoded in hex. subject and message must be encoded in base64. If used, the encodingType must be set to 2; this is included for forwards compatibility. &lt;br /&gt;
|-&lt;br /&gt;
| getStatus || &amp;lt;ackData&amp;gt; || returns one of these strings: &amp;lt;strike&amp;gt;notFound, findingPubkey, doingPOW, sentMessage, or ackReceived&amp;lt;/strike&amp;gt; notfound, msgqueued, broadcastqueued, broadcastsent, doingpubkeypow, awaitingpubkey, doingmsgpow, forcepow, msgsent, msgsentnoackexpected, or ackreceived. &lt;br /&gt;
|-&lt;br /&gt;
| addSubscription|| &amp;lt;address&amp;gt; [label] || Subscribe to an address. label must be base64-encoded.&lt;br /&gt;
|-&lt;br /&gt;
| deleteSubscription|| &amp;lt;address&amp;gt; || Unsubscribe from an address. The program does not check to see whether you were subscribed in the first place.&lt;br /&gt;
|-&lt;br /&gt;
| listSubscriptions||  || Returns a list of objects with these properties:&lt;br /&gt;
* label (utf-8)&lt;br /&gt;
* address (ascii/utf-8)&lt;br /&gt;
* enabled (bool)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Possible error values ====&lt;br /&gt;
&lt;br /&gt;
Here are the various error numbers and descriptions you might see.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Error Number!! Message&lt;br /&gt;
|- &lt;br /&gt;
|0000 || API Error 0000: I need parameters!&lt;br /&gt;
|-&lt;br /&gt;
| 0001 || API Error 0001: The specified passphrase is blank.&lt;br /&gt;
|-&lt;br /&gt;
| 0002 || API Error 0002: The address version number currently must be 3 (or 0 which means auto-select).&lt;br /&gt;
|- &lt;br /&gt;
| 0003 || API Error 0003: The stream number must be 1 (or 0 which means auto-select). Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0004 || API Error 0004: Why would you ask me to generate 0 addresses for you?&lt;br /&gt;
|-&lt;br /&gt;
| 0005 || API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.&lt;br /&gt;
|- &lt;br /&gt;
| 0006 || API Error 0006: The encoding type must be 2 because that is the only one this program currently supports.&lt;br /&gt;
|- &lt;br /&gt;
| 0007 || API Error 0007: Could not decode address&lt;br /&gt;
|- &lt;br /&gt;
| 0008 || API Error 0008: Checksum failed for address&lt;br /&gt;
|- &lt;br /&gt;
| 0009 || API Error 0009: Invalid characters in address&lt;br /&gt;
|-&lt;br /&gt;
| 0010 || API Error 0010: Address version number too high (or zero) in address&lt;br /&gt;
|-&lt;br /&gt;
| 0011 || API Error 0011: The address version number currently must be 2 or 3. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0012 || API Error 0012: The stream number must be 1. Others aren't supported.&lt;br /&gt;
|-&lt;br /&gt;
| 0013 || API Error 0013: Could not find your fromAddress in the keys.dat file.&lt;br /&gt;
|- &lt;br /&gt;
| 0014 || API Error 0014: Your fromAddress is disabled. Cannot send.&lt;br /&gt;
|-&lt;br /&gt;
| 0015 || API Error 0015: The length of ackData should be 32 bytes (encoded in hex thus 64 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0016 || API Error 0016: You are already subscribed to that address.&lt;br /&gt;
|-&lt;br /&gt;
| 0017 || API Error 0017: Label is not valid UTF-8 data.&lt;br /&gt;
|-&lt;br /&gt;
| 0018 || API Error 0018: Chan name does not match address.&lt;br /&gt;
|-&lt;br /&gt;
| 0019 || API Error 0019: The length of hash should be 20 bytes (encoded in hex thus 40 characters).&lt;br /&gt;
|-&lt;br /&gt;
| 0020 || API Error 0020: Invalid method: asdfasdf&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ax64ax</name></author>
		
	</entry>
</feed>