Geri

Introduction to Universal Apps on ZetaChain

Apr 10, 2025

ZetaChain Team

ZetaChain is an EVM-compatible blockchain with built-in cross-chain interoperability.

A smart contract deployed on ZetaChain can handle incoming contract calls from any connected blockchain like Ethereum, Base, Polygon, BNB, Solana and Bitcoin. Contracts on ZetaChain can also make outgoing contract calls to contracts on connected chains. Contract calls can contain a payload of arbitrary data as well as gas and supported ERC-20 tokens.

Gas and ERC-20 tokens transferred to contracts on ZetaChain from connected chains are represented as ZRC-20 (an ERC-20-like token) on ZetaChain. For example, when you make a call with ETH, a contract on ZetaChain receives ZRC-20 ETH. Under the hood ETH is locked in ZetaChain’s custody on Ethereum and the same amount of ZRC-20 ETH tokens is minted to a contract on ZetaChain. Anyone can permissionlessly withdraw ZRC-20 back into native assets.

The mechanism that facilitates these incoming (to ZetaChain) and outgoing (from ZetaChain) is called Gateway. Each connected chain has a Gateway that acts as a single entry-point for interacting with contracts on ZetaChain. There are Gateway contracts on connected EVM chains like Ethereum and Polygon, Gateway program on Solana and Gateway address on Bitcoin. ZetaChain also has a Gateway contract, which is used to trigger outgoing calls.

For example, you can write a contract that handles an incoming tokens from one chain, swaps them for target tokens and withdraws them to the destination chain. To perform a cross-chain swap using this contract a user would call a Gateway, for example, on Ethereum with an amount of USDC, which ZetaChain contract to call and data payload containing target token address. ZetaChain validators observing Gateways notice the transaction and make a cross-chain transaction to a swap contract on ZetaChain. A swap contract receives USDC and the payload, executes the swap, and withdraws the target token to the destination chain, for example, Bitcoin. In a single transaction an Ethereum user has initiated a cross-chain contract call to a contract ZetaChain, which swapped ZRC-20 ETH for ZRC-20 BTC and withdrawn native BTC to the recipient on Bitcoin.

A user was able to make a cross-chain swap between blockchains by making a single transaction on their chain of choice. They didn’t have to worry about gas, bridging assets, or switching wallets. Of course, swapping is just one example. NFT marketplaces, lending platforms, multi-chain governance mechanisms, yield aggregators, and more can be built on ZetaChain.

We call contracts like these universal apps, because they can orchestrate complex cross-chain transactions universally across all connected blockchains. Writing cross-chain apps as universal apps is easy, because most of the logic is encapsulated in a single contract on ZetaChain that can handle incoming calls and make outgoing calls to contracts on other chains.

Here’s a simple “Hello, World!” universal app:

onCall is a special function that gets executed whenever a Gateway on a connected chain is called. Gateways on Ethereum, Solana and Bitcoin all trigger the same onCall function. You can, of course, execute different logic based on the context.chainID or any other parameter.

It’s easy to make outgoing cross-chain calls from universal apps:

To make a call:

  • Query the gas fee in destination chain’s gas token ZRC-20

  • Approve the ZetaChain Gateway to use gasFee ZRC-20

  • Execute gateway.call

zrc20 determines which chain a cross-chain call is made to (use ZRC-20 ETH address to call Ethereum), receiver is the contract being called on the destination chain and message is an arbitrary payload. By default an onCall function on the receiver contract on the destination chain is called, but it is possible to call any other function.

ZetaChain’s Gateway offers powerful features for developers to handle even the most sophisticated cross-chain scenarios:

  • Deposit native gas or supported ERC-20 tokens

  • No-asset incoming contract call

  • Deposit and call

  • Withdraw ZRC-20

  • No-asset outgoing contract call

  • Withdraw and call

  • Outgoing calls to arbitrary functions (not just onCall)

  • Revert handling (Ethereum → ZetaChain onCall → Ethereum onRevert)

  • Coming soon: Abort handling (Ethereum → ZetaChain onCall → ZetaChain onAbort)

ZetaChain and its universal apps make cross-chain interactions easier than ever. With ZetaChain, users can interact with your app from any blockchain without worrying about bridging, swapping tokens, or managing gas on multiple chains — it all just works. This opens up endless possibilities for developers to build cool, interconnected features like multi-chain DeFi platforms, NFT marketplaces, games, and much more. If you’ve been wanting to create apps that truly span multiple blockchains while keeping things simple for users, ZetaChain is the perfect place to start. The future of cross-chain innovation is here — time to build!

Categories