waves_logo Docs
  • Ecosystem Apps
    Ecosystem Apps
  • Waves Explorer
    Waves Explorer
  • Account balance top up in the test network
    Account balance top up in the test network
  • Waves Keeper
    • Getting started with Waves Keeper
      Getting started with Waves Keeper
    • Waves Keeper API
      • Transaction Format
        Transaction Format
      Waves Keeper API
    Waves Keeper
  • Oracles
    • Create an oracle card with Waves Oracle
      Create an oracle card with Waves Oracle
    • Create an oracle card with a data transaction
      Create an oracle card with a data transaction
    • Oracle card
      Oracle card
    • Updating oracle card
      Updating oracle card
    • Data transaction tool
      Data transaction tool
    • How to create an oracle
      How to create an oracle
    Oracles
  • Token Rating
    • User interface
      User interface
    • Rating formula
      Rating formula
    • Data transaction with user's rate
      Data transaction with user's rate
    • Data transaction of the Token Rating oracle
      Data transaction of the Token Rating oracle
    • Token management
      Token management
    Token Rating
      • English
      • Русский
      On this page
        • An example escaped string with rates
      waves_logo Docs

          # Data transaction of the Token Rating oracle

          Once a day, the Token Rating (opens new window) oracle sends to the blockchain a data transaction with ratings and rates of tokens.

          A data transaction contains the information about tokens, that have been rated in the past 24 hours.

          A single transaction contains the information about no more than 25 tokens — if there are more rated tokens, then several transactions will be sent.

          An example of a data array of such a transaction:

          "data": [
            {
              "key": "assetRating_BsL9uRX4bucKcSY7rfUPhqKjXiWomUQTGFGhodNySACb_1"
              "type": "integer",
              "value": 43,
            },
            {
              "type": "integer",
              "value": 28343,
              "key": "assetWeight_BsL9uRX4bucKcSY7rfUPhqKjXiWomUQTGFGhodNySACb"
            },
            {
              "type": "integer",
              "value": 12,
              "key": "assetVotes_BsL9uRX4bucKcSY7rfUPhqKjXiWomUQTGFGhodNySACb"
            },
            {
              "key": "scoreBoard_BsL9uRX4bucKcSY7rfUPhqKjXiWomUQTGFGhodNySACb"
              "type": "string",
              "value": "{\"1\":{\"votes\":0,\"tokens\":0},\"2\":{\"votes\":1,\"tokens\":322},\"3\":{\"votes\":0,\"tokens\":0},\"4\":{\"votes\":0,\"tokens\":0},\"5\":{\"votes\":1,\"tokens\":1120}}",
            },
            ...
            {
                "type": "integer",
                "value": 45,
                "key": "tickerRating_1"
            },
            {
                "type": "integer",
                "value": 10000,
                "key": "tickerWeight"
            },
            {
                "type": "integer",
                "value": 11,
                "key": "tickerVotes"
            }
          ]
          

          The key field is formed by concatenating (opens new window) a string that describes the parameter and a string with the ID of a token.

          Key Type Description
          assetRating_assetId_1 integer Rating of the token (multiplied by 10)
          assetWeight_assetId integer WCT weight of the token
          assetVotes_assetId integer Votes sum of the token
          scoreBoard_assetId string The value the field contains an escaped string (opens new window) with rates.
          tickerRating_1 integer Service parameter, which contains the value of the Rating (multiplied by 10), which must be at the token in order for the ticker to be set by its issuer
          tickerWeight integer Service parameter, which contains the value of the WCT weight, which must be at the token in order for the ticker to be set by its issuer
          tickerVotes integer Service parameter, which contains the value of the Votes sum, which must be at the token in order for the ticker to be set by its issuer

          # An example escaped string with rates

          Let's say we have an escaped string with rates:

          "{\"1\":{\"votes\":0,\"tokens\":0},\"2\":{\"votes\":0,\"tokens\":0},\"3\":{\"votes\":3,\"tokens\":545},\"4\":{\"votes\":0,\"tokens\":0},\"5\":{\"votes\":2,\"tokens\":3827}}"
          

          Let's unescape that string:

          {
            "1": {
              "votes": 0,
              "tokens": 0
            },
            "2": {
              "votes": 0,
              "tokens": 0
            },
            "3": {
              "votes": 3,
              "tokens": 545
            },
            "4": {
              "votes": 0,
              "tokens": 0
            },
            "5": {
              "votes": 2,
              "tokens": 3827
            }
          }
          

          It follows from the string that no one rated the token with one, two or four stars.

          Three users rated the token with three stars. The sum of the weights Wn of those rates is 545.

          Two users rated the token with five stars. The sum of the weights Wn of those rates is 3827.

          Data transaction with user's rate
          Token management
          Data transaction with user's rate
          Token management