Universal Apps: Aims to allow developers to connect directly to every blockchain

This article is approximately 1671 words,and reading the entire article takes about 3 minutes
Gateway plays an important role in the ZetaChain 2.0 upgrade.

Universal Apps: Aims to allow developers to connect directly to every blockchain

ZetaChain’s mission as a platform is to enable universal access, ease of use, and utility for any blockchain. A key focus of this mission is onboarding best-in-class infrastructure services and providers to support the first universal blockchain development experience.

Web3 development platform Alchemy has added support for ZetaChain and provides Alchemy Supernode, Alchemy Subgraphs, and Alchemy’s full suite of development tools. This collaboration will make it easier to build Universal Apps .

Next, we will introduce Gateway and Localnet, which will greatly improve the developer experience (DevX) for Universal Apps - a single smart contract on ZetaChains EVM that can natively connect to any other blockchain. Gateway plays an important role in the ZetaChain 2.0 upgrade.

Key Takeaways

  • Applications on the Universal EVM (Universal Apps) can be accessed natively or by any connected chain without requiring users to switch networks. They use the ZRC-20 token standard to extract tokens permissionlessly as native assets on the connected chain.

  • Universal Apps provides a hub-and-spoke model that allows users to manage native external assets and data from one place. In contrast, point-to-point messaging between contracts on different chains is complex, difficult to scale, and cannot be extended to non-smart chains like Bitcoin.

  • Gateway’s comprehensive smart contract interface transformation enables externally owned accounts (EOAs) and applications on connected chains to efficiently call Universal Apps, send tokens, and handle gas queries through a unified API.

  • Gateway simplifies complex multi-step operations such as sending BTC from Bitcoin to the Universal App on ZetaChain, locking it in a vault, providing USDC, and then exchanging USDC for another token on Ethereum - all in one click.

  • The new localnet environment allows contracts to be quickly deployed and interacted with, with transactions completed and feedback received almost instantly, just like operating on a single chain.

Universal Apps

A Universal App is a smart contract on ZetaChain’s EVM that can connect natively to any other blockchain (Bitcoin, EVM, non-EVM, heterogeneous L2, etc.). Unlike regular contracts, 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 features enable Universal Apps to coordinate complex multi-step transactions across chains.

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

Universal Apps are deployed on ZetaChain’s Universal EVM, extending the full-chain interoperability capabilities of the EVM. This means that existing contracts can be plug-and-play on ZetaChain, and after some modifications, they can gain powerful full-chain capabilities.

Challenges of peer-to-peer messaging

In a peer-to-peer messaging system, contracts on one chain communicate directly with contracts on another blockchain. This setup is straightforward and effective for a small number of interconnected blockchains, providing a simple way to establish communication channels. However, as the number of blockchains and contracts increases, the complexity grows exponentially. Each contract must establish and maintain direct connections with other contracts, resulting in a dense network of links. This architecture can lead to several problems:

  • 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 because changes need to be implemented across numerous connections simultaneously.

Despite these challenges, peer-to-peer systems remain useful for small-scale cross-chain applications that do not require shared state.

Introducing the Hub-and-Spoke Model for Universal Apps

In contrast, ZetaChain’s hub-and-spoke model communicates through a single hub that connects to all other blockchains in the network.

Universal Apps: Aims to allow developers to connect directly to every blockchain

This model not only extends Universal Apps, allowing developers to implement the same applications as peer-to-peer messaging, but also significantly simplifies the network architecture and provides many advantages:

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

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

  • Chain abstraction: By conducting all communications through a central hub, developers can abstract away the complexity of interacting with multiple blockchains. This simplifies the development process and enables developers to create cross-chain applications that interact with any connected blockchain without having to manage their respective connections and protocols.

  • Unified liquidity: The hub-and-spoke model can integrate the liquidity of multiple blockchains, providing a central point where assets on different chains can be aggregated and exchanged. This unified liquidity improves the efficiency and effectiveness of cross-chain transactions, reduces fragmentation and enhances the overall liquidity available to users.

To leverage these advantages and build better interoperability solutions for the future 1,000 blockchains, ZetaChain is transitioning from a peer-to-peer messaging system to a universal hub-and-spoke model.

Gateway——ZetaChain’s unified entrance

Gateway is a smart contract on the connection chain that exposes APIs to developers to call Universal Apps, send tokens, query gas information, etc.

The new Gateway brings a complete overhaul to Universal Apps, simplifying complex multi-step operations.

