3

I cannot find any implementation of a consumer for the state_history_plugin.

The official Nodeos webpage suggests the fill-postgresql repo. But, I cannot compile it -- even after building the specific cmake that the author decided to use, and fixing all the git submodule references it still refuses to compile.

Another interesting repo is this JS implementation of a consumer: https://github.com/tmuskal/jsclient-eosio-state-history-plugin

But the problem with it is that it has the ABI from the node hardcoded, and I think it has an outdated version, so nothing happens.

I wrote a simple Python websocket function that returns the only ABI from my node:

import websockets
import asyncio

async def consumer():
    async with websockets.connect('ws://localhost:8080') as websocket:
        msg = await websocket.recv()
        print(msg)

loop = asyncio.get_event_loop()
loop.run_until_complete(consumer())

But to get updates of blocks or actions I need to send a message to the node via the same scheme, i.e.,

websocket.send(<MESSAGE_TO_NODE>)

What is this message? Also, how to deserialize the data from the Node?

2
  • I am still working on this problem, How do you deserialize the data now? could u please offer some experience? Commented Jun 24, 2019 at 16:45
  • Any new progress now?
    – shtse8
    Commented Dec 14, 2019 at 9:47

2 Answers 2

1

I found a repo with a JS program for listen to the node and get the blocks.

https://github.com/mauhcs/ship_monitoring

The fill.js came from another repo that I can't find the url anymore. But for future reference I want to close this question with this script that helped me develop my own solution.

0

You can use c++ example of serialization / deserialization from fill postgres plugin https://github.com/EOSIO/fill-postgresql or typescript from eosjs repo - https://github.com/EOSIO/eosjs/blob/develop/src/eosjs-serialize.ts.

MESSAGE_TO_NODE - is serialized request from abi from state history plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.