Back

Build for any blockchain with Universal Apps

Check out this blog post in español, 简体中文, 繁體中文, 日本語, हिंदी, 한국어, tiếng-việt, português, français, русский, українська, persian, türkçe, indonesian, filipino, and italiano (non-English translations are created by the community, not ZetaChain).

ZetaChain’s mission is to serve as a platform for universal access, simplicity, and utility across any blockchain. Today we’re excited to introduce Gateway and Localnet, which greatly improve DevX for Universal Apps — single smart contracts on ZetaChain’s EVM that are natively connected to any other blockchain. Gateway plays a significant role in the active ZetaChain 2.0 upgrades.

Key Takeaways

  • Apps on the Universal EVM (Universal Apps) can both natively access and be accessed from any connected chain without requiring users to switch networks. They use the ZRC-20 token standard to permissionlessly withdraw tokens to connected chains as native assets.

  • The hub-and-spoke model offered by Universal Apps lets you manage native foreign assets and data from a single place. Rather, point-to-point messaging between contracts on different chains is complex, difficult to scale, and cannot extend to non-smart chains such as Bitcoin.

  • The complete smart contract interface revamp with Gateway enables externally-owned accounts (EOAs) and apps on connected chains to efficiently call Universal Apps, send tokens, and handle gas queries through a unified API.

  • Gateway unlocks complex multi-step operations e.g. send BTC from Bitcoin to Universal App on ZetaChain, lock in a vault, provision USDC, then swap USDC for another token on Ethereum — in one click.

  • The new localnet environment enables rapid contract deployment and interaction with almost instant transaction finalization and feedback as if operating on a single chain

Universal Apps

A Universal App is a smart contract on ZetaChain’s EVM that is natively connected to any other blockchains (Bitcoin, EVM, non-EVM, heterogeneous L2s, Etc.).

Unlike a regular contract, a Universal App can accept contract calls, messages and token transfers from any connected chain. It can also trigger contract calls, and make token transfers on connected chains. These abilities enable Universal Apps to orchestrate complex multi-step transactions that span across chains.

For example, a Bitcoin user can interact with a Universal App to send USDC to a recipient on Ethereum. An Ethereum user can buy an NFT on ZetaChain and send it to their account on the BNB chain — all in one step.

Universal Apps are deployed on ZetaChain’s Universal EVM, which extends the EVM with omnichain interoperability features. This means your existing contracts will work out of the box on ZetaChain, and with some modifications, they can gain powerful omnichain capabilities.

Challenges of point-to-point Messaging

In a point-to-point messaging system, a contract on one chain communicates directly with another contract on another blockchain. This setup is straightforward and effective for a small number of interconnected blockchains, offering a simple and easy way to establish communication channels.

However, as the number of blockchains and contracts grow, the complexity increases exponentially. Each contract must establish and maintain a direct link with every other contract, resulting in a dense web of connections. This architecture can lead to several issues:

  • Scalability challenges: As the number of nodes increases, the number of potential connections grows quadratically. Managing these connections can become cumbersome and resource-intensive.

  • Maintenance and upgrades: Updating or maintaining a point-to-point system can be difficult, as changes need to be implemented across numerous connections simultaneously.

Despite these challenges, point-to-point systems were useful for small scale cross-chain applications that did not need access to shared state.

Introducing hub-and-spoke with Universal Apps

ZetaChain’s hub-and-spoke model, by contrast, routes communication through a single hub, which connects to all other blockchains in the network.

This model not only extends Universal Apps such that developers can achieve the same applications as building with point-to-point messaging, but also it significantly simplifies the network architecture and offers numerous advantages:

  • Better scalability: In a hub-and-spoke system, adding a new node requires only a single connection to the hub, rather than multiple connections to each node. This linear scalability is crucial for building a future-proof system for blockchain interoperability.

  • Easier maintenance: Upgrades and maintenance tasks are easier to manage, as changes need to be implemented only in a single universal contract on the hub, rather than in different contracts across all blockchains.

  • Chain abstraction: By routing all communications through a central hub, developers can abstract away the complexities of interacting with multiple blockchains. This simplifies the development process, enabling the creation of cross-chain applications that can interact with any connected blockchain without needing to manage individual connections and protocols.

  • Unified liquidity: the hub-and-spoke model can consolidate liquidity across multiple blockchains, providing a central point where assets from different chains can be pooled and exchanged. This unified liquidity improves the efficiency and effectiveness of cross-chain transactions, reducing fragmentation and enhancing the overall liquidity available to users.

To leverage the advantages and build a better interoperability solution for the next 1,000 blockchains, ZetaChain transitions from a point-to-point messaging system to a universal hub-and-spoke model.

Gateway — the unified entry point to ZetaChain

