Coder Social home page Coder Social logo

vulcan0x's Introduction

vulcan0x

Cache contract data from the blockchain to PostgreSQL.

Reflect a GraphQL schema over the Postgres schema and serve via express.

Specify transformations for watched contracts at dapp/{contract}

Setup

Connection details for Postgres and Ethereum are expected to be defined as environment variables. By default the application will expect a .env file located in the root directory containing these connection details.

e.g vulcan0x/.env

POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=database

ETH_PROVIDER=ws://localhost:8546
ETH_CHAIN=kovan

DAPPS=oasis:erc20 # specify which watchers to run on sync & subscribe

Alternate configurations can be specified by setting ENV when invoking scripts:

Pass the name of the env file when located in the root directory:

ENV=.mainnet.env npm run subscribe

Or a fullpath to the env if located outside of the root directory:

ENV=/path/to/file/.kovan.env npm run sync
ENV=/path/to/file/.test.env npm run sync
ENV=/path/to/file/.develop.env npm run sync

Usage

Ad-hoc commands:

  • npm run migrate - run pending database migrations
  • npm run sync - sync log event history from the blockchain to postgres
  • npm test - run the test suite

Running processes:

  • npm run subscribe - subscribe to new log events on all watched contracts
  • npm run graphql - run the graphql server over localhost

Options:

The sync and subscribe commands can be used without options to run against all contracts in the dapp folder or with the --dapp flag to run against a particular contract.

npm run sync -- --dapp=oasis

Docker

docker pull oasisdexorg/vulcan0x

Running locally

Where NETWORK is one of mainnet, kovan or local

./scripts/start.sh NETWORK # start localnode + postgres + migrate + sync + subscribe + graphql

Development

./scripts/start-dev.sh # starts postgres and does schema migration

Then you should start localnode and you can run any script directly with yarn run subscribe | sync | graphql.

vulcan0x's People

Contributors

desaperados avatar krzkaczor avatar dizzy avatar fenris85 avatar sashatechops avatar oleksandrua avatar

Stargazers

Alexey Elizarov avatar cloudonshore avatar

Watchers

Daniel Brockman avatar Mariano Conti avatar  avatar  avatar James Cloos avatar Andrei David avatar Andrew Milenius avatar Roberto Cano avatar Marcin Ciarka avatar Thomas Pulber avatar James Tuckett avatar Halaprix avatar Adam Skrodzki avatar  avatar Gonzalo Balabasquer avatar Huiyu Yang avatar Damian Paszkowski avatar  avatar  avatar

Forkers

pinkdiamond1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.