Coder Social home page Coder Social logo

collieries / ethereum-event-forwarder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nodesguru/ethereum-event-forwarder

0.0 0.0 0.0 100 KB

Ethereum event bridging for Vega validators

Home Page: https://hub.docker.com/r/vegaprotocol/ethereum-event-forwarder

License: MIT License

JavaScript 97.97% Dockerfile 2.03%

ethereum-event-forwarder's Introduction

ethereum-event-forwarder

The event forwarder monitors the Ethereum blockchain for ERC20 based deposits/withdrawals and ethereum based staking events

This repo is part of the the ERC20 bridge functionality for Vega networks. Read about the architecture in this blog post, or check out the bridge smart contracts here. Specifically, this project listens for staking or deposit events on known contract addresses, and submits them to validator nodes.

Usage

Docker

We have provided a dockerfile in case you are planning to use Docker. You can run the script below after ensuring the parameters match with your local settings. Also note the section on configuration below, before starting

docker run \
  --init \
  --restart unless-stopped \
  --name vega-ethereum-event-forwarder \
  --port 3001:3001 \
  --volume "$PWD/data":/data:rw \
  --volume "$PWD/secret.key":/secret.key:ro \
  --volume "$PWD/config.toml":/etc/vega-ethereum-event-forwarder/config:ro \
  vegaprotocol/ethereum-event-forwarder:latest \
  ARGS

Native

If you have Node.js v16 installed, you can run it without docker:

# Create directory for the config (see Config section below for options)
mkdir -p ~/.config/vega-ethereum-event-forwarder/

# Move the configuration to the path you created
cp ./config-example.toml ~/.config/vega-ethereum-event-forwarder/config

# Edit the config, then start the server
npm install --production
npm start

For alternative folders and how to provide the configuration path via the command line, see the Config section below.

Config

Configuration is in TOML format. The path to the configuration file can be specified with the CONFIG env var, --config=PATH argument or by placing in a well-known location:

  • $HOME/.config/vega-ethereum-event-forwarder/config
  • /local/usr/etc/vega-ethereum-event-forwarder/config
  • /etc/vega-ethereum-event-forwarder/config

Sample configuration looks like below. Any of the options can be overriden by commandline arguments eg. --ethereum.http_endpoint=...

log_level = 'info' # error, info, debug, trace, silent

[event_queue]
  # Use '0.0.0.0' to bind to all IPv4, '::' to bind to all IPv6 and IPv4
  healthcheck_iface = '127.0.0.1'
  # Remember to expose this port from Docker also
  healthcheck_port = 3001

  # Path to keep persistent state
  datadir = '/data'

  # Path to read secret key from. If this doesn't exist, one will be
  # written here on initial start and the public key written to the logs
  secretkey_path = '/secret.key'

[ethereum]
  # Example, replace before running
  http_endpoint = "https://ropsten.infura.io/v3/API_TOKEN"
  # Number of confirmations before forwarding an event
  confirmations = 40

  # Address and height at which to accept events from the ERC20Bridge contract
  [ethereum.erc20_bridge]
    # Use either the contract deployment height or `-1` for the current block
    # height at initial start
    start_height = 10817792
    address = "0x898b9F9f9Cab971d9Ceb809F93799109Abbe2D10"

  # Addresses and height at which to accept events from the Staking contract
  [ethereum.staking]
    # Use either the contract deployment height or `-1` for the current block
    # height at initial start
    start_height = 10824755
    addresses = ["0xfc9Ad8fE9E0b168999Ee7547797BC39D55d607AA"]

[vega]
  # Example, expose to the docker container and replace this
  grpc_endpoint = "127.0.0.1:3002"

License

MIT

ethereum-event-forwarder's People

Contributors

emilbayes avatar edd avatar jeremyletang avatar

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.