A VulcanizeDB transformer for watching events related to the Sai contract.
- Go 1.9+
- Postgres 10
- Ethereum Node
- Go Ethereum (1.8+)
- Parity 1.8.11+
- IPFS
- Setup Postgres and an Ethereum node - see VulcanizeDB README.
git clone git@github.com:8thlight/sai_watcher.git
note: go get
does not work for this project because need to run the (fixlibcrypto)[https://github.com/8thlight/sai_watcher/blob/master/Makefile] command along with go build
.
- Install dependencies:
make installtools
- Create the database based on the VulcanizeDB schema:
make setup NAME=vulcanize_public
- Run the migrations to add project specific tables to the database:
make migrate NAME=vulcanize_public
- Build:
make build
-
To use a local Ethereum node, copy
environments/public.toml.example
toenvironments/public.toml
and update theipcPath
to the local node's IPC filepath:-
when using geth:
- The IPC file is called
geth.ipc
. - The geth IPC file path is printed to the console when you start geth.
- The default location is:
- Mac:
$HOME/Library/Ethereum
- Linux:
$HOME/.ethereum
- Mac:
- The IPC file is called
-
when using parity:
- The IPC file is called
jsonrpc.ipc
. - The default location is:
- Mac:
$HOME/Library/Application\ Support/io.parity.ethereum/
- Linux:
$HOME/.local/share/io.parity.ethereum/
- Mac:
- The IPC file is called
-
-
See
environments/infura.toml
to configure commands to run against infura, if a local node is unavailable.
This command syncs VulcanizeDB with the configured Ethereum node.
- Start node (if fast syncing wait for initial sync to finish)
- In a separate terminal window:
./sai_watcher sync --config <config.toml> --starting-block-number <block-number>
- where
block-number
is a recent enough block to fetch contract data with your node
getEvents
starts up a process to watch for blocks on specified contracts, as well as specific log events associated with those contracts. It then stores transformed values in the following tables and views in the VulcanizeDB database:
Tables:
maker.peps_everyblock
maker.cup_action
log_filters
maker.gov
Views:
public.cup_act
public.cup
This command will need to be run against a full archive node. If a local full archive node is unavailable, see the previous point about running this command against infura.
./sai_watcher getEvents --config <config.toml>
We're using PostGraphile to create a GraphQL API from the VulcanizeDB postgres schema.
- Ensure that Node.js v8.6 is installed.
- Install postgraphile:
npm install -g postgraphile
- Start the postgraphile server:
postgraphile -c "postgresql://<user>@localhost:5432/vulcanize_public" --schema=public,maker
- the
-c "postgresql://user@localhost:5432/vulcanize_public"
flag indicates which postgres connection postgraphile should be looking to, where<user>
is your local postgres user - the
--schema=public,maker
flag indicates which schema(s) postgraphile should use to generate the GraphQL API
- the
This task creates a report of your database and persists it on IPFS.
- Run the command:
./sai_watcher generateReport --config environments/public.toml
- This will return an IPFS hash.
- To fetch this hash from IPFS:
ipfs dag get <the hash>
make installtools
make setup NAME=vulcanize_private
make migrate NAME=vulcanize_private
ginkgo -r