-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from anoma/bengt/eth-bridge
eth bridge docs adding
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Namada Ethereum Bridge | ||
|
||
The ethereum bridge on Namada is a trustless (in the sense that the only trust assumptions are that validators on Namada are collectively honest) bridge between Namada and Ethereum. | ||
|
||
The bridge is a combination of smart contracts on Ethereum as well as ledger protocol code that enables its functionality. The bridge is designed to be generic, and can be used to bridge any chain that has a BFT consensus mechanism. | ||
|
||
|
||
## Design | ||
|
||
The full design specs can be found [here](https://specs.namada.net/interoperability/ethereum-bridge). | ||
|
||
A short outline of the design is outlined below. | ||
|
||
## The ethereum side | ||
|
||
Value transferred to the Namada is escrowed in a vault abstraction, which | ||
enables other contracts to be upgraded without moving value around. When ERC20 | ||
tokens are transferred back to Ethereum, value is released from escrow into the | ||
destination accounts. | ||
|
||
## The Namada side | ||
|
||
When a transfer is initiated from Ethereum to Namada, the transfer is validated by the validators. Once this validation is complete, the transferred funds are minted on the Namada side and sent to the destination account. When tokens are sent back to Ethereum, they are burnt on the Namada end. | ||
|
||
This documentation is intended for relayers and validators on Namada and is structured as follows: | ||
|
||
- [Relaying transactions](./relaying.mdx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Callout } from 'nextra-theme-docs' | ||
|
||
# Relaying Ethereum Transactions | ||
|
||
Relayer commands are found in the `namadar` binary, which at the moment can only be installed from source. | ||
|
||
## Relaying validator set updates | ||
|
||
In order for any transactions to be relayed to the Ethereum smart contract, the validator sets need to be up to date on the Ethereum side. This is updated by a relayer which can be set up in the following manner: | ||
|
||
```bash copy | ||
namadar validator-set relay --daemon --confirmations 1 --retry-sleep 0 --success-sleep 0 --safe-mode | ||
``` | ||
|
||
The `--safe-mode` flag is optional, but recommended. It will ensure that the relayer will not relay any transactions that are not signed by the validator set. This is a safety measure to ensure that no malicious transactions are relayed to the Ethereum smart contract. | ||
|
||
More optional flags are available, which can be found by running `namadar validator-set relay --help`. Notably, `--eth-gas`and `--eth-gas-price` will allow you to set the maximum gas-limit and gas-price, respectively, that the relayer will use when relaying transactions to the Ethereum smart contract. | ||
|
||
## Relaying transactions | ||
|
||
Transactions are relayed in batches. The relayer will wait until it has a batch of transactions to relay before sending them to the Ethereum smart contract. This is done to reduce the number of transactions that need to be sent to the Ethereum smart contract, and thus reduce the gas costs. | ||
|
||
The relayer can get a "recommended-batch" of signed transactions to relay by running: | ||
|
||
```bash | ||
namadar ethereum-bridge-pool recommend-batch | ||
``` | ||
|
||
If this is favourable for the relayer, it can construct the proof and relay it to the Ethereum smart contract by running: | ||
|
||
```bash | ||
namadar ethereum-bridge-pool relay-proof --hash-list $HASH_LIST | ||
``` | ||
|
||
<Callout type="info"> | ||
As this involves an Ethereum transaction, the `--eth-gas` and `--eth-gas-price` flags are also available here. | ||
</Callout> | ||
|
||
Alternatively, the relayer can run the command: | ||
|
||
```bash | ||
namadar ethereum-bridge-pool construct-proof --hash-list $HASH_LIST | ||
``` | ||
|
||
To only construct the proof without relaying it. The proof could then be relayed manually by the relayer. | ||
|
||
|
||
|