Discover more from Economics Design Newsletter
ELI5: Using EUTXO for DeFi.
Welcome, premium subscribers! Thank you for subscribing. I appreciate you very much.
TLDR below. This is not financial advice.
UTXO = Bitcoin's accounting method
Good because it works. Bad because it is not powerful enough to deal with smart contracts (e.g. Ethereum based transactions). Because smart contract requires more computer power.
EUTXO solves that. Cardano uses this method.
What is EUTXO
We discussed UTXO model in the past week. It is like the accounting model which works on Bitcoin, Ethereum and other blockchains in different ways. Example, if you buy something for 95 cents, you may have to pay $1 and get 5 cents back. Ethereum and other blockchains work differently, just like a bank account. If you pay 95 cents, you only need to pay that amount.
The Extended UTXO (EUTXO) model empower smart contract writers with a strong and flexible base to build on top. It differs from the account model in that it has no concept of function which we call in a transaction for state transitions to take place.
Extended UTXO. It uses the UTXO accounting model like Bitcoin. It can be used on smart contract transactions too.
Everything sounds simple, but there are trade-offs. EUTXO which is a similar UTXO model and it can support smart contracts.
Main question: Why is UTXO important?
With the expansion, we can have more approaches and it is a better programming language with less prone to bugs or mistakes and many other things.
EUTXO is UTXO based on smart contracts, which are better suited for scalability. It is similar to how multiple blockchains are going to scale. They can be parallelised as a computer work with having multiple cores and you send different instructions to different courses in the computer.
UTXO is a key basic technology behind smart contracts.
The programmers found a way to develop smart contracts based on UTXO. This is a breakthrough as it makes the Bitcoin / Ethereum-based token capable of supporting Turing completion of smart contracts and Dapps.
These UTXO-based smart contracts are language-independent and allow every UTXO to have a single consensus mechanism. It is a truly revolutionary development.
Tech Dive: How do UTXO contracts work?
Each UTXO contract on an extended UTXO system include
The Assets; ($LISA)
The smart contract locks the UTXO; (0xL1234567...)
On-chain data is held in UTXO which is relevant to the smart contract. (Balance: 150 $LISA)
Technically for smart contracts development, each UTXO year keeps the information about tokens or its state (e.g. token balance) in the data which has attached to it.
Example: UTXO A is locked by smartcontract B, if UTXO A is sent to the address of smart contract B.
People are going to create new UTOX or could be a split in multiple UTOX. The data and assets move from one UTXO to another, they pass through state transitions which can cause them to split, accumulate, be deleted or be used with other assets/data from other UTXOs. During this execution the smart contract typically reads:
Assets are held in UTXO;
Data attached in UTXO;
Assets/Data/Contracts of other inputs in the transaction;
Another context of the current transaction.
If all information is true, then the transaction is valid and passes. (Aka "blockchain requires no trust." Yeah, because we trust the data instead.)
That means every time you want to update data which is held by a Dapp (inside of a UTXO), you must spend the original UTXO by removing it and create a new UTXO at the same address with the same assets. This new UTXO has a value in its data, thus causing the transition to occur from the old data values to the new data values.
These higher-order actions allow for more complex logic to be encoded with potential for multiple input UTXOs and multiple-output UTXOs. That means people can be changed between different states, even go back to the previous state. This is good because we can execute with thousands of users at the same time. They can be holding different states in a clean way for the developers.
What is the information held by UTXO?
The UTXO is going to hold the tokens that the user has a ValidatorScriptHash which lock their assets/tokens.
What Is Required For A Contract Transaction?
We will need the input of the UTXOs that you are going to use. Similar to Bitcoin, we need a ValidatorScriptScript and a RedeemerScriptScript which is the same as the input.
Interoperability between UTXO contracts
We understand that spending UTXOs is the core of the extended UTXO model, all execution happens when a UTXO is spent.
The data is attached individually to each UTXO, in principle every time the data transition occurs, the results will be reflected with previous data. Thus the data always is preprocessed, exist and contains information that could be useful for other Dapps/contracts to reference without any further execution required.
For example, information available in a UTXO can be used as a function of providing price information (oracle) and helps to perform other related activities. This is how Dapps can gain access to data stored under UTXO which is locked under other smart contracts.
The interaction between smart contracts is basically the execution of transactions between them. The more complex a smart contract includes many transaction processes in it. Hence in the above example, reading data in each UTXO has several disadvantages:
The UTXO contract must execute which will be increasing cost (transaction fee)
Unnecessary costs for the UTXOs to be executed and recreate the data output.
Every transaction only can use the UTXO data per block/slot.
Each UTXO wants to access spending information that must be calculated directly in their smart contract.
Take risks of spam attacts by bad actors.
Increased complexity for off-chain UTXOs.
From the above, we need to continue to develop and test more. Reading the information in UTXOs/Dapps is a common design and is required when implementing complex protocols.
Practical Knowledge: How is UTXO better for DeFi protocols?
Eliminate unnecessary operations in the "old" UTXO model
One of the solutions being developed by the Ergo Platform is that instead of forcing all transactions to spend all input, as we mentioned, any transaction is allowed to reference any existing UTXO and read the data kept in it without problem from the previous section. It is called data-inputs.
If there is no spending, no smart contracts will be executed. That means a given UTXO can be read by every transaction in the block/slot in parallel by an independent information provider. It is called Oracle Pool UTXO which will reduce transaction fees and the issues outlined above.
Problem: high transaction fees
The most obvious problem we see is transaction fees. With Ethereum, transaction fees soar when DeFi projects launch and many people use them, there is a lot of transactions going on-chain, and fees are an important one in the DeFi space. This means that if the fees are too high, the participant could lose some of the benefits of joining DeFi and hinder the development of DeFi.
Solution: UTXO to reduce transaction fees
So if we use a UTXO solution in DeFi, it will reduce transaction fees. Assets are locked in a box and the transactions performed in it will be combined per transaction. This will save a lot of costs.
Value added from UTXO Model
The second problem I want to talk about is the value-added when there is a UTXO in the DeFi space. Now, we have a lot of new concepts that solve many scaling problems and it takes time to build and test various new ways to capitalise. We still haven't had direct access to resources outside of the DeFi space, because if you want to participate in the crypto space, you have to convert FIat to stablecoin (as $DAI, $USDC, $TUSD, $USDT, etc.) to approach. This creates frustration and is not practical for everyone. The ultimate goal is to let anyone with Fiat or crypto (off-chain or on-chain) access DeFi easily and economically. That is the potential that UTXO can do.
UTXO: good for simple basic payment transactions. EUTXO: able to support more complex transactions that use smart contracts. DeFi uses lots of smart contacts. We can bring in the Bitcoin-like style of trust into DeFi with EUTXO.
Get smart: UTXO concept shows scalability, savings and access to many resources.
Get smarter: However, we need to build and test more to make it usable without any return. Therefore, if there is a good and right investment, projects that use UTXO in DeFi is likely to attract future users, not just in the DeFi space.
Ps: Order the textbook "Economics and Math of Token Engineering and DeFi" today!