Giter Site home page Giter Site logo

chainlinkethfailover's Introduction

Chainlink ETH failover proxy

What does it do?

Instead of relying on a single connection between your Chainlink node and an ETH node (your own or EaaS), you can use this proxy to fail over between multiple ETH nodes. All endpoints are just URLs, so there's no need for the nodes to be on the local network.

Features

  • Automatic failover for any number of ETH nodes
  • Connection timeouts
  • Automatically checks if it's receiving block header notifications
  • Custom headers timeout through HEADERS_TIMEOUT environment variable (seconds)

How to use

Install (Docker)

Pull the image from Docker:

docker pull fiews/cl-eth-failover

Start the container: (Read more in Usage to learn how to set multiple endpoints)

docker run fiews/cl-eth-failover wss://cl-ropsten.fiews.io/v1/yourApiKey

Install (manually)

To start off, you need Yarn/Node.js installed (and git, for cloning the repo).

Clone repository and enter directory:

git clone https://github.com/OracleFinder/ChainlinkEthFailover.git && cd ChainlinkEthFailover/

Install dependencies:

yarn install

Make sure we set the correct permissions:

chmod +x ./index.js

Usage

This proxy will add any arguments to the script as ETH node endpoints.

docker run [-e HEADERS_TIMEOUT={}] fiews/cl-eth-failover [node-1] [node-2] [...] [node-n]

If not using Docker, replace docker run fiews/cl-eth-failover with node ./index.js

Example start command:

docker run fiews/cl-eth-failover wss://cl-ropsten.fiews.io/v1/myApiKey ws://localhost:8546/

This will output the following:

Adding endpoint wss://cl-ropsten.fiews.io/v1/myApiKey to list
Adding endpoint ws://localhost:8546/ to list
Server is listening on port :4000

Chainlink configuration

To use this proxy with your Chainlink node, just set the ETH_URL environment variable to port 4000 of the instance that's running the proxy. Eg. ws://localhost:4000/

chainlinkethfailover's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

chainlinkethfailover's Issues

Feature: http support

Now that CL can benefit from ws as well as http nodes (see 0.10.6 release notes), it’d be great if this proxy would support two connection points and two lists: one ws, one http.

Feature: Logs into file, JSON format

Two features actually, that would be helpful for log parsing:

Ability to log to a file without using tee, something like --logfile. Useful for exporting via AWS CloudWatch et al

Format of that log file to be JSON, for easier parsing

Suggested JSON format:

  • level - info, warn, error
  • ts - timestamp, example "1616876543.8821354"
  • msg - the actual log message

Basic auth support

According to our conversation, creating issue for supporting basic auth authentication.
After some analysis i believe this is reason for the proxy to not connect to some nodes.

Feature: Failback after failover

Thank you for this tool!

A useful feature would be polling endpoints that failed, to see whether they can resume duty, and fail back. This would implement a hierarchy of endpoints, where endpoints specified earlier are always preferred over endpoints specified later.

Currently, failback requires a restart of the proxy.

Add ability to direct new transactions to specific endpoint(s)

A use case for L2s is where you have multiple L2 replica nodes running, which don't support broadcasting txs. You then want to use this Proxy for the replica nodes, while any eth_sendRawTransaction requests will go to a designated tx broadcasting endpoint (e.g. official endpoint).

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.