hotdog - A Custom JSON Indexer on the top of MongoDB

in #utopian-io6 years ago (edited)

Repository

STEEM supports custom_json operations which allows you to post any type of JSON data into the blockchain.

For example, things like following, reblog, mute are implemented on CustomJSON level. Any 3rd party decentralized app can make use of this stuff. Here is an example of the script where you can push your custom JSON into the network.

I want to implement a decentralized pastebin service with the STEEM blockchain just for the fun. Since pasted content on Pastebins are generally junk, embedding them into the posts or comments are useless. These type of content shouldn't be rewarded.

CustomJson operation can save the day for this kind of needs. However, I cannot run lookups on custom_json's. So, I have needed an indexer backend where I need to filter and store the relevant data in my own MongoDB. You can have a look at my early and hacky design post.

hotdog is that backend indexer where you can insert the relevant CustomJSON operations into your MongoDB instance constantly. Then, you can use MongoDB to use the data, run complex queries and represent in a traditional web app.

Installation

$ (sudo) pip install steem_hotdog

Configuration

Hotdog works with JSON files to handle configuration. An example configuration file is located at the repository.

{
  "nodes": ["https://api.steemit.com"],
  "mongo_uri": "localhost",
  "mongo_db_name": "custom_json",
  "blacklisted_posting_auths": ["bad_user"],
  "custom_json_ids": ["dlink", "dnews"],
  "custom_json_id_collection_map": {
    "dlink": "dlink",
    "dnews": "dnews",
  }
}
OptionDescription
nodesA list of nodes to connect
mongo_uriMongoDB connection string
mongo_db_nameDatabase name for the MongoDB
blacklisted_posting_authsA blacklist to skip posting auths
custom_json_idsA list of CustomJson ids to fetch
custom_json_id_collection_mapMap of custom_json_id and Mongo collections

Running

$ hotdog /path/to/config.json

Setting a specific starting point

$ hotdog /path/to/config.json --start-at block_height

Setting a specific stop point

$ hotdog /path/to/config.json --stop-at block_height

Or you can use both:

$ hotdog /path/to/config.json --start-at start_block --stop-at stop_block

Technology Stack

The bot runs on Python 3.6+. It may run on previous versions of py3k, but didn't tried it myself.

Roadmap

Indexer runs fine at the moment.

I have been thinking to add a REST API interface via flask to expose the data. However, the dynamic nature of custom jsons makes this task complicated for querying.

How to Contribute

Contribution process is same as any other open-source project. You can check out open issues at Github and can start working. Just make sure, you will comment on the related issue before starting working on it.

GitHub Account

https://github.com/emre

Sort:  

A port to beem should be very easy

Yes! Do you think I should switch to beem?

Yeah I have also ported to beem. It is a really good python lib for steemit

I should have suggested it:(
I am not a clever man.

Yes, I do all things now in beem.
It just works. On all python versions

Thank you for your contribution.

Your contribution has been evaluated according to Utopian rules and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post,Click here


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @emrebeyler
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.31
TRX 0.12
JST 0.033
BTC 64341.19
ETH 3145.13
USDT 1.00
SBD 4.00