Mobile Protocol specification
This is a DRAFT for protocol extensions to enable mobile devices to participate in bitmessage communication.
if you want to let mobile devices participate in bitmessage communication, you need a gateway device. Theoretically the device could participate like a standard node, but this will cause too much traffic. Even if you have a flat rate, it'll cost to much battery. This page describes a way, the standard protocol could be enhanced, to let mobile devices participate, at least through a gateway.
The gateway first of all is a standard bitmessage node. As a bitmessage node it connects to other nodes and collects and exchanges objects. The mobile gateway functionality is an extension, an additional protocol variant.
When a mobile device connects to a gateway it will identify itself in the "services" field of the version message to be a mobile device. The gateway will answer in the same field, that it is a gateway.
Therefore the service table has to be enhanced:
|1||NODE_NETWORK||This is a normal network node.|
|2||NODE_MOBILE||This is a mobile device with limited bandwidth.|
|4||NODE_GATEWAY||This node can send reduced traffic and work as a gateway.|
The differences in protocol behavior
Because we have to share private keys between mobile node and gateway, we do ssh encryption on the connection. For that reason the "Network Address" gets an additional (optional) field for the public ssh key.
|Field Size||Description||Data type||Comments|
|4 (or 8)||time||uint32||the Time. Protocol version 1 clients use 4 byte time while protocol version 2 clients use 8 byte time.|
|4||stream||uint32||Stream number for this node|
|8||services||uint64_t||same service(s) listed in version|
|16||IPv6/4||char||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 IPv4-mapped IPv6 address
(12 bytes 00 00 00 00 00 00 00 00 00 00 FF FF, followed by the 4 bytes of the IPv4 address).
|1+||ssh fingerprint||var_str||This field is optional. It contains the ssh fingerprint, for nodes that support ssh|
When accessed by a NODE_MOBILE the NODE_GATEWAY will not send any "addr" message, because the NODE_MOBILE will connect to the bitmessage network only through well known gateways. It will neither send a "inv" message, because it wants to reduce the traffic to the NODE_MOBILE.
When accessed to a NODE_GATEWAY the NODE_MOBILE will not send a "addr" message, too. But it might send an "inv" message, when it has objects to share. and it can share already all types of objects with the network.
With this very small protocol changes the NODE_MOBILE is already able to send messages using the bitmessage protocol, but with very reduced traffic load.
For the receive direction we must bring the NODE_GATEWAY in the position to select the objects the NODE_MOBILE is interested in. Whenever the NODE_GATEWAY notifies, that NODE_MOBILE might be interested in objects, it sends a "inv" message to offer them (must only the objects, NODE_MOBILE is interested in!).
How does NODE_GATEWAY know, which objects are of interest. There are different possibilities to notify this. First of all: every "getpubkey" object is translated into a request. When the object arrives at NODE_GATEWAY or if its already there, it is offered in an "inv" message.
For "msg" and "broadcast" objects it's a little more complicate, because the NODE_GATEWAY has to make the decision. We must add an encrypted method, how the NODE_GATEWAY can get the secret keys of NODE_MOBILE.