♾️
OneFinity Docs
🎓 Learn🛠 Build💾 Testnet 👔 Protocol🔄 Bridge
  • Welcome to OneFinity
  • OneFinity
    • What is OneFinity
    • OneFinity approach
    • What is a Sovereign Shard?
  • Technology
    • Basic concepts
      • Nodes and Wallets
      • Epoch and Rounds
      • Secure Proof of Stake
      • Glossary
    • Sovereign Shard
    • WASM Virtual Machine
    • Ethereum Virtual Machine (EVM)
    • ESDT vs ERC-20
    • Run a OneFinity node
      • System Requirements
      • Configuration
      • Installation
      • Updates
      • Management
      • Nodes
        • Rating
        • Redundancy Setup
        • Configuration files
        • Operation modes
        • Node Databases
        • Import Database
        • Node CLI
      • Staking
      • Unstaking
      • Jail/Unjail
      • Staking Smart Contract
      • Keys
        • Validator Keys
        • Wallet Keys
        • Multikey nodes
  • Validators
    • Overview
    • Git repo
    • Binaries
    • Go
    • General setup
    • How to generate a Validator pem
    • Node start
    • Interact with the blockchain
    • Unjail
  • OneFinity Protocol
    • Overview
    • Governance
    • Protocol Rewards
      • Validators
      • Delegators
      • Staking Agencies
    • ONE Token
    • OG Validators: NFT Staking
  • Technical documentation
    • Overview
    • Integration of the Ethereum Virtual Machine (EVM)
    • Integration of the Ethereum Remote Procedure Call (RPC)
    • Interoperability between Ethereum and MultiversX ecosystems
    • Tools and SDKs for developers
    • Environments
  • Bridges
  • Ecosystem
  • Grants
  • FAQs
  • Social Media
  • Roadmap & Tokenomics
  • Team
Powered by GitBook
On this page
  • Cross-VM Communication
  • ABI type mappings
  • Solidity master contract
  • Cross-Ecosystem Transfers
  1. Technical documentation

Interoperability between Ethereum and MultiversX ecosystems

PreviousIntegration of the Ethereum Remote Procedure Call (RPC)NextTools and SDKs for developers

Last updated 5 months ago

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.


Cross-VM Communication

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:

EthereumToMultiversXEncodingWithMultiversXSignature
EthereumToMultiversXEncodingWithEthereumSignature
MultiversXToEthereumEncodingWithMultiversXSignature
MultiversXToEthereumEncodingWithEthereumSignature

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: . Example of a complex ABI signature: “address,uint56,bytes24,bool,(uint256,uint256),(uint256[],bool,bytes,address),…”

  • For MultiversX: . 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.

ABI type mappings

Refer to the mappings below when calling an EVM contract:

Refer to the mappings below when calling a SpaceVM contract:

Solidity master 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:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./SpaceVMConnector.sol";

contract SpaceVMConnectorExample is SpaceVMConnector {

    address private spaceVMContractAddress;

    function setSpaceVMContractAddress(address contractAddress) external {
        spaceVMContractAddress = contractAddress;
    }

    function pingSpaceVM(uint32 value) public returns (bool, uint32) {
        require(spaceVMContractAddress != address(0));

        (bool success, bytes memory output) = callSpaceVM(spaceVMContractAddress, "ping", "u32", "u32", abi.encode(value));
        if (!success) {
            return (false, 0);
        }
        return (true, abi.decode(output, (uint32)));
    }

}

Cross-Ecosystem Transfers

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).

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 . Through utilizing Solidity's abi encoding and decoding functions, the caller ensures arguments are passed using Ethereum's encoding standard.

Explore the Cross-Ecosystem Transfers dApp for more details (choose the appropriate environment ). Users can log in using either Metamask or OneFinity's .

subsection
Ethereum ABI Specification
MultiversX ABI Specification
here
Lite Wallet
36KB
Ethereum - MultiversX conversions.pdf
pdf
75KB
MultiversX - Ethereum conversions.pdf
pdf
8KB
SpaceVMConnector.sol