ZetaChain 백서

ZetaChain

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 5쪽 중 4쪽

lt to manage with just messaging. Message passing style logic and state are distributed on asynchronous chains which adds significant complexity to maintaining cross-chain transaction atomicity, and forces dApps to program in an event (message) driven way that is generally harder to do than synchronously in a single chain. Universal smart contracts on the other hand offer the novel ability to develop multichain applications in a more synchronous, atomic environment as if they were on one chain. 4.4.4. Fees & Gas To prevent spam and ensure fair and efficient use of the blockchain resources (compute and storage), the user must pay proper fees for processing the cross-chain transaction. Unlike transactions on a single chain, a cross-chain transaction naturally might involve several different gas assets and need to pay more than one type of tokens for gas fees. This is rather inconvenient, and may add undue operational cost or risk to operate the cross-chain solution. For example, if one invokes a contract on Ethereum from BSC chain, the user needs to pay both BNB and Ether as gas fees; but how can the user pay Ether on BNB? Do they need to acquire “wrapped” Ether on BSC? Which version of the wrapped Ether? Who wraps and unwraps the Ether? Alternatively, one might just ask the user to pay in a single asset (for example, only BNB), and then some off-chain service converts the BNB into Ether to reimburse the protocol which needs to pay Ether for the outbound tx processing. This is quite an operational burden, and runs counter to the autonomous nature of sovereign blockchain that does not need centralized operator. ZetaChain completely automates the gas handling and conversion on-chain, and with market force to maintain proper conversion rate. Also, the conversion of different gas assets are synchronous with the CCTX itself so the settlement is as fast as possible. The way ZetaChain does it is to rely on ZRC20 and their AMM pools on ZetaChain EVM (currently Uniswap v2 pools). All gas assets have a corresponding ZRC20 which pairs with ZETA (native gas token on ZetaChain EVM) on ZetaChain EVM. Let us consider the two cases when the user needs to pay gas fees in coins they might not have: ● In message passing, the user pays a single asset (ZETA token) for all gas fees. The ZetaChain protocol converts proper amounts of ZETA into outbound chain gas asset ZRC20 synchronously and use the balance to pay outbound transaction gas fees. ● In universal smart contract ZRC20, when a user (or a smart contract) wishes to withdraw the foreign asset, the user will need to pay the outbound gas fee. The withdrawing smart contract can acquire the outbound chain gas asset ZRC20 from the internal AMM pools on ZetaChain EVM to pay gas synchronously. In either case, the multi-gas handling of ZetaChain is sound (which means that the protocol always has enough gas asset to pay outbound tx gas fees), and the conversion rate is determined by market force. As ZetaChain EVM ZRC20 assets are easily withdrawn to external chain with on-chain contracts, the markets on ZetaChain EVM are connected with other markets therefore we can expect market forces to maintain price parities. 5. Use Cases & Applications In this section we discuss some sample applications of ZetaChain. These examples are not anywhere near comprehensive, since the general smart contract and interoperability capabilities of ZetaChain provide a platform for virtually unlimited creativity in terms of universal application-building. 5.1. Smart Contract Managed External Assets A powerful feature of smart contracts is that smart contracts can hold any assets that a normal account can hold, and are able to receive and spend that asset according to programmed logic. However, important blockchains like Bitcoin, Dogecoin, Monero, etc., do not have general enough smart contract capability to support useful applications such as AMM exchanges, collateralized borrowing/lending markets with pools, and the like. There is currently no way to involve native Bitcoin (without wrapping) in arbitrary logic in a decentralized and permissionless manner. The cross-chain smart contract capability of ZetaChain can hold and use assets on external chains directly, therefore enabling smart contract managed native Bitcoin on ZetaChain, among other native assets such as ETH, ERC20, Algorand ASAs, etc. Furthermore, through ZetaChain smart contracts and with message passing, cross-chain dApps can be easily composed with smart contracts on the participating chains, with ZetaChain smart contracts managing native Bitcoin vaults. Let us look at an example in some detail. The mechanism for ZetaChain smart contracts to manage BTC on Bitcoin is as follows. The initialization of smart contract requests KeyGen to generate a TSS key which acts as the address of a Bitcoin vault. The ZetaClient will monitor the TSS address and upon identifying incoming transactions to the TSS vault, it parses the data from the Bitcoin transaction in OP_RETURN and invokes the zetaProcess function with the parsed data on the smart contract. The smart contract takes actions accordingly (such as credit to certain accounts, sending out another asset according to AMM pricing, etc.). To send out Bitcoin from the smart contract, the smart contract emits a specific Event that the ZetaClient will pick up and sign & broadcast to the Bitcoin network. The smart contract must also implement a function zetaExternalTxConfirm which will be invoked when the outbound external chain transaction is mined. 5.2. Universal Stablecoins Stablecoins (blockchain-issued tokens pegged to real currencies) are gaining significant traction. However, multiple issuers often issue stablecoins for the same currency (e.g., USD), and a single issuer like Tether or Circle may issue the same stablecoin across various blockchains. Users face challenges in selecting a blockchain for storage and then moving stablecoins to the needed chain quickly, cheaply, and reliably. ZetaChain enables a simple abstraction for a universal USD, backed by multiple USD stablecoins from different blockchains, while maintaining fluidity across chains (on-demand redeemability to different chains). This solution on ZetaChain will be fully decentralized and programmable, enhancing transparency and trust. One method for building a universal USD Stablecoin, backed by, for example, 16 USDC on chains X, Y, Z, etc. (connected to ZetaChain), involves the following: First, USDC.X, USDC.Y, and USDC.Z have their respective ZRC20 representations on ZetaChain (an ERC20-compatible token contract with specialized input/output functionality to/from connected blockchains X, Y, Z…). A portion of USDC.X, USDC.Y, and USDC.Z liquidity is pooled in an AMM contract like CurveStableSwapNG, optimized for capital-efficient swaps between stable asset groups. The liquidity position (LP token) of such a pool can serve as the unified USDC, exchangeable for any USDC.XYZ. Furthermore, since ZRC20 contracts are natively invokable from connected blockchains, the user experience can be improved by providing a deposit function from chains XYZ: USDC.X -> Unified USDC in one cross-chain transaction. Similarly, ZRC20 USDC.X can be redeemed back to USDC on chain X natively via a cross-chain transaction. Therefore, the unified USDC can represent a unified USD coin fluid across various USDC issues on different chains (X, Y, Z…), available to users on-demand. All infrastructure is decentralized, requiring no centralized party. See Figure 7 for an illustration. Figure 7. Universal stablecoin on ZetaChain. Liquidity from multiple USD-pegged assets on different blockchains (e.g., USDC.X, USDC.Y, USDC.Z) is represented as ZRC-20 tokens and pooled in an on-chain AMM to form a unified stablecoin on ZetaChain. This universal USD can be freely swapped or redeemed natively to any connected chain in a single decentralized transaction. 5.3. Cross-chain AMM Exchanges ZetaChain can enable true cross-chain AMM decentralized exchanges, built on top of smart contracts. There are two ways of constructing an AMM DEX on ZetaChain: message passing and native ZetaChain smart contracts. The key difference is whether the pool is managed by an external smart contract or native ZetaChain smart contract. With message passing, the asset pool is managed by smart contracts on external chains; with the native ZetaChain smart contract approach, the pool is managed by ZetaChain smart contracts through a TSS account. Specifically, in message passing, the assets are managed by smart contracts on external chains, paired with a ZETA coin. A swap of asset X on chain A for asset Y on chain B can be accomplished by: 1) swap X for ZETA on chain A using smart contract managed pool and AMM; 2) pass message, together with the ZETA coin from chain A to chain B; 3) chain B smart contract managed pool (Y/ZETA) swaps ZETA coin for Y. With native ZetaChain smart contracts, the ZetaChain TSS account holds all the native assets on external chains, which can be managed by ZetaChain contracts directly. The ZetaChain smart contract implements AMM logic that determines pricing, swap, liquidity providers, and fees. In the message passing approach, the dApp states and logic are spread across all the external chains; ZetaChain only acts as a message verifier and relayer. The advantages in this approach is that existing infrastructure can be reused (for example, on EVM chains Uniswap contracts can be reused to manage pool X/ZETA), and the dApp needs only to handle the cross-chain messaging to implement conditional execution. On the other hand, in the native ZetaChain smart contract approach, the logic and state of the dApp lives on ZetaChain, a single platform with a unified interface to interact with external chains. The advantages in this approach are the ease of dApp development (minimal development efforts in accommodating new chains), and flexibility (no longer constrained to chain idiosyncrasies and message-passing cross-chain interaction). Additional benefits are that it relies on smart contracts on external chains minimally, so complex logic can work on not only smart-contract chains but also UTXO chains like Bitcoin. Figure 8. DEX built with ZetaChain message passing. Leveraging external chain smart contract DEXs, one can build a cross-chain swap by sending messages with ZETA. Figure 9. DEX built with ZetaChain Smart Contracts. Since ZetaChain TSS can manage external chain pools with its smart contracts, DEX can even support non-smart-contract chains and assets where transactions are simple and single-step. 5.4. Cross-chain message passing with value/data The ability to reliably and securely pass messages from one chain to another can enable powerful cross-chain applications, even without native ZetaChain smart contracts. The message passing functionality consists of communication endpoints on all external chains. The ZetaChain validators serve as a Byzantine Fault Tolerant notary that attests the validity of events/transactions on chain A to chain B, and as a relayer of messages. Chain B's smart contract only needs to whitelist the TSS address of ZetaChain in order to trust that ZetaChain has verified the events on chain A. This allows conditional execution on chain B's contract depending on transactions/messages from chain A, which opens a wide range of cross-chain dApps, such as AMM DEXs, NFT, etc. (see more below). An important and convenient feature of the ZetaChain system is that the messages can be attached with value in the form of the ZETA coin (natively cross-chain), which considerably simplifies dApps which require moving the value cross- chain. The messaging service of ZetaChain consists primarily of interface contracts on the connected chains. To access the message passing service, a dApp needs to deploy a smart contract on both the source chain and destination chain. On the source chain, the sending smart contract can invoke a zeta.MessageSend function with the following information: sending address, destination chain id, destination contract address, ZETA coin to transfer, gas limit on destination chain, contract message for destination transaction (binary or JSON encoded payload), and transaction index. The sending contract must implement a zetaMessageRevert function, which will be called by ZetaChain when the destination message delivery and processing of a transaction fails (for example, due to out of gas, out of funds, invalid message, etc.). Upon failure, the ZetaChain system will refund the ZETA coin to the sending address (less gas fees), and invoke the dApp contract zetaMessageRevert function which is supposed to revert application actions (unlocking a locked NFT, for example). On the destination chain, the dApp contract must implement a function zetaMessageReceive which takes the same parameters as the sending zeta.MessageSend , and can perform application logic (such as minting an NFT that has been locked on the source chain). The destination contract will also receive a ZETA coin (less gas fee), which can be used as a value transfer cross-chain. Message passing can enable a variety of important applications such cross-chain DEX, borrowing/lending, multi-chain NFT, etc. 5.5. Multi-chain NFT Non-fungible Token (NFT) is an emerging concept that has found use in art collection, gaming, event tickets, and many other applications. In contrast to fungible tokens such as ETH, BTC, or ERC-20 tokens, each NFT is unique and not interchangeable with another NFT in the same collection. This non-fungibility can be essential in applications such as art, real-estate, etc. On Ethereum, for example, the most common NFT standards are ERC-721 and ERC-1155. In ERC-721, an NFT is basically a tuple (contractAddress, tokenId) . The smart contract that issues the NFTs keeps track of the owners of each NFT in a map owner=>tokenId . The NFT can be transferred from one owner to another, and each NFT owner can be queried. In a multi-chain NFT world, where the same collection of NFTs are issued on multiple chains (such as Ethereum, Flow, Solana), and one NFT can transfer to another chain, a challenge in the bridge model is the knowing the provenance of a given NFT – who is the owner of a given NFT now that the NFT could be on one of multiple chains and where are the records of the transactions of the transfers? This problem can be solved by ZetaChain smart contracts which facilitate cross-chain ownership transfers of NFTs. It can work as follows. Each chain will have an escrow smart contract controlled by the ZetaChain key. To transfer an NFT to another chain, one transfers the NFT to the escrow, pays transaction fee in ZETA coin, and ZetaChain will mint the NFT on the destination chain. The smart contract on ZetaChain keeps track of the owner and blockchain where the NFT is at any given time. While there have been experimental cross-chain NFT bridges, having a decentralized issuing authority allows an NFT to be natively cross-chain, making it simpler and feasible to create, verify, and exchange NFTs cross-chain. Figure 10. Multi-chain NFT. With a decentralized issuing authority (ZetaChain TSS), one can have an NFT that is easily sent between chains, where ownership and current location are easily verifiable. 5.6. Other Use Cases These are just a few other potential use cases of ZetaChain. Given ZetaChain is a general smart contract platform, you can also imagine that any application you deploy on a single blockchain/smart contract platform can be expanded to operate across all connected chains. 5.6.1. Universal Payments A system that lets users/EOAs send payments from/to any asset on any chain. This can help vendors and customers have a decentralized, universal, and accessible payments route that doesn’t require users to have a hyper-specific set of assets on a specific chain. 5.6.2. Universal Identity and Assets Identity system, name service, or Soul Bound Tokens that can serve as identities across all chains. With universal capabilities, identities can interact with other chains agnostically and in a future-proof manner as ZetaChain adds support for more chains. Users need not have individual identities/domains per chain, and can utilize their assets (gaming, collectibles, fungible tokens, etc.) from all chains from a single place. 5.6.3. Multi-chain, Multi-signature vaults Securely custody and manage assets on multiple chains with a multi-sig that involves accounts and/or messages from many chains. 5.6.4. Universal Account Abstraction or Smart Contract Wallets Smart contract wallets that can manage transactions to/from all chains, allowing things like “gasless” transactions, complex/multi-transactions, etc. that involve multiple chains. This could be imagined as an EIP-4337 but with universal capabilities. 5.6.5. Universal DeFi DEXs, lending/borrowing, perps, and so on can support seamless 1-step trades and transactions that unify liquidity across chains. Leveraging universal smart contracts, one can significantly reduce common complexity and concerns of slippage, race-conditions, MEV that are involved with transacting fungible tokens that are often involved in today’s cross-chain applications. Financial applications spanning many chains can be built with the same logic as if they
프로젝트로 돌아가기