"Buffered" architecture for the applications that utilize Steem/Golos blockchains.
Golos.io is a frontend that works directly with the Golos blockchain API. Every user action is sent to the blockchain, and reply is processed and displayed, which imposes a number of limitations.
"Straight" architecture.
Currently, the display of information is tuned to the data that the blockchain returns for the queries such as hot, trending, discuss... Every query to display an article is sent to the blockchain to find based on authors username and a direct link to an article. Only the first tag is treated as a category, that was selected by the users during the creation of the article. Only it participates in the "ranking" of the tags, by being displayed closer to the top based on the amount of votes cast for it... and this is also returned by querying the blockchain.
Such "straight" method imposes a number of limitations, that do not allow a number of practical problems to be solved, particularly ones that have to do with non standard sorting of the tags, and displaying the information based on all of the custom metadata, or other parameters (such as price for an item of goods). Since there is no database, such problems could be solved only by modifying the API, which is not trivial, and is mainly available to the Steem developers. But, even if we are able to realize the filtration based on several tags, it will not solve all of the problems that might arise during the development of the third party applications, and sooner or later the developers would face similar problems.
"Buffered" architecture.
To solve the problem of flexible display of the blockchain data, we propose to use a continually synchronized MySQL database as a data buffer. Every time that a new block is created by the blockchain, the data are read and parsed according to the developers needs into the respective fields and tables of the database. Such an approach allows to sidestep all the obvious limitations of the blockchain API usage, and opens a range of possibilities for new applications.
Implementation.
Parser is written in PHP and works with any type of node (local or not; Steem or Golos), by reading and sorting the information in the following tables:
- Posts;
- Comments;
- Categories;
Every tag used is put in the respective field in the Posts table, which allows the implementation of the information filtering in any conceivable way. Also, the Posts table contains full and continually updated data needed to render the article without querying the blockchain again.
Comments table is updated on the same principle, but the comment tags do not have a wide structure, because the blockchain only stores the parent category for that (that is the first tag of the parent post). This allows, if necessary, to limit the display of the comments based on the needed categories.
The Categories table is a prepared set of strings to build a user supplied tags into a tree, where every nested category appears if there is a parent category. For example, tags specified as Golos -> Eurasia -> Russia -> Moscow would be nested and displayed in that exact order.
Capabilities.
With this buffered method it is possible to implement a structured knowledge base for any theme. Parser could gather data from the blockchain as a whole, or only from one category, which is needed for the emergence of the communities.
GitHub
Repository link github.com/dacom-dark-sun/parser
Translated by @xanoxt
If you weren't aware, @arcange built something similar, on SQL Server. But it isn't open source.
https://steemit.com/steemit/@arcange/steemsql-com-a-public-sql-server-database-with-all-steemit-blockchain-data
He has both STEEM and GOLOS support, and the server is very fast.
Congratulations @dark.sun! You have received a personal award!
Happy Birthday - 1 Year on Steemit Happy Birthday - 1 Year on Steemit
Click on the badge to view your own Board of Honor on SteemitBoard.
For more information about this award, click here
Congratulations @dark.sun! You have received a personal award!
2 Years on Steemit
Click on the badge to view your Board of Honor.
Congratulations @dark.sun! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!