Coder Social home page Coder Social logo

rupiahwallet / relayer-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bcnmy/relayer-node

0.0 0.0 0.0 317 KB

A Multichain Relayer Node

License: GNU General Public License v3.0

JavaScript 0.07% TypeScript 96.58% Handlebars 2.61% Smarty 0.64% Dockerfile 0.10%

relayer-node's Introduction

Relayer Node

The Relayer Node is responsible for validating transactions, paying their gas fees, and sending them to the network. Relayers allow you to send transactions and take care of transaction sending, nonce management, gas pricing estimation, and resubmissions. This way you don’t need to worry about monitoring transactions to ensure they get mined. The Relayer infrastructure composes of multiple EOAs on each chain. Every relayer has an inbuilt auto-scaling functionality. Thus in cases of a high load of transactions, the relayer infra can spin up additional relayers to handle this. A socket server is attached to the relayer node via which one can subscribe and get updates on the transaction events like transaction hash generated, transaction mined, etc.

For a general guideline of how to contribute, see our contribution guidelines

Workflow best practices

Branching

This project has two main branches, main, and dev. Then we do work based on branches off of dev.

main: Production branch. This is the code that's live for the project.
dev: Staging branch. This represents what will be included in the next release.

As we work on features, we branch off of the dev branch: git checkout -b feature/new-nav-bar.

Working branches have the form <type>/<feature> where type is one of:

  • feat
  • fix
  • hotfix
  • chore
  • refactor

Commit Messages

Basic

<type>(<scope>):<subject>

Your basic commit messages should have a type, scope, and subject:

  • Type is one of the types listed above
  • Scope is the area of the code that the commit changes
  • Subject is a brief description of the work completed

Local deployment

Requirements:

For centrifugo use the following base configuration file

{
  "token_hmac_secret_key": "averystrongsecret",
  "admin_password": "usedIfAdminSetToTrue",
  "admin_secret": "averystrongsecretforadmin",
  "api_key": "usedforpostapi",
  "allowed_origins": ["*"],
  "debug": true,
  "admin": true,
  "log_level": "debug",
  "client_anonymous": true,
  "client_channel_limit": 512,
  "namespaces": [
    {
      "name": "relayer",
      "publish": true,
      "history_size": 10,
      "history_ttl": "300s",
      "recover": true,
      "anonymous": false
    },
    {
      "name": "transaction",
      "publish": true,
      "history_size": 10,
      "history_ttl": "300s",
      "recover": true,
      "anonymous": true
    }
  ]
}

Steps to run the project

  1. Clone the project
git clone https://github.com/bcnmy/relayer-node.git
  1. Checkout to the main branch
git checkout main
  1. Install dependencies. Make sure node version is 16 or above.
yarn install
  1. Check if config.json.enc file exists in the config folder at the root of the repository. If not or if you want to make any changes in the configuration. Create a file config.json in the config folder. You can use the template shown below for local deployment or find the config-example.json file in the folder.
{
  "slack": {
    "token": "",
    "channel": ""
  },
  "dataSources": {
    "mongoUrl": "",
    "redisUrl": ""
  },
  "socketService": {
    "token": "",
    "apiKey": ""
  },
  "relayer": {
    "nodePathIndex": 0
  },
  "queueUrl": "",
  "simulationData": {
    "tenderlyData": {
      "tenderlyUser": "",
      "tenderlyProject": "",
      "tenderlyAccessKey": ""
    }
  },
  "chains": {
    "provider": {
      "5": "",
      "137": "",
      "80001": "",
      "97": "",
      "420": "",
      "421613": "",
      "43113": ""
    }
  },
  "relayerManagers": [{
    "relayerSeed": "",
    "ownerAccountDetails": {
      "5": {
        "publicKey": "",
        "privateKey": ""
      },
      "137": {
        "publicKey": "",
        "privateKey": ""
      },
      "80001": {
        "publicKey": "",
        "privateKey": ""
      },
      "97": {
        "publicKey": "",
        "privateKey": ""
      },
      "420": {
        "publicKey": "",
        "privateKey": ""
      },
      "421613": {
        "publicKey": "",
        "privateKey": ""
      },
      "43113": {
        "publicKey": "",
        "privateKey": ""
      }
    }
  }],
  "tokenPrice": {
    "coinMarketCapApi": ""
  }
}

Create a .env file and add the following:

CONFIG_PASSPHRASE=passphrase

Now To update the config.json.enc file:

CONFIG_PASSPHRASE=passphrase ts-node encrypt-config.ts
  1. To update the configuration for chain specific parameters (provider url, currency, decimals), relayer manager, fee options, and transactions use static-config.json in the config folder.

  2. Run the following code to start the project.

yarn run build && yarn run start

relayer-node's People

Contributors

jfdelgad avatar lovejeet avatar arcticfloyd1984 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.