Algorithms

Userfeeds Platform allows running community written algorithms on too of data gathered from all supported sources like Ethereum blockchain (mainnet, ropsten, rinkeby, kovan, whisper messages), IPDB (BigchainDB) or direct messages.

Algorithms can be referenced by their identifier that depends on where the author decided to share them.

Some of algorithm sources and naming schemes are:

  • Github - github:username.repository.filename
  • Bitbucket - bitbucket:username.repository.filename
  • Gist - gist:hash

Note

More esoteric sources are possible, like downloading code from blockchain or encrypted algorithm code but their support is not planned at the moment.

Warning

Current support is limited to built-in algorithms through their short identifiers.

Built-in algorithms

Source code: https://github.io/Userfeeds/algorithms

All algorithms require one information: context. They will get all claims intended for given context and sort them according to their specification.

Note

Built-in algorithms can be referenced normally via eg. github:username.repo.filename or by their short name eg. latest

Claims (TODO)

Identifier: claims, github:Userfeeds.algorithms.claims

The simples algorithm of all. It just returns 100 latest claims for given context

Parameters

type
  • string
  • optional

Type of claims to return

Example data

{
  "items": [
    {
      "created_at": 1499676056549,
      "id": "0xd10409e340b5f41be0c0c8db85a61b2db0e5f4fb6c87fd3a5e4b73adc9bee9bf",
      "score": 1000000000000000000,
      "target": "https://userfeeds.io/"
    },
    {
      "created_at": 1499676053781,
      "id": "0xcd05844f64d472d8aeceeafc1c14f377bc664a9f94574ee820128254c962bfdc",
      "score": 5000000000000000000,
      "target": "https://example.com/"
    },
    {
      "created_at": 1499676051855,
      "id": "0xaa6b523d72d1f0e9b00689f494ac622804e0552e55c939cabc97381bd401732b",
      "score": 0,
      "target": "0x64537b9f7c9d85bae5c52cb4fa2307e7da14c6f1cae6d710b66a4ddcc059e1a8"
    },
    {
      "created_at": 1499676051757,
      "id": "0x64537b9f7c9d85bae5c52cb4fa2307e7da14c6f1cae6d710b66a4ddcc059e1a8",
      "score": 100000000000000,
      "target": "https://some.path/"
    }
  ]
}

Authored (TODO)

Identifier: authored, github:Userfeeds.algorithms.authored

This algorithm return all claims that were authored by context. In other words all claims that have AUTHORED relation to Account node with id equal to context.

Parameters

type
  • string
  • optional

Type of claims to return

Example data

{
  "items": [
    {
      "created_at": 1499676051855,
      "id": "0xaa6b523d72d1f0e9b00689f494ac622804e0552e55c939cabc97381bd401732b",
      "score": 0,
      "target": "0x64537b9f7c9d85bae5c52cb4fa2307e7da14c6f1cae6d710b66a4ddcc059e1a8"
    },
    {
      "created_at": 1499675901184,
      "id": "0xc3921abdd00ca53925e5a5b8559537d44e19165ff3ad4e89daf0bb034a4afa21",
      "score": 10000000000000000,
      "target": "Lorem ipsum dolor sit amet, consectetur adipisicing elit"
    },
    {
      "created_at": 1499156515246,
      "id": "0x85b6643f69e746c7525fc3ed88e1f18241068bcff6516fbf2dd0d967ebdaf390",
      "score": 0,
      "target": "0x794d0c42fc35af7eba9216261ea3799e19d079d24dcf795fda94acf20ad298f8"
    }
  ]
}

Hold (TODO)

Identifier: hold, github:Userfeeds.algorithms.hold

Simple algorithm that collects all claims and sorts them according to cumulative hold. Hold is holdings*time for given token. If someone has 10 ETH for 1 day then we can say he has hold of value 10, if he still has 10 ETH during next 6 days his hold will raise to 70.

Writing ranking algorithms

The best way to start writing your own algorithms is to look at the built-in one at https://github.io/Userfeeds/algorithms

TODO: ^^ more effort here please…

Data available for ranking algorithms

Database dumps can be found here:

Those data dumps are updated TODO:daily/hourly/constantly? and can be used for development and data analysis.

TODO: Import instructions

Note

Direct database access will be possible to our read-only instances for projects that require lower delays.

Claims

TODO

Balances and Aggregated data

TODO

Helper functions

TODO

Testing your algorithm

Importing database

Connecting your algorithm to Userfeeds Platform

TODO

Publishing your algorithm

Supported source are:

  • Github
  • Bitbucket
  • Gist

TODO: …

Registering algorithm on Userfeeds Platform

TODO