loom-sdk-documentation icon indicating copy to clipboard operation
loom-sdk-documentation copied to clipboard

Document querying our event store and setting up one

Open andreipope opened this issue 5 years ago • 2 comments

Document querying our event store and setting up one

andreipope avatar May 17 '19 14:05 andreipope

Event Store allows users to query events emitted from contracts running on our chain.

The following is the config to enable Event Store

EventStore:
  DBName: {{.EventStore.DBName}} // Set DB name (can be anything, default is events)
  DBBackend: {{.EventStore.DBBackend}} // Set DB type 'goleveldb' or 'cleveldb'
{{end}}

EventDispatcher:
  Dispatcher: {{.EventDispatcher.Dispatcher}} // Available dispatcher: "db_indexer" | "log" | "redis"
  # Redis will be use when Dispatcher is "redis"
  Redis:
    URI: "{{.EventDispatcher.Redis.URI}}"// Redis URI

Config example

EventDispatcher:
  Dispatcher: db_indexer

EventStore:
  DBName: "event"
  DBBackend: "goleveldb"

Now you can query emitted event fromBlock to toBlock

https://plasma.dappchains.com/query/contractevents?fromBlock=5216332&toBlock=5216352

pathornteng avatar May 21 '19 10:05 pathornteng

https://github.com/loomnetwork/loom-sdk-documentation/pull/214

andreipope avatar Jul 09 '19 20:07 andreipope