Interoperability between Ethereum and MultiversX ecosystems
Last updated
Last updated
Integrating the Ethereum stack, including the VM and RPC, into the chain provides users with new opportunities. So far, this new realm was isolated from MultiversX. To ensure seamless interoperability between these ecosystems, additional features were developed.
The communication between EVM and SpaceVM requires special handling due to their different data encoding standards. To simplify the conversion process, our team has developed some user-friendly built-in functions:
To utilize these methods, append an ABI signature followed by one or more arguments.
Additionally, we have created master contracts for Solidity and Rust that can be inherited to facilitate cross-VM calls. Please refer to the documents attached below for further details.
The contracts manage, in a similar manner, ABI signatures for input and output parameters. An ABI signature is a comma-separated list of platform-agnostic ABI types. For a list of available ABI types, please refer to the dedicated documentation:
For Ethereum: Ethereum ABI Specification. Example of a complex ABI signature: βaddress,uint56,bytes24,bool,(uint256,uint256),(uint256[],bool,bytes,address),β¦β
For MultiversX: MultiversX ABI Specification. Example of a complex ABI signature: βAddress,BigInt,bytes,bool,tuple<u64,i32>,tuple<List<u64>,β¦β
Developers must ensure that the input and output arguments match the parameters of the target execution environment. Use the conversion tables below to identify which data types should be used in the source environment, based on the ABI data types in the target environment.
Refer to the mappings below when calling an EVM contract:
Refer to the mappings below when calling a SpaceVM contract:
When creating smart contracts in Solidity, you may inherit the connector provided below for doing cross-VM calls:
Review the example below for a better understanding:
In the example provided, the ping
method is invoked on a SpaceVM contract. The u32
parameters for the destination contract convert to uint32
in Solidity due to the predefined ABI data types mapping inserted in the previous subsection. Through utilizing Solidity's abi
encoding and decoding functions, the caller ensures arguments are passed using Ethereum's encoding standard.
OneFinity enables ETH-to-MVX and MVX-to-ETH transfers utilizing a system-level smart contract. Unlike traditional tools, which only support address-to-address transfers within the same format, our solution offers enhanced flexibility.
The contract's details are:
Address: one1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq9lllsjtkurw
.
Expected payload: crossAddressTransfer@
hexAddress
@
addressIdentifier
. The hexAddress
parameter represents the target address, in hex format (whether it is an Ethereum or a MultiversX one). The addressIdentifier
parameter represents the type of the hexAddress
and should have one of the following values: 0001
(for MultiversX addresses) or 0002
(for Ethereum addresses).
Explore the Cross-Ecosystem Transfers dApp for more details (choose the appropriate environment here). Users can log in using either Metamask or OneFinity's Lite Wallet.