As of press time, both Ergo and Cardano have implemented smart contract functions on the eUTXO model. Ergo has realized the smart contract function when the mainnet went live on July 1, 2019. Cardano recently launched the smart contract function on September 12, 2021. According to foreign media reports, many blockchain researchers believe that eUTXO is equivalent to a major leap from 8-bit to 64-bit computer systems. The two major public chains, Ergo and Cardano, are pioneers in this regard, and have formed the eUTXO alliance, which will help the eUTXO model unleash its unlimited potential.
The eUTXO model provides a powerful and flexible smart contract construction basis for smart contract writers. Unlike the account model, UTXO-based smart contracts do not have the concept of calling functions in transactions to perform state transitions. The smart contract function was implemented when the Japanese mainnet went live. Cardano implemented the smart contract function on September 12 this year.) On the contrary, UTXO uses a more functional method. Every time it is spent, the old UTXO will be destroyed and Create a new output.
In the process of spending UTXO, a smart contract will be executed to verify whether the transaction is valid. Therefore, instead of treating smart contracts as autonomous entities that can act, treating them as guards that guarantee true and accurate execution will be much more effective.
Although a bit counterintuitive, this distinction is actually very useful. Rather than let a system trying to achieve the impossible goal of “becoming a world computer” fall into an inextensible chaos, we might as well be realistic and optimize the design of smart contracts to make them as scalable and powerful as possible.
By clarifying the expectations of what smart contracts can do, we can also release this ability to explore its untapped potential. This is the benefit that the eUTXO (Extended Unspent Transaction Output) model brings to us.
In this article, we will cover many such innovations, which can only be realized based on the data input concept on the UTXO system.
How UTXO contracts work
In the introduction part, we quickly introduced UTXO. If you are already proficient in this field, it is great, but for most readers, UTXO is very abstract and it is also very difficult for them to spend their brains to understand it. Therefore, let us go straight to the basics and gradually learn about novel innovations from there.
UTXO refers to unspent transaction output. At a very high level, each UTXO (also known as coin box) on the eUTXO system includes:
1. Assets inside.
2. Lock the smart contract (script) of UTXO. (Or the hash of the P2SH contract)
3. The on-chain data related to the smart contract is stored in the coin box.
Depending on the existing blockchain, other types of data (such as metadata) may also be stored in UTXO. However, these differences usually do not affect the expressiveness of the model itself, so this article does not consider these differences.
In existing blockchains (Ergo, Cardano), smart contracts that lock UTXOs are defined by addresses. Therefore, if UTXO A is sent to smart contract address Y, UTXO A is locked by smart contract Y. This address is usually the hash of the contract (such as a P2SH address) or the serialized form of the contract (such as a P2S address).
When the UTXO of the smart contract address Y is used as the input of the transaction, the code/logic in the smart contract Y will be executed to determine whether the transaction is valid. During execution, the smart contract usually reads:
l Assets saved in UTXO.
l Additional data in UTXO.
l Other assets/data/contracts entered in the transaction.
l Other context of the current transaction.
The smart contract reads the data listed above as input, and if it executes to the equivalent of True, the transaction is valid and passed. This is the core workflow used by UTXO-based smart contracts.
This means that every time you want to update the data stored in the dApp (inside UTXO), you have to spend the original UTXO (and thus destroy it) and create a new UTXO at the same address and save the same assets. However, this new UTXO has a new value in its data, which results in a state transition from the old data value to the new data value.
Each UTXO saves its own individual state in terms of the data attached to it. When data and assets move from one UTXO to another UTXO, they undergo state transitions, which may cause them to split, accumulate, be deleted, or be used with other assets/data from other UTXOs. With the potential of multiple input UTXOs and multiple output UTXOs, these high-level actions allow more complex logic to be coded. This eventually becomes one of the key basic building blocks for dApp development.
Basic cross-contract interoperability
As we have seen, spending UTXO is the core of the eUTXO smart contract model. All execution happens when UTXO is spent.
The savvy reader may have noticed that since we attach the state (data) to each UTXO individually, every time a state transition occurs, the result will be reflected in the data. Therefore, data is usually “preprocessed”, where it already exists and contains information that can be referenced by other dApps/contracts without any further execution.
As an example, oracle data is useful information that can be used by other smart contracts. Using such data stored in UTXO in a simple and straightforward way will cost UTXO. By using UTXO (with oracle data) as input, you will spend it, thereby providing access to its data for your other transaction inputs. When your dApp wants to access data stored in UTXO locked under other smart contracts, use the above method.
Nonetheless, “it costs every single UTXO you want to read data from” has some big problems:
l UTXO smart contracts containing data must be executed, thereby increasing computational complexity/cost.
l UTXO must be spent, which means that only one transaction per block/slot (Slot) can use UTXO data.
l Due to unnecessary over-execution and re-creation of output data UTXO, transaction costs will increase.
l Every UTXO that wants to allow read access through spending must directly encode the logic in its smart contract.
l Prone to malicious attacks by malicious actors who want to destroy the agreement.
l Increased the off-chain complexity of transaction creation and finding the latest UTXO.
The above-mentioned negative problems clearly indicate that new methods are needed to solve the above-mentioned problems. Reading data in UTXO/dApp is a very common design pattern, which will be needed when implementing very complex protocols.
Data entry is a powerful solution
Fortunately, the three core developers of Ergo, Alexander Slesarenko, Alex Chepurnoy, and Dmitry Meshkov, discovered a very useful innovation when building the first UTXO-based smart contract blockchain.
It no longer forces all transactions to destroy/send all inputs like the original UTXO-based blockchain. What if the concept of “read-only input” is introduced? These will allow any transaction to reference any other coin box (UTXO) currently in the UTXO set and read the data stored in it, without any of the problems listed in the previous section.
This is the meaning of data-inputs.
When the coin box is not destroyed/spent, no smart contract execution will occur. This means that a given UTXO can be read in parallel by every single transaction in a block/slot, because they do not consume data, but instead share a reference to it. Since there is no contract execution and no additional output needs to be created, transaction fees will be reduced. This also solves all further negative issues, making data input a clear design choice that all UTXO-based blockchains should implement.
As can be seen from the above figure, data input is the main mechanism for many use cases such as DeFi. In this figure, the interest rate of our DeFi dApp relies on external oracle data from the real world. DeFi dApp uses the oracle pool to obtain the above data. The example in the figure is $12.93.
This is the market price of an asset in the real world, and DeFi dApp accesses it through data input. The UTXO of the oracle pool is referenced in the data input part of the transaction, so the data can be used by our DeFi dApp smart contract.
During the state transition (spending transaction) to update the DeFi dApp state, we can see that the oracle data is used to perform interest rate calculations. The original interest rate was 3.23%, but after reading the oracle pool data, the interest rate was updated to 3.53%.
This is the basic process of how data entry works in practice. In the above example, we only show a single dApp that references the oracle pool UTXO as data input. However, potentially thousands of DeFi dApps can do the same thing for themselves in the same block/slot (assuming blockchain throughput can support).
Unleash the potential of data entry
Now that we have discussed what data inputs are and what benefits they provide at a basic level, let’s take a look at some of the truly novel innovations they bring to UTXO-based blockchains:
1 , through the parallel computing chains extend dApp
One of the key new tools provided by data input on the UTXO system is concurrency and parallelism.
Instead of performing all operations in the dApp in sequence in the same contract/UTXO, it is better to let the participants in the agreement execute their own part of the agreement entirely in their own UTXO. This means that they do not directly rely on other people’s sequential operations (which may hinder other people’s operations), thereby increasing the throughput of an existing given dApp.
Once participants have completed their part of the agreement, the resulting UTXO can be spent or read. The former allows multiple complex protocols to be executed in parallel (these protocols have different participants who provide data and assets), and then consume their UTXO back to the core protocol. For example, this is useful for situations such as crowdfunding or on-chain tournaments. For tournaments, multiple users compete in parallel, and their results and pledge funds are consumed/combined after the round is over (this is a simple but explanatory example).
On the other hand, due to the introduction of data input, the latter can unlock more capabilities by reading UTXO. By reading the data generated in parallel, this means that the cost of obtaining the data is lower, it can be reused by others, and everyone can access it at the same time. Therefore, we have released impressive potential, such as running multi-stage smart contract sub-protocols in dApps. These sub-protocols are executed completely in parallel, but can access each other’s data to perform checks/make sure everything is normal.
In addition, since data from all UTXOs running in parallel can be accessed through data input, we can take a “snapshot” of the fully parallelized dApp state. Instead of letting these parallelized UTXOs be blocked or waiting for actions to occur in the core state of the protocol so that these UTXOs can be further spent/used, they can continue their part of the protocol without any problems. After that, the snapshot is generated by the participants on the blockchain, and they are incentivized/paid by the dApp to find all the protocol-related UTXOs. Once found in the UTXO set on the blockchain, these “accumulators” refer to all these UTXOs as data inputs and add them to the final value representing the current state of the protocol.
Therefore, we have a viable concurrency model on the eUTXO blockchain, which becomes more powerful due to data input.
2 , UTXO model updates seamless dApp
By using the Proxy box, data input can also seamlessly update the multi-stage UTXO-based dApp protocol.
The proxy coin box stores the calculation logic of a given stage in the agreement, or the address of the next stage that can be spent. By using this proxy coin box, we have an outsourced UTXO, which provides us with the ability to update dApps. .
This outsourcing agent UTXO will implement a governance solution that allows updating the underlying script that locks it, and/or its register containing the data of the subsequent stage address. This can use a multi-signature scheme, a token-based voting scheme, or any other governance protocol to release updates to the dApp.
This opens the door for dApps with governance tokens (community self-renewal through governance protocols). If an overwhelming majority vote to update stage X from contract A to contract A’, then this will be reflected in the proxy token box, and therefore will affect all future operations/state transitions in the dApp.
The flexibility of the way to implement dApp updates through the proxy coin box is due to data input providing us with an outsourced UTXO, which contains all the logic outside the core dApp protocol itself.
3 , efficient, and to trust in the global context declaration
Since anyone and everyone on the blockchain can access the data stored in any UTXO as data input, we can make a valid statement about the status of any dApp without trust.
This means that there is no need for developers to provide explicit permission by coding additional logic (which will increase computational costs) or without any additional work, and users on the blockchain can access the current state of any dApp in their own contract.
For example, we can state that the liquidity of dApp X does not exceed $100 million and offer a reward to anyone to refute this claim. This means that although the UTXO for which we made this claim exists, we can treat it as an invariant that the claim is true. It can then be constructed as a building block in a more complex protocol.
It is stated that verifiers will continue to scan the UTXO set to verify that the liquidity of dApp X does not exceed $100 million. If dApp X finally reaches this point (liquidity of more than 100 million US dollars), then all claim verifiers will rush to spend claim UTXO to earn bounty. This will indicate that our declaration/invariant is refuted, so we have an interactive mechanism to provide our dApp with an efficient global UTXO set declaration.
This is an extremely powerful mechanism that has not been possible in any other system before. It opens the door to many interesting use cases, such as permission-free dApp insurance, or permission-free/trustless prediction markets regarding the state of any dApp on the entire blockchain. These are just a few interesting possibilities with significant impact, but there is no doubt that there are more to be discovered.
It can be seen that due to the great innovation of data input on the blockchain based on the extended UTXO (eUTXO), the huge potential has been released. The knowledge points mentioned above are intended to let everyone understand the possible situation without the need to delve into the technical details.
More articles from Emurgo Research will be published in the future, which will introduce all these innovations in depth, and more content may be added as new discoveries are made.
Author: Robert Kornacki
Disclaimer: The copyright of this article belongs to the original author, and the content written only represents the original author’s point of view, and does not make investment and financial advice.
Posted by:CoinYuppie，Reprinted with attribution to:https://coinyuppie.com/ergocardano-will-help-the-eutxo-model-unleash-its-unlimited-potential/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.