Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short forms of accounts and content #217

Closed
andyoknen opened this issue Feb 24, 2022 · 1 comment
Closed

Short forms of accounts and content #217

andyoknen opened this issue Feb 24, 2022 · 1 comment
Assignees
Milestone

Comments

@andyoknen
Copy link
Collaborator

Account:

  • Avatar
  • Name
  • Reputation
  • Badge

Content:

  • Type
  • Caption
  • Author (id or full record?)
  • Payload part (optional)
@andyoknen andyoknen self-assigned this Feb 24, 2022
@andyoknen andyoknen added this to the v0.21.0 milestone Feb 24, 2022
@andyoknen andyoknen modified the milestones: v0.21.0, v0.21.1 Apr 1, 2022
@lostystyg
Copy link
Collaborator

lostystyg commented May 3, 2022

"?" represent optional values.

Short form Tx structure:

{
    type,
    txData,
    ?relatedContent
}

type represents the type of whole short form whereas txType represents literally the type of tx such short form contains. It is one of the following:

  • "pocketnetteam"
  • "money"
  • "referal"
  • "answer"
  • "comment"
  • "subscriber"
  • "commentscore"
  • "contentscore"
  • "privatecontent"
  • "boost"
  • "repost"

txData and relatedContent follows the structure below.

{
    hash,
    txType,
    ?address, # address of tx creator
    ?blockNum, # number of tx in block
    ?height,
    ?account, # short form of the account, see below
    ?value, # any number related to tx, e.x. comment score, transferred money, etc
    ?desctiption # caption or first few lines of content
}

Short form Account Structure:

{
    avatar,
    name,
    badge,
    reputation
}

The reason why the most fields are optional is to optimize amount of data transferred to clients. E.x. address is optional because if client is asking for all events for a certain address, all relatedContent will have address the same as requested one so it is unnecessary to send it back to client. Probably the good idea will be to allow client to specify which fields it really needs so node can generalize the behavior of constructing such structures.

Example of ShortForm:

{
    "hash": "933aa214e59479469351f55cd7d3b58daee28c4ae8372b164a8b20906c83b9c5",
    "txType": 301,
    "height": 60639,
    "blockNum": 2,
    "address": "TAkhjctML34VmcaUYWuW3grPardhfReLxh",
    "val": 1,
    "type": "commentscore",
    "relatedContent": {
        "hash": "b8d614d9f4bdc91b01b499561c9a4dbcb09dc6cb5ed0ebf50b113bec1f598497",
        "txType": 204,
        "height": 46420,
        "blockNum": 2,
        "description": "{\"message\":\"Nice\",\"url\":\"\",\"images\":[]}"
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants