2

Does anyone have any idea dea how to use Demux with EOS Blockchain. There is this repo where they give example how to use Demux.

I want to ask if there is any example for how to "use Demux without Docker"

2 Answers 2

1

I've integrated it in my simple Chess Dapp if you'd like a code example:

https://github.com/NatPDeveloper/eos-chess/tree/master/js/lib/demux-js

Specifying contract:action to listen for:

const updaters = [
    {
      actionType: "chesschessch::setstat", // updated with current contract account name
      updater: updateMatchStatus,
    },
  ]

App.js setup to configure block indexing speed and API endpoint to ping:

// JUNGLE TESTNET
const actionReader = new NodeosActionReader(
    "https://poll.troonblockchain.io:9999", // Locally hosted node needed for reasonable indexing speed
    22238967, // First actions relevant to this dapp happens at this block
)

const actionHandler = new MyActionHandler(
    updaters,
    effects,
)

const actionWatcher = new BaseActionWatcher(
    actionReader,
    actionHandler,
    250, // Poll at twice the block interval for less latency
)

actionWatcher.watch() // Start watch loop
0

Yes. You can use Demux without docker. The best way is to take the example repository's "backend" folder and copy locally. Then you can modify the code to interface with a smart contract you write yourself and you can run it with nodemon. There are also examples in the main demux wiki that might be easier to follow than the larger / arguably needlessly complex demux example repo.

2
  • Are you using demux for your usecase .? Commented Nov 6, 2018 at 6:05
  • @NirdeshKumarChoudhary Yes, I am currently building an application with Demux support and not using docker to do so. It seems complex at first, but at the end of the day Demux is really just a script that reads through blockchain history and makes notes in a database based on what it sees. The example project is heavily over-engineered but everything you need is in there in the 'backend' folder.
    – pavja2
    Commented Nov 7, 2018 at 12:37

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.