plasma-indexer

command module
v0.0.0-...-c106c27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2019 License: GPL-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Plasma Indexer

Sample code of EVM contract events indexer and API.

Setup sample code

  1. create a MYSQL database for storing events, default DB name is plasma-indexer
  2. deploy contract/LoomStore.sol contract to your cluster
  3. call set method to make the contract emit an event
  4. compile LoomStore indexer and Plasma API using the following command
make deps
make

LoomStore indexer

LoomStore indexer queries events emitted from LoomStore contract and store them in MySQL database

Run LoomStore indexer

./loomstore-indexer --db-password rootpassword --db-user root --block-height 5714082 \
 --read-uri http://your-non-validating-node.com:80/query --contract-address 0x8AE87cb755837c22Ec3E105144d88E9CE6769A62

Plasma API

Plasma API provides API endpoint for querying specific events from MySQL database

Run Plasma API

vi plasma.yaml // edit config file
./plasma-api

then go to http://localhost:3333/loomstore_events to check the fetched events

Working example

To demonstrate fetching contract events, the following steps have been done

  1. LoomStore has been deployed on extdev cluster with address 0x8AE87cb755837c22Ec3E105144d88E9CE6769A62
  2. LoomStore has a method set that, once it's called, emits NewValueSet event
  3. set is called at block height 6714083 and the NewValueSet event has been emitted, please check http://extdev-plasma-us1.dappchains.com/query/contractevents?fromBlock=6714083&toBlock=6714083

To run LoomStore indexer to query events and store in MySQL

./loomstore-indexer --db-password rootpassword --db-user root --block-height 6714083 \
 --read-uri http://extdev-plasma-us1.dappchains.com:80/query --contract-address 0x8AE87cb755837c22Ec3E105144d88E9CE6769A62

To run Plasma API

./plasma-api

then go to http://localhost:3333/loomstore_events to check the fetched events

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
indexer
loomstore command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址