Introduction To Cross-Chain Smart Contract Execution Calls | Analog Insights

Analog
8 min readJul 15, 2023

The whats, whys and hows of this feature that will be a Web3 essential

Cross-chain smart contract call is an interoperability feature that enables one smart contract or decentralized application (DApp) on one chain, say Ethereum, to invoke actions on another blockchain, say Avalanche. It allows users to have a seamless experience when interacting with any DApp or asset, regardless of the blockchain they are connected on.

For developers, this new paradigm shift in DApp development can potentially create an entirely new class of applications in a multi-chain ecosystem that leverage the unique benefits of different blockchains, whether such chains are Layer-1s (L1s) or Layer-2s (L2s).

In this blog post, we explore the rise of cross-chain smart contracts and outline the benefits and potential use cases these smart contracts provide in a multi-chain world. We then explore how Analog’s General Message Passing (GMP) protocol and the Timegraph SDK can help facilitate this transition by enabling secure cross-chain smart contract communication.

The emergence of a multi-chain ecosystem

The birth of the Ethereum blockchain gave rise to the notion of programmable blockchains, with smart contracts and DApps becoming the defining components in the crypto space. While many smart contract-enabled blockchains have emerged in the Web3 space to compete with Ethereum, the development of smart contracts and DApps has primarily occurred on the Ethereum chain due to its first-mover advantage.

Besides the first-mover benefit, other factors — such as network effects, decentralized architecture, time-tested tooling, and extensive developer community — also contributed to an explosion of DApps on the Ethereum blockchain. However, the surging demand for DApps led to high gas fees as the need for computing resources exceeded the Ethereum network supply.

In response to these challenges, we’ve witnessed the rise of alternative L1s and L2s in the past couple of years to meet the growing needs of users and developers. As a result, the phrase “multi-chain,” a theory a couple of years ago, is now a definitive reality. This is demonstrated by the increasing diversification of the decentralized finance (DeFi) ecosystem’s total value locked (TVL) across various blockchain ecosystems.

If additional on-chain metrics — such as transaction count, network bandwidth consumption and daily active addresses — are anything to go by, then a multi-chain future is already here. Many developers have been forced to deploy their smart contract codebase across multiple blockchain ecosystems to take advantage of a multi-chain world.

For example, the Uniswap protocol, initially deployed on the Ethereum blockchain, is now live on the BNB, Polygon, Arbitrum, and Optimism chains. By deploying multi-chain smart contracts, DApps have expanded their user base while experimenting with new features on different blockchains.

However, deploying the same smart contract codebase across multiple chains introduces many challenges for developers. For example, each contract deployment creates an entirely new copy of the application on the connected chain, resulting in incoherent states. This makes it hard to implement a cross-chain DApp, such as an on-chain domain name system (DNS), that requires a single source of truth on all its states.

While users can access the copy of the DApp on their preferred blockchain, they have to contend with application-level challenges. To further illustrate this challenge, let us consider an Automated Market Maker (AMM)-based Decentralized Exchange (DEX), such as Uniswap, that has taken a multi-chain approach.

You would have to start from scratch with zero liquidity to deploy Uniswap on a new chain, such as Aptos or Sui. Besides the time and effort required to build the DEX, the protocol’s native token can be diluted, especially if the liquidity mining programs on the current chains are extended to the new DEX as a way of bootstrapping the protocol.

Moreover, users that operate in such an ecosystem will naturally have varying user experiences (UXs) depending on which chain the DEX is connected on. For example, given that tokens residing on a given chain can only be used within the DEX native to that network, users will need to manually bridge their assets to other blockchains if they want to use DEXs in those on-chain environments.

To bridge assets, they will need to reconfigure their wallets, manage additional tokens for gas fees on the connected chains, learn new UX patterns, and compromise on the application’s security settings. Such an environment not only increases friction for end-users but also introduces many security risks.

Cross-chain smart contract call explained

Cross-chain smart contract calls allow developers to connect smart contracts from different chains, facilitating the seamless transfer of arbitrary messages (data), commands, and assets from one chain to another. Cross-chain smart contract calls fundamentally change how multi-chain DApps are built and used.

For example, instead of deploying the identical copy of the contract codebase to multiple blockchains, you can leverage cross-chain smart contract calls to call any function on any connected blockchain. When deployed, cross-chain smart contracts can help you build cross-chain or inter-chain applications with consistent logic, efficient liquidity utilization, and shared states.

Cross-chain smart contracts are essential for the entire Web3 space as they empower developers to move information and value beyond the borders of their native blockchain ecosystems. To summarize, cross-chain smart contract calls provide the following benefits:

  • You can seamlessly transfer any arbitrary message, token, or command across different chains. Rather than just focussing on building a cross-chain swap, cross-chain smart contracts can enable full composability, enabling an application or smart contract on one chain to call any function on other connected blockchains.
  • You can unlock new use cases and features for protocols as cross-chain smart contracts expand the design space for what blockchain ecosystems can offer. For example, a yield farming protocol on Ethereum can provide liquidity pools across other connected blockchains like Avalanche or the BNB chain.
  • You can leverage the strengths of different blockchain ecosystems. For example, you can leverage a high censorship-resistant blockchain to build a DApp that tracks asset ownership and a high-throughput blockchain for a low-latency trading application.
  • You can attract users and liquidity from various blockchain ecosystems.

