Coder Social home page Coder Social logo

romanv1812 / bifrost-testnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bifrost-platform/bifrost-relayer.py

0.0 0.0 0.0 105 KB

A BIFROST Network Relayer node implementation

Home Page: https://thebifrost.io

License: Apache License 2.0

Python 99.93% Dockerfile 0.07%

bifrost-testnet's Introduction

bifrost-relayer

Requirement

  • python 3.8 ~ 3.10

Configuration

  • blockchain configurations and web3 end-points of each blockchain
    • routing-chain: BIFROST network
    • external-chains: Goerli, BNB-test, Mumbai
    • every end-point MUST support achive-mode
  • end-points of oracle sources
    • Upbit, Coingecko, ChainLink (on Ethereum)
  • System contracts
    • socket, vault and authority contract addresses
    • supported erc20 contracts addresses
    • abi.json of each contracts
  • Relayer account
    • a multichain-account (ethereum-style)

Configuration json

The configuration of relayer is provided in the entity.relayer.json file. And the configuration file containing 4 properties: [entity, multichain_config, each_chain_config, oracle]

"entity": {
   # OPTIONAL
   "role": "relayer",
   "account_name": "default",

   # PRIVATE, OPTIONAL
   "secret_hex": "",  # secret key as a hex-string

   # REQUIRED
   "supporting_chains": ["BIFROST", "ETHEREUM", "BINANCE", "POLYGON"]  # capitalized chain names
}
 "multichain_config": {
   # REQUIRED
   "chain_monitor_period_sec": 3  # How often the relayer collects events from every chains
 }
"bifrost": {
   # PRIVATE, OPTIONAL
   "url_with_access_key": "",  # rpc node access key (url)

   # REQUIRED
   "chain_name": "BIFROST",
   "block_period_sec": 3,  # how often the blockchain generate a block
   "bootstrap_latest_height": 1147843,  # height to start bootstrap
   "block_aging_period": 3,  # how long a block is confirmed (in number of blocks).
   "transaction_commit_multiplier": 2,
   "receipt_max_try": 12,
   "max_log_num": 1000,  # eth_getLogs queries events by max_log_num.
   "rpc_server_downtime_allow_sec": 180,
   "tx_fee_type": {"type": 2, "max_gas_price": 1000000000000, "max_priority_price": 2500000000},

   # REQUIRED, FIXED
   "abi_base_path": "configs/",
   "contracts": [
      {"name": "vault", "address":  "<contract_address_hexstring>", "abi_file": "<abi_file_name>"},
      {"name": "socket", "address": "<contract_address_hexstring>", "abi_file": "<abi_file_name>"},
      {"name": "authority", "address": "<contract_address_hexstring>", "abi_file": "<abi_file_name>"},
      {"name": "oracle", "address":  "<contract_address_hexstring>", "abi_file":  "<abi_file_name>"},
      {"name": "DAI_ETHEREUM", "address": "<contract_address_hexstring>", "abi_file": "<abi_file_name>"}
   ],
   "events": [
      {"contract_name": "socket", "event_name": "Socket"},
      {"contract_name": "socket", "event_name": "RoundUp"}
   ]
}
"oracle_config": {
    "asset_prices": {
       # REQUIRED
       "names": ["ETH", "BFC", "MATIC", "BNB", "USDC", "USDT", "BUSD"],
       "source_names": ["Coingecko", "Upbit", "Chainlink"],
       "collection_period_sec": 120,

       # PRIVATE, OPTIONAL
       # access information to each oracle sources
       "urls": {
          "Coingecko": "",
          "Upbit": "",
          "Chainlink": ""
        }
    }
}

Private configuration

entity.relayer.json is merged with entity.relayer.private.json to be provided to the relayer. This is useful to prevent sensitive personal information from being stored in a public repository. The content of entity.relayer.private.json is prioritized when combined.

{
    "entity": {
       # OPTIONAL
       "secret_hex": ""  # secret key as a hex-string
    },

    "oracle_config": {
      "asset_prices": {
        "urls": {
          "Coingecko": "<coingecko price api url>",
          "Upbit": "<upbit price api url>",
          "Chainlink": "<ethereum mainnet access url>",
        }
      }
    },

   "bifrost": {"url_with_access_key": "<chain access url>"},
   "ethereum": {"url_with_access_key": "<chain access url>"},
   "binance": {"url_with_access_key": "<chain access url>"},
   "polygon": {"url_with_access_key": "<chain access url>"}
}

launch relayer

# git clone and update submodule
$ git clone [email protected]:bifrost-platform/bifrost-relayer.git
$ cd bifrost-relayer

# 1. change directory to project root, then generate virtual environment.
$ virtualenv venv --python=python3.8 # or 3.9 or 3.10
$ source venv/bin/activate
$ pip install -r requirements.txt

# 2. launch a relayer with private-key
$ python relayer-launcher.py launch -k <private_key_in_hex_with_0x>

bifrost-testnet's People

Contributors

dongchangyoo avatar romanv1812 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.