Previously, ZetaChain used peer-to-peer messaging through Connector contracts to enable value and data transfer between connected chain contracts. Universal Apps allows EOAs and contracts to interact with ZetaChain by sending native gas tokens to TSS addresses and ERC-20 tokens to escrow contracts, which are converted to ZRC-20 tokens. However, this approach lacks consistency and flexibility, making protocol enhancements challenging.

Universal Apps: Aims to allow developers to connect directly to every blockchain

In the next upgrade, all interactions from Universal Apps connected to the chain will go through the Gateway. Here is an overview of the Gateway:

On the connection chain

solidity

Copy code

function deposit(address receiver) payable

function deposit(address receiver, uint 256 amount, address asset)

Used to send native gas and supported ERC-20 tokens to an address on ZetaChain. Use this method when you just want to send tokens from a connected chain to an address on ZetaChain.

solidity

Copy code

function depositAndCall(address receiver, uint 256 amount, calldata payload) payable

Used to send native gas and supported ERC-20 tokens to contracts on ZetaChain and call contracts with payload. Use this method when you want to send tokens to and call Universal App contracts on ZetaChain. For example, sending tokens to a lending contract or using a universal exchange contract to swap tokens between connected chains.

solidity

Copy code

function call(address receiver, calldata payload)

This is a simple Universal App contract call method. Use this method when you just want to call a Universal App without depositing tokens into it. For example, minting an NFT.

On ZetaChain

Universal Apps can use the following methods to extract tokens and call contracts on the connected chain:

solidity

Copy code

function withdraw(address receiver, uint 256 amount, address zrc 20)

Used to send ZRC-20 tokens as native assets to connected chains. For example, you can send ZRC-20 BNB directly back to BNB Chain as native BNB assets.

solidity

Copy code

function withdrawAndCall(address receiver, uint 256 amount, address zrc 20, calldata message)

Used to send ZRC-20 tokens to and call contracts on connected chains. For example, send ZRC-20 USDC to Ethereum and call the Uniswap contract to exchange USDC for another ERC-20 token on Ethereum.

solidity

Copy code

function call(address receiver, calldata message)

It is a simple calling method from Universal App to the connection chain contract, which does not involve token transfer.

Gateway Contract Transition

Transitioning from Connector contracts to Gateway contracts will make interactions smoother and more efficient, providing a consistent and flexible way to handle cross-chain communications.

Calling the contract on the connected chain

From the beginning, ZetaChain has provided a powerful mechanism to abstract away tokens sent from connected chains - the ZRC-20 token standard. ZRC-20 is key to enabling unified liquidity. The main function of ZRC-20 is the ability to permissionlessly withdraw tokens onto connected chains as native assets.

The addition of the “call” and “withdrawAndCall” methods expands the functionality of Universal Apps to not only withdraw ZRC-20 assets, but also to call contracts on connected chains. For example, sending BTC from Bitcoin to a Universal App on ZetaChain, locking it in a vault, providing USDC, and exchanging USDC for another token on Ethereum — complex multi-step operations are now possible.

Introducing a local development environment

ZetaChain provides a rich toolset to facilitate the construction of Universal Apps. With the new Universal App-focused development environment, you can start a local network, deploy contracts, interact with them, and see the results almost immediately, just as if everything was running on a single chain. All operations can be done in real time without waiting for chain upgrades, which makes it easier to test applications.

Connected network chain

ZetaChain is continuously expanding its connectivity:

  • Polygon: Already available on testnet, expected to be launched on ZetaChain mainnet soon.

  • Solana: Integration and proof-of-concept experiments are ongoing, with plans to introduce it on a testnet in the near future.

About ZetaChain

ZetaChain is a universal L1 blockchain that serves as the foundational layer of the decentralized internet, providing a platform for global access, ease of use, and utility on every blockchain. ZetaChain’s Omnichain smart contracts are designed specifically for universal chain abstraction across the entire crypto ecosystem on the Universal EVM. ZetaChain can connect to any blockchain, from Ethereum and Cosmos to Bitcoin and beyond, enabling unified liquidity, user experience, and data, managed from one place. Universal Apps are future-proof on ZetaChain, fully compatible with existing and new chain integrations. With the proposed Universal Proof of Stake capability, ZetaChain supports staking of assets like native Bitcoin and Ethereum in exchange for rewards, powering unlimited scale for economic security.

For follow-up progress of the project, please follow ZetaChain’s official X account @zetablockchain.

Developers interested in building applications on ZetaChain should contact partnerships@zetachain.com.

This article is from a submission and does not represent the Daily position. If reprinted, please indicate the source.

ODAILY reminds readers to establish correct monetary and investment concepts, rationally view blockchain, and effectively improve risk awareness; We can actively report and report any illegal or criminal clues discovered to relevant departments.

Recommended Reading
Editor’s Picks