DHT resources

General structure (as in getData and putData DHT commands):

{
  "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
}

Each resource in the following list defines what goes to the “v” field above.

  • “target”: {“n”:username,”r”:”profile”,”t”:”s”}
    {
      "fullname" : presentation name,
      "bio" : short bio,
      "location" : location,
      "url" : user home page url,
      "background" : background img url
    }

  • “target”: {“n”:username,”r”:”avatar”,”t”:”s”}
    Embedded image (up to 4kB):
    "data:image/jpg;base64,/9j..."

    Or link to external image:

    "http://www.gravatar.com/avatar/205e460b..."

  • “target”: {“n”:username,”r”:”following” + N,”t”:”s”}
    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.

  • “target”: {“n”:username,”r”:”post” + K,”t”:”s”}
    This is the K-th (public) post of user “n”, as defined in “userpost”.
  • “target”: {“n”:username,”r”:”status”,”t”:”s”}
    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.
  • “target”: {“n”:username,”r”:”replies” + K,”t”:”m”}
    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.
  • “target”: {“n”:username,”r”:”rts” + K,”t”:”m”}
    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.
  • “target”: {“n”:tag,”r”:”hashtag”,”t”:”m”}
    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.
  • “target”: {“n”:username,”r”:”mention”,”t”:”m”}
    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.
  • “target”: {“n”:username,”r”:”tracker”,”t”:”m”}
    This is a special read-only resource used to obtain the nodes of the user swarm for post distribution.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>