-
Notifications
You must be signed in to change notification settings - Fork 19
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 #151 from dnnaji/main
Elrond > MultiversX; Maiar > xPortal; clean up typos
- Loading branch information
Showing
1 changed file
with
11 additions
and
10 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 |
---|---|---|
@@ -1,37 +1,38 @@ | ||
# MultiversX-Ethereum Bridge | ||
|
||
## Abstract | ||
|
||
In this repository you will find smart contracts on the MultiversX side for MultiversX-Ethereum bridge. For setup details, take a look [here](docs/setup.md). Documentation for relayers can be found [here](docs/relayer.md). | ||
In this repository, you will find smart contracts on the MultiversX side for the MultiversX-Ethereum bridge. For setup details, take a look [here](docs/setup.md). Documentation for relayers can be found [here](docs/relayer.md). | ||
|
||
Although cryptocurrency is the future, there are still many challenges to overcome. One of them is providing an easy way to manage multiple different types of coins. Although we already have some exchange services, they can be a bit difficult to use and require many steps to perform the actual transfer, and they require you to trust a centralized third party and/or a centralized ERC20 token smart contract. With this suite of smart contracts, we aim to provide a decentralized way of transferring tokens between MultiversX and Ethereum. | ||
|
||
For this to be truly decentralized, we're using a multisig smart contract. More info on that [here](https://github.com/multiversx/mx-sdk-rs/blob/master/contracts/examples/multisig/README.md). Basically, we're going to have a set of relayers that validate the transaction. You could think of it as a mini-blockchain, whose sole purpose is to handle cross chain transactions. | ||
For this to be truly decentralized, we're using a multi-sig smart contract. More info on that [here](https://github.com/multiversx/mx-sdk-rs/blob/master/contracts/examples/multisig/README.md). We're going to have a set of relayers that validate the transaction. You could think of it as a mini-blockchain, whose sole purpose is to handle cross-chain transactions. | ||
|
||
To be able to transfer the tokens, we make use of a concept known as "Wrapped Tokens". Basically, you don't transfer native EGLD or ETH tokens, but instead you lock the native tokens in a contract and generate "Wrapped" versions of them. On MultiversX, we are going to use ESDT for this purpose. On Ethereum, we're most likely going to use something like ERC20. | ||
To be able to transfer the tokens, we make use of a concept known as "Wrapped Tokens". You don't transfer native EGLD or ETH tokens, but instead, you lock the native tokens in a contract and generate "Wrapped" versions of them. On MultiversX, we are going to use ESDT for this purpose. On Ethereum, we're most likely going to use something like ERC20. | ||
|
||
Now you might ask, how is this any different? There already is an ERC20 style contract on Ethereum for EGLD! The main difference is you won't have to go through exchange services at all, and at some point, we'll likely have this integrated fully into our Mobile Wallet application. And there's one more important difference: This is decentralized. There isn't a single contract owner doing all the work. We have a set of trusted accounts that will handle the transactions. | ||
Now you might ask, how is this any different? There already is an ERC20-style contract on Ethereum for EGLD! The main difference is you won't have to go through exchange services at all, and at some point, we'll likely have this integrated fully into our xPortal application. And there's one more important difference: This is decentralized. There isn't a single contract owner doing all the work. We have a set of trusted accounts that will handle the transactions. | ||
|
||
But why should _you_ trust them? We use the "Proof of Stake" concept: each of them will have to stake a certain amount of EGLD to be able to become a relayer, just like validators on the MultiversX blockchain. If any of them misbehaves, their stake will be "slashed" and they'll lose quite a bit of money as a result. | ||
|
||
## Wrapped Tokens | ||
|
||
As said above, we're going to use ESDT to implement wrapped tokens, but how is the wrapping actually done? For that, we have the `EgldEsdtSwap`, a very simple SC, whose only purpose is to exchange 1:1 native EGLD to WrappedEgld ESDT tokens. You can also do the reverse operation at any time, which is known as unwrapping. | ||
As said above, we're going to use ESDT to implement wrapped tokens, but how is the wrapping done? For that, we have the `EgldEsdtSwap`, a very simple SC, whose only purpose is to exchange 1:1 native eGLD to WrappedEgld ESDT tokens. You can also do the reverse operation at any time, which is known as unwrapping. | ||
|
||
One important thing to note is you can never unwrap your WrappedETH while on the MultiversX blockchain, as that is not a native MultiversX token. You will only be able to unwrap them by transferring them to one of your Ethereum accounts and then unwrapping them there. | ||
|
||
One important thing to note is you can never unwrap your WrappedETH while on the MultiversX blockchain, as that is not a native MultiversX token. You will only be able to unwrap them by transferring to one of your Ethereum accounts, and then unwrapping them there. | ||
|
||
## MultiversX -> Ethereum transaction | ||
|
||
To be able to send EGLD to an Ethereum account, we first have to wrap the tokens through the `EgldEsdtSwap` contract. | ||
|
||
Then you can create a transaction by making a smart contract call to the `EsdtSafe` SC with the tokens you want to transfer and the receiver's address. The tokens will be locked in the contract until the transaction is processed. If the transaction is successful, the tokens on the Elrond side will be burned. If the transaction fails for whatever reason, you will get your tokens back. | ||
Then you can create a transaction by making a smart contract call to the `EsdtSafe` SC with the tokens you want to transfer and the receiver's address. The tokens will be locked in the contract until the transaction is processed. If the transaction is successful, the tokens on the MultiversX side will be burned. If the transaction fails for whatever reason, you will get your tokens back. | ||
|
||
Note that not all tokens will be transferred, part of them will be deducted for transaction fees. | ||
|
||
## Ethereum -> MultiversX transaction | ||
|
||
To be able to transfer your tokens back, you will likely have to use an ERC20 contract on the Ethereum blockchain. Once your transaction has been processed on that side, our relayers will simply transfer the tokens back to your Elrond account, through the `MultiTransferEsdt` SC. No additional fees have to be paid for this kind of transactions. | ||
To be able to transfer your tokens back, you will likely have to use an ERC20 contract on the Ethereum blockchain. Once your transaction has been processed on that side, our relayers will simply transfer the tokens back to your MultiversX account, through the `MultiTransferEsdt` SC. No additional fees have to be paid for this kind of transaction. | ||
|
||
## Conclusion | ||
|
||
And that sums up the MultiversX-Ethereum bridge. It's open source, so if you're interested in the details, you can always check out the implementation. In the future, it will likely be implemented in Maiar, so it will be very straight forward to move your tokens around :) | ||
And that sums up the MultiversX-Ethereum bridge. It's open source, so if you're interested in the details, you can always check out the implementation. In the future, it will likely be implemented in xPortal, so it will be very straightforward to move your tokens around :) | ||
|