PeaceRelay: Connecting the Ethereum blockchains
266
Here are some links you might want to check out first:
Peace Relay is a system of smart contracts that aim to allow for cross-EVM-chain communication using relay contracts.
These contracts will be able to verifiy merkle-patricia proofs about state, transactions, or receipts within specific blocks.
This, along with the wonderful Ethash verification work done by SmartPool, allows for trustless cross chain transfers of all tokens on any EVM chain. This implementation uses the merkle-patricia proofs implemented by Zac Mitton.
Important Notes:
Step by step:
Let us assume that the user would like to transfer funds from ETH to ETC. We shall use the Kovan testnet to represent ETH and Rinkeby testnet to represent ETC. In other words, we will be locking / unlocking ETH in Kovan and obtain ETH tokens (minting / burning) in Rinkeby.
PeaceRelay contracts deployed on Kovan and Rinkeby (1 each)ETHLocking contract deployed on KovanETHToken contract deployed on RinkebyETHLocking contract on Kovan using the ETHLocking.lock() function.
ETHToken.mint() function using the generated proof in the previous step. This will mint ETH tokens.
ETHToken.burn() function.ETHLocking.unlock() function with the proof generated in the previous step to unlock ethers.There are 2 wallets needed: 1 that does the submitting of block headers, and another that will submit mint / unlock transactions for the smart contracts.
The contracts' codes can be found in the ./contracts folder.
PeaceRelay contract on Rinkeby. This contract relays block headers from Kovan.PeaceRelay contract on Kovan. This contract relays block headers from Rinkeby.ETHToken contract on Rinkeby, which takes in the Rinkeby PeaceRelay contract address (Step 1) as a constructor argument.ETHLocking contract on Kovan, which has the Kovan PeaceRelay (Step 2) and Rinkeby ETHToken contract (Step 3) addresses as its constructor arguments.We used AWS to do the relaying of block headers. All necessary files can be found in the ./cli folder. Create a linux server (you may run locally as well) and upload those files onto the server.
settings.json file. Input the different contract addresses and private keys of the 2 wallets that does the block header submissions and transaction submissions.node peacerelay.js --from={srcChain} --to={destChain} --start={blockNum} wheresrcChain is the chain from which the block headers are to be relayed (smallcaps)destChain is the chain to which the block headers are to be relayed (smallcaps)blockNum is the starting block number to be relayednode peacerelay.js --from=kovan --to=rinkeby --start=6919465 (Relays Kovan block headers to the Rinkeby PeaceRelay contract, starting from block 6919465)node peacerelay.js --from=rinkeby --to=kovan --start=2136659 (Relays Rinkeby block headers to the Kovan PeaceRelay contract, starting from block 2136659)truffle deploy to compile contracts. You should now have a build folder. The json files will be needed for the front-end website. (Namely, the ABI of the contracts)settings.json file has the correct information as mentioned in step 2 of the 'setting up the relayers' section.npm install to install dependencies.npm run dev or yarn && yarn start.localhost:3000Content type
Image
Digest
Size
76.9 MB
Last updated
almost 8 years ago
docker pull marchand/peace-relay