Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully functional unidirectional bridge #51

merged 166 commits into from Jul 31, 2019


Copy link

commented Jun 5, 2019

Ethereum Cosmos Bridge

This PR introduces an Ethereum Cosmos Bridge which facilitates cross chain value transfers from Ethereum to a Cosmos Bridge chain via custom Cosmos modules and a Solidity smart contract system.

This branch removes (as other go code currently on master is basically empty/boilerplate) or substantially modifies most of the existing peggy repo code and replaces it with a fully functional one-way bridge. The code has been merged into this repo from and you can see the CircleCI tests setup to run on that repo at

See the new updated README on this branch for full details, architecture, usage, etc.

Project components

  • A smart contract system, based on the original peggy contracts, which receives Ethereum transfers and emits events containing information about deposit, which has been deployed to the Ropsten testnet, based on the current Peggy contracts.
  • The Relayer service that is to be run by chain validators which subscribes to the smart contract events and parses them, allowing them to automatically sign and relay valid transactions.
  • The EthBridge cosmos-sdk module which is responsible for receiving and decoding ethereum-specific transactions and for processing the results of successful claims.
  • The Oracle module which is a generic oracle module which manages arbitrary validator claims, performing consensus calculations once a certain threshold is reached.
  • A demo example Cosmos app with these modules setup and working together.

Primary directories

  • cmd/ebd: CLI for the demo bridge chain running Tendermint consensus and custom modules
  • cmd/ebcli: CLI for manual claim querying, rest api and manual submission of claim transactions
  • cmd/ebrelayer: core functionality for the Relayer service
  • x/ethbridge: contains the EthBridge module
  • x/oracle: contains the Oracle module
  • ethereum-contracts: Peggy smart contracts


Potential Design/Architecture concerns:

  • Claims are each made through Tendermint transactions under consensus. This is somewhat redundant, as we only really need consensus on the final bridge prophecy, not on each claim. However, there does not seem to be a clear/easy way to utilize the p2p layer of Tendermint, and running a seperate p2p layer would not be ideal either. If tendermint supports APIs for non-consensus based p2p messaging then this would be a worthwhile evolution. We looked into using CheckTx for this, but it doesn't seem to easily support persistence of pending state outside of the mempool, which would be needed to check successive messages without putting that state persistence into consensus.
  • The ethbridge currently mints coins directly on the bank keeper. This could be evolved to work with a more generic coin minting module, like something similar to an ERC20 module.

musnit and others added some commits Apr 9, 2019

Revert "Refactor so that oracle uses generic identifier but specific …
…nonce+address for ethereum"

This reverts commit a078087.

This comment has been minimized.

Copy link

commented Jul 19, 2019

hey, @musnit can you address Colin's final comments?


This comment has been minimized.

Copy link
Contributor Author

commented Jul 19, 2019

@denalimarsh denalimarsh referenced this pull request Jul 24, 2019

This comment has been minimized.

Copy link
Contributor Author

commented Jul 24, 2019

@colin-axner @fedekunze all done as far as i can tell :)

Copy link

left a comment

utACK. Fanatasic job! Thanks again for all the work!

x/ethbridge/types/claim.go Outdated Show resolved Hide resolved
cmd/ebrelayer/relayer/network.go Outdated Show resolved Hide resolved

musnit and others added some commits Jul 24, 2019

Update cmd/ebrelayer/relayer/network.go
Co-Authored-By: colin axner <>
Update x/ethbridge/types/claim.go
Co-Authored-By: colin axner <>

This comment has been minimized.

Copy link

commented Jul 29, 2019

Was going through the example on the readme, everything works except that the prophecy status is still "pending" after being finalized:

ebcli query ethbridge prophecy 0 0x7B95B6EC7EbD73572298cEf32Bb54FA408207359 --trust-node
ebcli query account $(ebcli keys show user -a) --trust-node
  Address:       cosmos1j786wwgwrlxtqwkfs28w0fyanks6q2hzrhvrzg
  Coins:         3eth,10stake
  AccountNumber: 1
  Sequence:      0

Do y'all have any idea why? Outdated Show resolved Hide resolved
Copy link
Contributor Author

left a comment

@colin-axner the prophecy status bug was due to a bug from deserializing the status into an enum. other processing/logic all works fine. i've fixed the bug here: 00b9aab

@fedekunze fedekunze merged commit 569e02f into cosmos:master Jul 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
7 participants
You can’t perform that action at this time.