Giter VIP home page Giter VIP logo

cfx-eth-chainlink-bridge's Introduction

CFX <=> ETH Chainlink Bridge

Simple project send transactions to/from Conflux Network to/from Ethereum - deployed on the Conflux Oceanus mainnet and the Ropsten testnet.

At a conceptual level, oracles connect blockchains to off-chain information, and bridges connect one blockchain to another. The other blockchain is considered "off-chain" to the original blockchain, hence a direct parallel to oracles.

Components

  • Chainlink Node
  • External Initiator
  • External Adapter for ETH & CFX
  • Conflux Network Endpoint
  • Ethereum Network Endpoint
  • PostgreSQL Database (x2)
  • On-Chain Smart Contracts

Technical Details

Starting a Chainlink node

Follow the instructions here: : https://docs.chain.link/docs/running-a-chainlink-node

.env file for starting the Chainlink node (added: FEATURE_EXTERNAL_INITIATORS=true)

ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=3
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0x20fe562d797a42dcb3399062ae9546cd06f63280
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*
DATABASE_TIMEOUT=0
DATABASE_URL=DATABASE_URL=postgresql://$USERNAME:$PASSWORD@$SERVER:$PORT/$DATABASE
FEATURE_EXTERNAL_INITIATORS=true
ETH_URL=CHANGEME

Start up command without password files:

cd ~/.chainlink-ropsten && docker run -p 6688:6688 -v ~/.chainlink-ropsten:/chainlink -it --env-file=.env smartcontract/chainlink local n -p /chainlink/.password -a /chainlink/.api

Star up command with password files:
Setup details

cd ~/.chainlink-ropsten && docker run -p 6688:6688 -v ~/.chainlink-ropsten:/chainlink -it --env-file=.env smartcontract/chainlink local n -p /chainlink/.password -a /chainlink/.api

Setting up external initiator

Connecting the external initiator (EI) to Chainlink node.

Get the container ID using docker ps

docker exec -it <containerID> /bin/bash
chainlink admin login
chainlink initiator create cfx http://172.17.0.1:8080/jobs

Add the generated access tokens ./external-initiator/.env

EI_DATABASEURL=postgresql://$USERNAME:$PASSWORD@$SERVER:$PORT/$DATABASE
EI_CHAINLINKURL=http://localhost:6688
EI_IC_ACCESSKEY=<INSERT KEY>
EI_IC_SECRET=<INSERT KEY>
EI_CI_ACCESSKEY=<INSERT KEY>
EI_CI_SECRET=<INSERT KEY>

Initial startup:

./external-initiator "{\"name\":\"cfx-mainnet\",\"type\":\"conflux\",\"url\":\"http://mainnet-jsonrpc.conflux-chain.org:12537\"}" --chainlinkurl "http://localhost:6688/"

Normal startup command:

./external-initiator

Setting up the external adapter

Login to the Chainlink node and add two bridges:

Adapter URL
cfxTx http://172.17.0.1:3000/cfx
ethTxCustom http://172.17.0.1:3000/eth

The external adapter can be started with yarn start-adapter.

Job Specs

CFX Transaction => External Initiator => Chainlink Node => External Adapter => ETH Transaction
See: CFX job spec

ETH Transaction => Chainlink Node => External Adapter => CFX Transaction
See: ETH job spec

Notes

  • CL node only sends 32 bytes of data in ethtx adapter, so customEthTx is used for sending longer data

cfx-eth-chainlink-bridge's People

Contributors

aalu1418 avatar

Watchers

 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.