The new Gateway brings a complete revamp to Universal Apps, simplifying complex multi-step operations. Previously, ZetaChain used point-to-point messaging via the Connector contract for value and data transfers between connected chain contracts. Universal Apps allowed EOAs and contracts to interact with ZetaChain by sending native gas tokens to a TSS address and ERC-20 tokens to a custody contract, converting them to ZRC-20 tokens. However, this approach lacked consistency and flexibility, making protocol enhancements challenging.

In the next upgrade, all interactions with Universal Apps from connected chains will happen through the Gateway. A Gateway is smart contract on a connected chain that exposes the API for developers to make calls to Universal Apps, send tokens, query gas information, and more. Here is an overview of the Gateway:

On Connected Chains

function deposit(address receiver) payable
function deposit(address receiver, amount uint256, asset address)

Deposit for sending native gas and supported ERC-20 tokens to addresses on ZetaChain. This method is used when you just want to send tokens from a connected chain to an address on ZetaChain.

function depositAndCall(address receiver, amount uint256, payload calldata) payable

Deposit and call for sending native gas and supported ERC-20 tokens to a contract on ZetaChain and calling the contract with a payload. This method is used when you want send tokens to and call a Universal App contract on ZetaChain. For example, sending tokens to a lending contract or using a universal swap contract to make a token swap between connected chains.

function call(address receiver, payload calldata)

Call is a simple Universal App contract call. This method is used when you just want to call a universal app without depositing tokens to it. For example, minting an NFT.

On ZetaChain

Universal Apps can use the following methods to withdraw tokens and make calls to contracts on connected chains.

// zevm
function withdraw(address receiver, amount uint256, zrc20 address)

Withdraw for sending ZRC-20 tokens to a connected chain as native assets. Using this method, for example, you can send ZRC-20 BNB to the BNB chain as native BNB.

function withdrawAndCall(address receiver, amount uint256, zrc20 address, message calldata)

Withdraw and call for sending ZRC-20 tokens to and calling a contract on a connected chain. For example, sending ZRC-20 USDC to Ethereum and calling a Uniswap contract to swap USDC for another ERC-20 on Ethereum.

function call(address receiver, message calldata)

Call is a simple call from a Universal App to a contract on a connected chain without transfer of tokens.

Transitioning to Gateway contracts will make interactions more streamlined and efficient, providing a consistent and flexible approach to handling cross-chain communications.

Call contracts on connected chains

From the very beginning, ZetaChain offered a powerful mechanism that abstracts away tokens sent from connected chains — the ZRC-20 token standard. ZRC-20 is what makes unified liquidity possible. The key feature of ZRC-20 is the ability to permissionlessly withdraw tokens to connected chains as native assets

The addition of the “call” and “withdrawAndCall” methods extends the functionality of Universal Apps allowing them to not only withdraw ZRC-20 assets, but also make calls to contracts on connected chains.

For instance, sending BTC from Bitcoin to a Universal App on ZetaChain, which locks it in a vault, provisions USDC, and swaps USDC for another token on Ethereum — complex multi-step operations now become possible.

Connecting Net Chains

ZetaChain is continuously expanding its connectivity:

  • Polygon: Already available on the testnet and coming to the ZetaChain Mainnet Beta soon.

  • Solana: Integration is in progress and under a proof of concept experimentation, with plans to introduce it on testnet in the near future.

Introducing the local development environment

ZetaChain provides extensive tooling out-of-the-box for building Universal Apps. With the new Universal App-focused development environment, you can spin up a local network, deploy a contract, interact with it, and almost instantly see the result as if all of it was running on a single chain. Everything is available in real time with no need to wait for chain upgrades, which makes testing apps much easier.

About ZetaChain

ZetaChain is the first universal L1 blockchain. It serves as the base-layer of the decentralized internet, providing a platform for global access, simplicity, and utility across any blockchain. Zetachain’s Omnichain Smart Contracts on the Universal EVM are purpose-built for general chain abstraction across the entire crypto ecosystem. ZetaChain can connect to any blockchain, from Ethereum and Cosmos to Bitcoin and beyond, enabling unified liquidity, user experience, and data all from a single place. Universal Apps on ZetaChain are future-proof and have full compatibility with both existing and new chain integrations. With a proposed Universal Proof-of-Stake capability, ZetaChain supports staking of assets like native Bitcoin and Ethereum in exchange for rewards, powering unbounded scale for economic security.

Follow ZetaChain on Twitter @zetablockchain and join the conversation on Discord and Telegram. Reach out to [email protected] if you’re building on top of ZetaChain.

Any projects mentioned are 3rd party, not ZetaChain.

BlockchainOmnichainWeb3UpdateNetwork