Message structure (Protocolbuffers)¶
Creating a network of TrustChain peers which only run a Java version of TrustChain is not very useful. Therefore the TrustChain blocks and messages should be compatible with many platforms, so cross-platform connection is possible. For the storage of the chain this is achieved by using SQLite, which has implementation for many platforms. For sending messages (blocks and crawlrequests) this compatibility can be achieved by using Google’s Protocolbuffers, which is a cross-platform data serialization mechanism. When implementations across platforms use the same Protocolbuffers setup, messaging will across these platforms will be possible.
Making changes¶
Protocolbuffers is used to create the structure of messages. This includes all the messages used by the network overlay (Connection between peers) and the structures of the Trustchain related objects like TrustChainBlock
and CrawlRequest
. A complete overview of the message structure can be found in Complete structure. With Protocolbuffers the corresponding Java classes can be compiled, so it is possible to call the structures as objects. Making changes and recompiling the Java classes is quite easy, just follow the tutorial of ProtocolBuffers and you should be fine. When making changes, don’t forget to also update the database structure if necessary.
Complete structure¶
The complete structure of all parsable objects as defined in protocolbuffers.
Message
¶
bytes
source_public_keystring
source_namebytes
destination_addressint32
destination_portint32
typePayload
payload
Payload
¶
IntroductionRequest
introductionRequestIntroductionResponse
introductionResponsePuncture
puncturePunctureRequest
punctureRequestTrustChainBlock
blockCrawlRequest
crawlRequest
TrustChainBlock
¶
bytes
public_keyint32
sequence_numberbytes
link_public_keyint32
link_sequence_numberbytes
previous_hashbytes
signatureTransaction
transactiongoogle.protobuf.Timestamp
insert_time
Transaction
¶
bytes
unformattedstring
formatClaim
claim
Claim
¶
bytes
namegoogle.protobuf.Timestamp
timestampint32
validity_termbytes
proof_format
CrawlRequest
¶
bytes
public_keyint32
requested_sequence_numberint32
limit
IntroductionRequest
¶
int64
connection_type
IntroductionResponse
¶
int64
connection_typestring
internal_source_socketPeer
invitee- repeated
Peer
peers
Puncture
¶
string
sourceSocket
PunctureRequest
¶
string
source_socketPeer
puncture_peer
Peer
¶
bytes
addressint32
portbytes
public_keystring
nameint32
connectionType