Translations of this page?:

twister

Peer-to-peer microblogging

User Tools

Site Tools


development:dht_protocol:structures

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== DHT protocol structures ====== ===== User posts ===== User posts are bencoded structures with the following fields: <code javascript> "userpost" : { "n" : username, "k" : seq number, "msg" : message, "time" : unix utc, "height" : best height at user (number of blocks), "lastk" : seq number of previous public post -opt, "dm" : encrypted message (dm) -opt, "rt" : original userpost - opt, "sig_rt" : sig of rt - opt, "reply" : - opt, { "n" : reference username, "k" : reference k, } } </code> "sig_userpost" : signature of bencoded "userpost" by user "n" ===== General structure ===== as in [[development:dht_protocol:apis#getData]] and [[development:dht_protocol:apis#putData]] DHT commands <code javascript> { "p" : { "height" : number of blocks at time it was created, "seq" : update sequence (for single type values), "target" : { "n" : user name or hashtag name etc, "r" : name of the resource, "t" : either "s" (single) or "m" (multi) }, "time" : unix utc timestamp in seconds, "v" : this is the actual value (string, dict etc) }, "sig_p" : signature of "p" contents (bencoded), "sig_user" : user signing this } </code> Each resource in the following list defines what goes to the "v" field above. ==== profile ==== <code javascript> "target": {"n":username,"r":"profile","t":"s"} { "fullname" : presentation name, "bio" : short bio, "location" : location, "url" : user home page url, "background" : background img url } </code> ==== avatar ==== <code javascript> "target": {"n":username,"r":"avatar","t":"s"} </code> Embedded image (up to 4kB): ''"data:image/jpg;base64,/9j..."'' Or link to external image: ''"http://www.gravatar.com/avatar/205e460b..."'' ==== following ==== <code javascript> "target": {"n":username,"r":"following" + N,"t":"s"} </code> This is the list of following for a given username. Because size limitations in DHT storage the list may be split in several pages with increasing N values (starts with "1″). N is concatenated as string to the "r" field. ["user1","user2","user3"...] There must be a last page N+1 with an empty list. ==== post ==== <code javascript> "target": {"n":username,"r":"post" + K,"t":"s"} </code> This is the K-th (public) post of user "n", as defined in "userpost". ==== status ==== <code javascript> "target": {"n":username,"r":"status","t":"s"} </code> This resource contains a copy of the last post by user. Because this same resource is updated several times it is important that the "seq" field is increased, in fact, "seq" = K. ==== replies ==== <code javascript> "target": {"n":username,"r":"replies" + K,"t":"m"} </code> This is the list of replies to the K-th post of user "n". It contains the posts themselves. Because it is a "m" type, a new post may be added to this resource by any valid user. ==== rts ==== <code javascript> "target": {"n":username,"r":"rts" + K,"t":"m"} </code> This is the list of RTs (retransmissions) to the K-th post of user "n". It contains the posts themselves. Because it is a "m" type, a new post may be added to this resource by any valid user. ==== hashtag ==== <code javascript> "target": {"n":tag,"r":"hashtag","t":"m"} </code> This is the list of posts including the hashtag "n". It contains the posts themselves. Because it is a "m" type, a new post may be added to this resource by any valid user. ==== mention ==== <code javascript> "target": {"n":username,"r":"mention","t":"m"} </code> This is the list of posts mentioning @username. It contains the posts themselves. Because it is a "m" type, a new post may be added to this resource by any valid user. ==== tracker ==== <code javascript> "target": {"n":username,"r":"tracker","t":"m"} </code> This is a special read-only resource used to obtain the nodes of the user swarm for post distribution.

development/dht_protocol/structures.1391084792.txt.gz · Last modified: 2014/01/30 13:26 by jpfox