Life cycle of a cross-chain smart contract call

We can group the existing cross-chain smart contract architectures into two categories. The first category entails those architectures that rely on a consensus layer (ledger approach) that works similarly to existing L1 blockchains. In such an architecture, the L1 chain serves as a middleware between the two chains, validating and relaying messages that need to be passed between the two chains.

The second category entails those solutions that rely exclusively on off-chain entities (ledgerless approach) to serve as validators and relayers. In this case, you have a bunch of validators that are not networked with each other and are run off-chain that validates and relays the messages between the two chains.

In either architecture, you will need to split the architecture of your cross-chain application into multiple modularized components. For example, you could implement a gateway smart contract (GSC) on both the source and destination chains to undertake various functionalities, including:

  1. Receiving and sending inbound transactions from the source chain to a set of validators. The validators can be made to operate in off-chain or on-chain modes.
  2. Receiving and executing outbound transactions on the destination chains. For example, validators on the destination chain can listen to the GSC on that chain and execute a signed outbound command message.

A typical cross-chain smart contract call would be executed as shown in the diagram below:

  1. A user/application initiates a smart contract call function on the source chain. The call can be a token transfer or an arbitrary message.
  2. The call enters the GSC on the source chain.
  3. Validators operating the GSC on the source chain validate the call. Here, they can deduct the transaction fee in native source chain tokens and prepare an outbound transaction on the destination chain.
  4. The call gets confirmed by another set of validators operating in off-chain or on-chain modes and is relayed to the GSC on the destination chain.
  5. The call gets executed on the destination chain’s GSC as if it had been made on the source chain.

Use Cases

With secure cross-chain smart contract calls, you can easily build the following inter-chain DApps:

  • Cross-chain DEXs, that allow users to swap tokens across multiple blockchains from a single chain with only a single transaction.
  • Cross-chain non-fungible tokens (NFTs), that enable users to send their NFTs across different blockchains.
  • Cross-chain yield aggregators, that allow users to manage different blockchain vaults from a single blockchain.
  • Cross-chain lending protocols, that allow users to collateralize their assets on one chain and use it as a basis for borrowing assets on another chain.
  • Cross-chain DAO governance protocols, that provide unified decentralized governance mechanisms without needing governance tokens to be moved across different chains.
  • Cross-chain NFT marketplaces, that allow users from one blockchain to place bids on an auction that is taking place on an entirely different chain.
  • Cross-chain metaverse games where players interact seamlessly with virtual assets from entirely different networks.

Analog Network as a platform for cross-chain smart contract calls

Cross-chain smart contracts are a major paradigm shift in how developers perceive and build inter-chain DApps in a multi-chain world. However, most of today’s blockchains are largely siloed and unable to communicate natively with other blockchain ecosystems. To support cross-chain smart contract calls, you need additional infrastructure in the form of pairwise bridges that have weak security architectures.

In addition, the architecture for most of the current bridges has largely focused on token transfers between different connected chains. To support the arbitrary transfer of messages and commands between other chains, you need a more generalized cross-chain smart contract architecture that is secure and chain-agnostic.

Analog is building one such network. As a chain-agnostic, omni-chain interoperability protocol, Analog Network will be integrated across various L1s and L2s, positioning it as a universal standard for cross-chain smart contract calls. To achieve this goal, we are currently implementing the General Message Passing (GMP) protocol on top of the Analog Network — a hyper-reliable, tamper-resistant, and permissionless network (Timechain).

Besides implementing a secure cross-chain smart contract architecture, we are also building a Web3 data infrastructure (Timegraph SDK) that you can leverage to easily integrate on-chain data into your DApps. The Timegraph SDK is a developer toolkit that enables users/applications to query on-chain data from any connected chain via a simple, unified interface (Timegraph API).

With Timegraph SDK, you can now easily integrate your DApps with any connected chain, allowing you to query on-chain data from various smart contracts without needing a heavy infrastructure or backend.

To learn more about Analog’s cross-chain smart contract infrastructure, visit https://www.analog.one/contact-us/ or reach out to us on Discord.

To learn more about Analog Network, visit https://www.analog.one/Analog-Timepaper.pdf and follow us on the following channels:

Twitter: https://twitter.com/OneAnalog

Telegram: https://t.me/analogtimer

Medium: https://medium.com/@analogtime

Reddit: https://www.reddit.com/r/AnalogToken/

LinkedIn: https://www.linkedin.com/company/analogone/

--

--

Analog

The world’s first Layer-0 blockchain with Proof-of-Time, Analog is fast becoming a powerful data provider that sets the tone for a highly interoperable Web3.