Topic 1.1 Review Questions
Decentralized Exchange Protocols Constant Function Market Maker
A constant function market maker (CFMM) is a smart contract-liquidity pool that holds (at least) two cryptoassets in reserve and allows anyone to deposit tokens of one type and thereby to withdraw tokens of the other type. To determine the exchange rate, smart contract-based liquidity pools use variations of the constant product model, where the relative price is a function of the smart contract's token reserve ratio. A liquidity pool using this model cannot be depleted, as tokens will get more expensive with lower reserves. When the token supply of either one of the two tokens approaches zero, its relative price rises infinitely as a result. (x + Δx) * (y + Δy) = k
Decentralized Exchange Protocols Peer-to-Peer Protocols
An alternative to classic exchange or liquidity pool models are peer-to-peer (P2P) protocols, also called over-the-counter (OTC) protocols. They mostly rely on a two-step approach, where participants can query the network for counterparties who would like to trade a given pair of cryptoassets and then negotiate the exchange rate bilaterally. Once the two parties agree on a price, the trade is executed on-chain via a smart contract. In contrast to other protocols, offers can be accepted exclusively by the parties who have been involved in the negotiation. In particular, it is not possible for a third party to front-run someone accepting an offer by observing the pool of unconfirmed transactions (mempool). To make things more efficient, the process is usually automated. Additionally, one can use off-chain indexers for peer discovery. These indexers assume the role of a directory in which people can advertise their intent to make a specific trade. Note that these indexers only serve to establish a connection. Prices are still negotiated P2P.
Decentralized Exchange Protocols Smart Contract-Based Reserve Aggregation
Another approach is to consolidate liquidity reserves through a smart contract that allows large liquidity providers to connect and advertise prices for specific trade pairs. A user who wants to exchange token x for token y may send a trade request to the smart contract. The smart contract will compare prices from all liquidity providers, accept the best offer on behalf of the user, and execute the trade. It acts as a gateway between users and liquidity providers, ensuring best execution and atomic settlement.
Opportunities of the DeFi Ecosystem (4 opportunities) Composability
Composability DeFi protocols are often compared with Lego pieces. The shared settlement layer allows these protocols and applications to interconnect. This flexibility allows for an ever-expanding range of possibilities and unprecedented interest in open financial engineering. Any two or more pieces can be integrated, forked, or rehashed to create something entirely new. Anything that has been created before can be used by an individual or by other smart contracts. This flexibility allows for an ever-expanding range of possibilities and unprecedented interest in open financial engineering.
Which are two of DeFi's most prominent features that are often compromised in efforts to increase scalability?
Composability and general transaction atomicity. Composability refers to the flexibility of the ecosystem to combine parts like Lego building blocks. Note: Although "atomicity" and "atomic" are often used in the curriculum article, it is not well defined there. Atomicity is part of a set of principles used to guarantee the reliability of database transactions: atomicity, consistency, isolation, and durability. Atomicity is a feature of a database system that dictates when a transaction can occur or not and depends on the context. An example is an airline booking system that requires two separate actions (paying for a seat and reserving a seat) to be performed in the same transaction. Either both actions occur and the transaction happens, or else it doesn't. The transaction cannot be partial; it is all or nothing.
Building block of DeFi
DeFi uses a multi-layered architecture. Every layer has a distinct purpose. The layers build on each other and create an open and highly composable infrastructure that allows everyone to build on, rehash, or use other parts of the stack. It is also crucial to understand that these layers are hierarchical: They are only as secure as the layers below. If, for example, the blockchain in the settlement layer is compromised, all subsequent layers would not be secure. Similarly, if we were to use a permissioned ledger as the foundation, any decentralization efforts on subsequent layers would be ineffective.
Decentralized exchange
Decentralized exchange protocols try to mitigate the issues that centralized exchanges have by removing the trust requirement. Users no longer must deposit their funds with a centralized exchange. Instead, they remain in exclusive control of their assets until the trade is executed.
Decentralized Finance (DeFi)
Decentralized finance (DeFi) is a blockchain-based financial infrastructure that has recently gained a lot of traction. The term generally refers to an open, permissionless, and highly interoperable protocol stack built on public smart contract platforms, such as the Ethereum blockchain. DeFi does not rely on intermediaries and centralized institutions. Instead, it is based on open protocols and decentralized applications (DApps). Agreements are enforced by code, transactions are executed in a secure and verifiable way, and legitimate state changes persist on a public blockchain. Thus, this architecture can create an immutable and highly interoperable financial system with unprecedented transparency, equal access rights, and little need for custodians, central clearing houses, or escrow services, as most of these roles can be assumed by "smart contracts."
Decentralized Exchange Protocols Decentralized Order Book Exchanges
Decentralized order book exchanges can be implemented in a variety of ways. They all use smart contracts for transaction settlement, but they differ significantly in how the order books are hosted. One has to distinguish between on-chain and off-chain order books.
Risks of the DeFi Ecosystem (3) Dependencies
Dependencies These introduce risk because as the number of dependencies increase, the likelihood that a component (the system is dependent on) could fail increases.
Risks of the DeFi Ecosystem (4) External Data
External data External data is another type of dependency. Whenever a smart contract depends on data that are not natively available on-chain, the data must be provided by an external data source. The so-called oracles introduce dependencies and may, in some cases, lead to heavily centralized contract execution.
The three backing models for promise-based tokens
Generally speaking, there are three backing models for promise-based tokens: • off-chain collateral • on-chain collateral • no collateral. These are all stablecoins.
Risks of the DeFi Ecosystem (5) Illicit Activity
Illicit data A common concern among regulators is that crypto-assets may be used by individuals who want to avoid records and monitoring. While the inherent transparency of DeFi is a deterrent to this use case, the network's pseudonymity may provide some privacy. While pseudonymity can be abused by actors with dishonest intentions, privacy may be a desirable attribute for some legitimate financial applications. Therefore, regulators should act with great care, trying to find reasonable solutions without stifling innovation.
Decentralized Exchange Protocols Smart Contract-Based Reserve Aggregation Risks? What are ways to mitigate this risk?
In contrast to smart contract-based liquidity pools, with smart contract-based reserve aggregation, prices are not determined within the smart contract. Instead, prices are set by the liquidity providers. This approach works fine if there is a relatively broad base of liquidity providers. However, if there is limited or no competition for a given trade pair, the approach may result in collusion risks or even monopolistic price setting. As a countermeasure, reserve aggregation protocols usually have some (centralized) control mechanisms, such as maximum prices or a minimum number of liquidity providers. In some cases, liquidity providers may only participate after a background check, including KYC (know your customer) verification.
Collateralized Debt Markets
Instead of creating new tokens, it is also possible to borrow existing cryptoassets from someone else. For obvious reasons, this approach requires a counterparty with opposing preferences. In other words: For someone to be able to borrow ETH, there must be another person willing to lend ETH. To mitigate counterparty risk and protect the lender, loans must be fully collateralized, and the collateral is locked in a smart contract— just as in our previous example.
Decentralized Exchange Protocols Constant Function Market Maker arbitrage
It is important to point out that smart contract-based liquidity pools are not reliant on external price feeds (so-called oracles). Whenever the market price of an asset shifts, anyone can use the arbitrage opportunity and trade tokens with the smart contract until the liquidity pool price converges to the current market price. The implicit bid/ask spread of the constant product model (plus a small trading fee) may lead to the accumulation of additional funds. Anyone who provides liquidity to the pool receives pool share tokens that allow them to participate in this accumulation and to redeem these tokens for their share of a potentially growing liquidity pool.
Collateralized Debt Markets Matching
Matching lenders with borrowers can be done in a variety of ways. The broad categories are P2P and pooled matching. P2P matching means that the person who is providing the liquidity lends the cryptoassets to specific borrowers. Consequently, the lender will only start to earn interest once there is a match. The advantage of this approach is that the parties agree on a time period and operate with fixed interest rates. Pooled loans use variable interest rates that are subject to supply and demand. The funds of all borrowers are aggregated in a single, smart contract-based lending pool, and lenders start to earn interest right when they deposit their funds in the pool. However, the interest rates are a function of the pool's utilization rate. When liquidity is readily available, loans will be cheap. When it is in great demand, loans will become more expensive. Lending pools have the additional advantage that they can perform maturity and size transformation while maintaining relatively high liquidity for the individual lender.
open exchange protocols
More recently, there has been a move toward open exchange protocols. These projects try to streamline the architecture of decentralized exchanges by providing standards on how asset exchange can be conducted and allowing any exchange built on top of the protocol to use shared liquidity pools and other protocol features. However, most importantly, other DeFi protocols can use these marketplaces and exchange or liquidate tokens when needed.
Atomicity
Note: Although "atomicity" and "atomic" are often used in the curriculum article, it is not well defined there. Atomicity is part of a set of principles used to guarantee the reliability of database transactions: atomicity, consistency, isolation, and durability. Atomicity is a feature of a database system that dictates when a transaction can occur or not and depends on the context. An example is an airline booking system that requires two separate actions (paying for a seat and reserving a seat) to be performed in the same transaction. Either both actions occur and the transaction happens, or else it doesn't. The transaction cannot be partial; it is all or nothing.
DeFi layers Layer 5
The aggregation layer extends the application layer into a platform with several applications so that users can perform more complex tasks.
DeFi layers Layer 4
The application layer consists of user-oriented, web-based interactive applications based on protocols.
DeFi layers Layer 2
The asset layer also includes the native protocol asset and any additional tokens issued on the blockchain. (The native protocol asset shares both the settlement layer and asset layer.) The asset layer is where tokens are created.
interoperable
The capability of a system to work with or use the parts or equipment of another system *this term comes up a lot so this was an google search for the meaning.
What is the general idea of tokenization?
The general idea of tokenization is to make assets more accessible and transactions more efficient. In particular, tokenized assets can be transferred easily and within seconds from and to anyone in the world. They can be used in many decentralized applications and stored within smart contracts. As such, these tokens are an essential part of the DeFi ecosystem.
DeFi layers Layer 3
The protocol layer enables exchanges, lending, derivatives, asset management, and more with smart contracts.
DeFi layers Layer 1
The settlement layer consists of the blockchain (e.g. Bitcoin or Ethereum) and the native protocol asset (e.g. BCH or ETH). This layer stores ownership information securely and provides the foundation for trustless execution.
To protect the lender and stop the borrower from running away with the funds, there are two distinct approaches: (1) flash loans
To protect the lender and stop the borrower from running away with the funds, there are two distinct approaches: First, credit can be provided under the condition that the loan must be repaid atomically, meaning that the borrower receives the funds, uses, and repays them— all within the same blockchain transaction. Suppose the borrower has not returned the funds (plus interest) at the end of the transaction's execution cycle. In this case, the transaction will be invalid and any of its results (including the loan itself) reverted. These so-called flash loans are an exciting but still highly experimental application. While flash loans can only be employed in applications that are settled atomically and entirely on-chain, they are an efficient new instrument for arbitrage and portfolio restructuring. As such, they are on track to become an essential part of DeFi lending.
Decentralized exchange trade execution
Trade execution happens atomically through a smart contract, meaning that both sides of the trade are performed in one indivisible transaction, mitigating the counterparty credit risk. Depending on the exact implementation, the smart contract may assume additional roles, effectively making many intermediaries such as escrow services and central counterparty clearing houses (CCPs) obsolete.
Opportunities of the DeFi Ecosystem (4 opportunities) Transparency
Transparency DeFi applications are transparent. The transparency of DeFi applications may allow for the mitigation of undesirable events before they arise and help provide a much faster understanding of their origin and potential consequences when they emerge. All transactions are publicly observable, and the smart contract code can be analyzed on-chain. The observability and deterministic execution allow—at least in theory—an unprecedented level of transparency.
Tokenization What is it?
Usually, a ledger is used to track the native protocol asset of the respective blockchain. However, when public blockchain technology became more popular, so did the idea of making additional assets available on these ledgers. The process of adding new assets to a blockchain is called tokenization, and the blockchain representation of the asset is referred to as a token.
Event-based Derivative Tokens
We call a derivative event-based when its price is a function of any observable variable that is not the performance of an asset. Event-based decentralized derivative tokens can be based on any objectively observable variable with a known set of potential outcomes, a specific observation time, and a resolution source. Anyone can buy a full set of sub-tokens for a given event by locking 1 ETH in a smart contract. A complete set of sub-tokens consists of 1 sub-token for each potential outcome. These sub-tokens can be traded individually Event-based derivative tokens can be based on any objectively observable variable with a known set of potential outcomes, a specified observation time, and a resolution source. Anyone can buy a full set of sub-tokens for a given event by locking 1 ETH in a smart contract. A complete set of sub-tokens consists of 1 sub-token for each potential outcome. These sub-tokens can be traded individually. When the market resolves, the smart contract's cryptoassets will be split among the sub-token owners of the winning outcome. In the absence of market distortions, each sub-token's ETH price should, therefore, correspond to the probability of the underlying outcome.
Asset-Based Derivative Tokens
We call a derivative token asset-based when its price is a function of an underlying asset's performance. Asset-based decentralized derivatives can be seen as an extension of the stablecoin model using decentralized collateralized debt positions. Instead of limiting the issuance to USD pegged stablecoins, the locked collateral can be used to issue synthetic tokens that follow the price movements of various assets. Asset-based derivative tokens are an extension of the Collateralized Debt Position model described in Section 2.3. Instead of limiting the issuance to USD-pegged stablecoins, the locked collateral can be used to issue synthetic tokens that follow the price movements of a variety of assets. Examples include tokenized versions of stocks, precious metals, and alternative cryptoassets. The higher the underlying volatility, the larger the risk of falling below a given collateralization ratio.
No collateral
When there is no collateral, counterparty risk is at its highest. In this case, the promise is entirely trust-based.
Risk of no collateral
When there is no collateral, counterparty risk is at its highest. In this case, the promise is entirely trust-based.
What are the Opportunities of the DeFi Ecosystem? (4 opportunities)
• Increased efficiency • increased transparency • Increased accessibility • Composability DeFi may increase the efficiency, transparency, and accessibility of the financial infrastructure. Moreover, the system's composability allows anyone to combine multiple applications and protocols, thereby creating new and exciting services.
advantages of on-chain collateral
• It is highly transparent • smart contract helps automate execution
List the five building blocks (Layers) of Defi
• The settlement layer (Layer 1) • The asset layer (Layer 2) • The protocol layer (Layer 3) • The application layer (Layer 4) • The aggregation layer (Layer 5)
disadvantages of on-chain collateral
• collateral is usually held in a native protocol asset (or a derivative thereof) and, therefore, will experience price fluctuations (price volatility).
Disadvantages of decentralized exchanges. Arbitrage opportunities?
• low transaction volumes • large bid/ask spreads High network fees, as well as cumbersome and slow processes to move funds between these decentralized exchanges, have rendered supposed arbitrage opportunities useless.
Risks of the DeFi Ecosystem (6 risks)
• smart contract execution risk • operational security • dependencies on other protocols • external data • illicit activity • scalability
Advantages/disadvantages of off-chain collateral
Advatages • Mitigation of exchange rate risk, as the collateral may be equivalent to the tokenized claim (e.g., USD claim, backed by real USD). Disadvantages • counterparty risk and external dependencies. • Require regular audits and precautionary measures to ensure that the underlying collateral is available at all times which is costly
advantages/disadvantages of Centralized Exchanges
Advantages • relatively efficient Disadvantages • To be able to trade on a centralized exchange, traders must first deposit assets with the exchange. They thereby forfeit direct access to their assets and have to trust the exchange operator. Dishonest or unprofessional exchange operators may confiscate or lose assets. • Moreover, centralized exchanges create a single point of attack and face the constant threat of becoming the target of malicious third parties. The relatively low regulatory scrutiny intensifies both problems and the immense scaling efforts many of these exchanges had to go through quickly. Accordingly, it is no surprise that some centralized cryptoasset exchanges have lost customer funds.
Opportunities of the DeFi Ecosystem (4 opportunities) Accessibility
Accessibility The infrastructure requirements are relatively low, and the risk of discrimination is almost nonexistent due to the lack of identities.
Opportunities of the DeFi Ecosystem (4 opportunities) Efficiency
Efficiency By replacing the trust element needed in centralized systems with smart contracts, the DeFi ecosystem virtually eliminates counterparty risk and replaces the role of third parties such as custodians, escrow agents, and central counterparty clearinghouses CCPs with the smart contracts. This makes transactions faster and much more efficient.
Off-chain collateral
Off-chain collateral means that the underlying assets are stored with an escrow service, for example, a commercial bank. Aka, off the blockchain.
On-chain collateral
On-chain collateral means that the assets are locked on the blockchain, usually within a smart contract.
Decentralized Exchange Protocols On-chain order books
On-chain order books have the advantage of being entirely decentralized. Every order is stored within the smart contract. As such, there is no need for additional infrastructure or third-party hosts. The disadvantage of this approach is that every action requires a blockchain transaction. Therefore, it is a costly and slow process for which even the declaration of the intent to trade results in network fees. Considering that volatile markets will require frequent order cancellations, this disadvantage becomes even more costly.
Concerns with tokenized assets
One of the main concerns with tokenized assets is issuer risk. Native digital tokens, such as BTC and ETH, are unproblematic in this regard. In contrast, when someone introduces tokens with a promise, for example, interest payments, dividends, or the delivery of a good or service, the corresponding token's value will depend on this claim's credibility. If an issuer is unwilling or unable to deliver, the token may become worthless or trade at a significant discount. This logic also applies to stablecoins.
Risks of the DeFi Ecosystem (2) Operational Security
Operational security Many DeFi protocols and applications use admin keys for a predefined group of individuals to upgrade contracts and perform emergency shutdowns. If malicious third parties get ahold of the keys, they can compromise the smart contracts. Alternatively, the core team members themselves may be malicious or corrupted by significant monetary incentives.
Risks of the DeFi Ecosystem (6) Scalability
Scalability When there is a lot of demand, the ecosystem should scale to meet increased demand but often suffers from increased transaction prices and time for confirmation. Scaling efforts can address some of the problems but also often weaken composability and atomicity.
To protect the lender and stop the borrower from running away with the funds, there are two distinct approaches: (2) collateral
Second, loans can be fully secured with collateral. The collateral is locked in a smart contract and only released once the debt is repaid. Collateralized loan platforms exist in three variations: Collateralized debt positions, pooled collateralized debt markets, and P2P collateralized debt markets. Collateralized debt positions are loans that use newly created tokens, while debt markets use existing tokens and require a match between a borrowing and a lending party.
Decentralized Exchange Protocols Off-chain order books
Since on-chain order books can be so costly and slow, many decentralized exchange protocols rely on off-chain order books and only use the blockchain as a settlement layer. Off-chain order books are hosted and updated by centralized third parties, usually referred to as relayers. They provide takers with the information they need to select an order they would like to match. While this approach indeed introduces some centralized components and dependencies to the system, the relayers' role is limited. Relayers are never in control of the funds and neither match nor execute the orders. They simply provide ordered lists with quotes and may charge a fee for that service. The openness of the protocol ensures that there is competition among the relayers and mitigates potential dependencies.
Risks of the DeFi Ecosystem (1) Smart Contract Execution
Smart contract execution While the deterministic and decentralized execution of smart contracts does have its advantages, there is the risk that something may go wrong if there are coding errors. These errors may potentially create vulnerabilities that allow an attacker to drain the smart contracts' funds, cause chaos, or render the protocol unusable.
smart contracts definition, advantages, disadvantages
Smart contracts are computer programs that directly control the transfer of digital currencies or assets between parties under certain conditions. The backbone of all DeFi protocols and applications is smart contracts. Smart contracts generally refer to small applications stored on a blockchain and executed in parallel by a large set of validators. Their advantage is a high level of security: Smart contracts will always be executed as specified and allow anyone to verify the resulting state changes independently. When implemented securely, smart contracts are highly transparent and minimize the risk of manipulation and arbitrary intervention. In the context of public blockchains, the network is designed so that each participant can be involved in and verify the correct execution of any operation. As a result, smart contracts are somewhat inefficient compared with traditional centralized computing.
Collateralized debt positions
Some DeFi applications allow users to create collateralized debt positions and thereby issue new tokens that are backed by the collateral. To be able to create these tokens, the person must lock cryptoassets in a smart contract. The number of tokens that can be created depends on the target price of the tokens generated, the value of the cryptoassets that are being used as collateral, and the target collateralization ratio. The newly created tokens are essentially fully collateralized loans that do not require a counterparty and allow the user to get a liquid asset while maintaining market exposure through the collateral. The loan can be used for consumption, allowing the person to overcome a temporary liquidity squeeze or to acquire additional cryptoassets for leveraged exposure. Example of this on page 12 and 13.
stablecoins What are they?
Stablecoins are U.S. dollar (USD)-pegged assets