Skip to content

Relayer to convert Ethereum JSON-RPC calls to Conflux JSON-RPC calls. (only for unsigned calls/interactions)

Notifications You must be signed in to change notification settings

Conflux-Network-Global/eth2cfx-relay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethereum To Conflux Relay

A bridge for protocols that can interact with Ethereum to begin interacting with Conflux without changing core code

Note: Cannot relay signed transactions from ETH to CFX, only unsigned information.

Technical Details

A relay to convert ETH JSON-RPC calls to CFX JSON-RPC calls.
Supports both HTTP and Websocket endpoints.

Project specs and notes:

Commands

  • yarn start: start up the relay
  • yarn test: start tests (make sure to also start relay)

.env File Configuration:

ENDPOINT=http://test.confluxrpc.org
PORT=3000
  • Calls that involve getting block information (getBlockByHash, getBlockBy(Epoch)Number) have CFX parameters mapped to ETH parameters as follows: (any hard coded values do not have comparable equivalents)
    ETH parameter CFX parameter
    sha3Uncles keccak256(Buffer.from(refereeHashes))
    stateRoot deferredStateRoot
    receiptsRoot deferredReceiptsRoot
    gasUsed 0x0
    extraData 0x0 (32 bytes)
    uncles []
    number height
  • Calls involving transaction information (getBlockByHash, getBlockBy(Epoch)Number, getTransactionByHash) have CFX parameters mapped to ETH parameters as follows:
    ETH parameter CFX parameter
    input data
    blockNumber see code for details
  • Calls involving receipt data (getTransactionReceipt) have CFX parameters mapped to ETH parameters as follows:
    ETH parameter CFX parameter
    transactionIndex index
    cumulativeGasUsed gasUsed
    blockNumber epochNumber

Improvements

  • What other calls need to be converted/supported?
  • Not all calls have test cases written
  • Remove reliance on public node endpoint

Resources

About

Relayer to convert Ethereum JSON-RPC calls to Conflux JSON-RPC calls. (only for unsigned calls/interactions)

Topics

Resources

Stars

Watchers

Forks