Giter VIP home page Giter VIP logo

eth-relayer's Introduction

Eth Relayer

Eth Relayer is an important character of Poly cross-chain interactive protocol which is responsible for relaying cross-chain transaction from and to Ethereum.

Build From Source

Prerequisites

  • Golang version 1.14 or later

Build

git clone https://github.com/polynetwork/eth_relayer.git
cd eth_relayer
go build -o eth_relayer main.go

After building the source code successfully, you should see the executable program eth_relayer.

Build Docker Image

docker build -t polynetwork/eth_relayer -f Dockerfile ./

This command will copy ./config.json to /app/config.json in the image. So you need to prepare config.json before running this command and you should start the eth-relayer in container basing on the configuration in /app/config.json.

Run Relayer

Before you can run the relayer you will need to create a wallet file of PolyNetwork. After creation, you need to register it as a Relayer to Poly net and get consensus nodes approving your registeration. And then you can send transaction to Poly net and start relaying.

Before running, you need feed the configuration file config.json.

{
  "MultiChainConfig":{
    "RestURL":"http://poly_ip:20336", // address of Poly
    "EntranceContractAddress":"0300000000000000000000000000000000000000", // CrossChainManagerContractAddress on Poly. No need to change
    "WalletFile":"./wallet.dat", // your poly wallet
    "WalletPwd":"pwd" //password
  },
  "ETHConfig":{
    "SideChainId": 2, // ethereum chainID
    "RestURL":"http://etheruem:port", // your ethereum node 
    "ECCMContractAddress":"ethereum_cross_chain_contract", 
    "ECCDContractAddress":"ethereum_cross_chain_data_contract",
    "KeyStorePath": "./keystore", // path to store your ethereum wallet
    "KeyStorePwdSet": { // password to protect your ethereum wallet
      "0xd12e...54ccacf91ca364d": "pwd1", // password for address "0xd12e...54ccacf91ca364d"
      "0xabb4...0aba7cf3ee3b953": "pwd2" // password for address "0xabb4...0aba7cf3ee3b953"
    },
    "BlockConfig": 12, // blocks to confirm a ethereum tx
    "HeadersPerBatch": 500, // number of poly headers commited to ECCM in one transaction at most
    "MonitorInterval": 3 // seconds of ticker to monitor eth chain
  },
  "BoltDbPath": "./db", // DB path
  "RoutineNum": 64,
  "TargetContracts": [
    {
      "0xD8aE73e06552E...bcAbf9277a1aac99": { // your lockproxy hash
        "inbound": [6], // from which chain allowed
        "outbound": [6] // to which chain allowed
      }
    }
  ]
}

After that, make sure you already have a ethereum wallet with ETH. The wallet file is like UTC--2020-08-17T03-44-00.191825735Z--0xd12e...54ccacf91ca364d and you can use geth to create one( ./geth accounts add ). Put it under KeyStorePath. You can create more than one wallet for relayer. Relayer will send transactions concurrently by different accounts.

Now, you can start relayer as follow:

./eth_relayer --cliconfig=./config.json 

It will generate logs under ./Log and check relayer status by view log file.

eth-relayer's People

Contributors

skyinglyh1 avatar tanziwen avatar zouxyan avatar

Watchers

 avatar

Forkers

rain-zxn

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.