0% found this document useful (0 votes)
42 views51 pages

06 DeFi

The document provides an overview of recent news and developments in cryptocurrency mining and DeFi. Specifically: 1) After Ethereum's merge, miners moved to other proof-of-work coins, but these coins offer lower rewards due to increased competition and difficulty. 2) One company uses an algorithm to mine the most profitable coins and converts the rewards to bitcoin as a new business model. 3) Staking pools allow users to stake over 16 ETH and have a third party handle the technical aspects of mining, but staking tokens trade at a discount due to risks from upgrades. 4) The upcoming Shanghai upgrade will allow staked ETH to withdraw, which could impact Ethereum.

Uploaded by

ayush agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views51 pages

06 DeFi

The document provides an overview of recent news and developments in cryptocurrency mining and DeFi. Specifically: 1) After Ethereum's merge, miners moved to other proof-of-work coins, but these coins offer lower rewards due to increased competition and difficulty. 2) One company uses an algorithm to mine the most profitable coins and converts the rewards to bitcoin as a new business model. 3) Staking pools allow users to stake over 16 ETH and have a third party handle the technical aspects of mining, but staking tokens trade at a discount due to risks from upgrades. 4) The upcoming Shanghai upgrade will allow staked ETH to withdraw, which could impact Ethereum.

Uploaded by

ayush agarwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

News this week

• After the merge Ethereum miners moved to other (PoW) coins.


• A rough reality: $ value of the other coins is lower (lover value per
reward) and the increased competition from mass migration into other
coins increases difficulty (reducing reward frequency per miner). The
difficulty in Ethereum classic increased X4 for example.
• New business model/Bitcoin as safe haven?: Hive Blockchain
(HIVE) use a switching algorithm that mines most profitable coins
and convert the rewards to bitcoin!
News this week
News this week
Staking pools: Mining is a bit complex and Lido allows users
to stake >16 ETH and let a third party do the more "technical"
mining part.
Stakers can get "staking tokens" for their staked ethereum but
they trade at a discount
1. Due to the risk of the "Shanghai upgrade" not working and
2. Individuals leveraging by getting staked tokens for their
staked eth to buy even more eth.

The Shanghai upgrade will allow stakes to withdraw stakes.


What will this do for Ethereum?
DeFi

Today we will:
1) Take a step back to Finance
2) And take a step forward into DeFi
3) Today will act as an “introduction” to the rest of the unit
Financial markets
• The role of financial markets is
• resource allocation,
• monitoring investments,
• mobilizing savings,
• simplify transactions,
• and risk distribution (Levine, 2005)
• To achieve this, finance uses financial assets:
• stocks (or “equity”),
• derivatives (options, forwards, futures…),
• and bonds (or “debt”).
The contractual claim and Finance
• Financial assets: Stocks, Bonds, Futures, Forwards, Options… but
what are they?
• A non-physical contractual claim: you have the right to something or are
contractually liable to delivery something.
• For example: Whoever owns the stock has a contractual right to piece or
“share” of a company and whoever issued the stock has to obligation to
deliver it

Investor Stock Firm


Stocks are contracts:
Share value is $50 Company name: “Frankford & Southwark”
Shout $1,875,000/5=37500 Market cap: $1,875,000
Ownership ($): 25*50 = $1,250
Ownership (%): 25/37500 = 0.06%

Stamped at tens: 2, and units: 5.


The certificate is for 20+5 (25)
Identifier shares

Hole punches to show


not valid

What’s the problem


with this?
The evolution of contracts

Stock certificates Electronic records now Ethereum:


phased out with internet keep track of stock Birth of Smart Contract Platform
in late 90s. Last stock ownership
certificate issued by
Disney in 2013.
Centralized Finance Decentralized Finance
(CEFI) (DEFI)
• Trust in centralized entity: Users • Trust in the blockhain: Users
put their faith in a centralized put their trust in the blockchain
governance structure protocol (the code)
• Non-private: real identify • Private: The identity of the user
registered is hidden by the blockchain
• Permissioned: Third party • Permissionless: Anyone can
approval needed to build on build on the blockchain
system
Advantages of Defi
• No central system to take rents = cheaper for the user
• Transparency: Everyone can verify the code that built the product
• Innovation:
• Defi applications can easily be built as it is open to the public. Uniswap is for
example a decentralized exchange built on the Ethereum blockchain.
• Accessibility:
• Moving assets on the blockchain (tokenization) makes them more accessible
and transactions more efficient.
Defi conceptually
• Layers build on each other
• Hierachical: A layer is only as secure as the
layer(s) below
• If for example the blockchain layer is
compromised, the assets layer, protocol
layer, application layer and aggregation layer
are also compromised.
Defi conceptually

The “engine” behind it


all: the blockchain acts as
1 a ledger that records
ownership.

From Schar, 2021


Defi conceptually

1. Consists of blockchain and the native asset.


2. In Ethereum the for example, the blockchain would be the Ethereum blockchain and the native protocol asset
is Ethereum (or Eth.)
3. Allows for ownership information to be stored.
4. Any state must adhere to its ruleset (blockchain dependent).

The “engine” behind it all:


the blockchain acts as a
1 ledger that records ownership

From Schar, 2021


NFT token called “the golden
boxer” is a unique asset on the
Defi conceptually asset layer enabled by the ERC-
721 protocol. NFTs can be:
1. Digital representation of
physical objects (e.g., Mona
Lisa) subject to counterparty
risk.
2. Digital native unit (e.g., the
golden boxer).

Contains all assets on the


blockchain. This includes
2 the native asset (ETH) and
any other assets issued on
the blockchain.

From Schar, 2021


Defi conceptually

Specific use cases such as


1. decentralized exchanges,
2. decentralized lending,
3. derivatives,
3 4. asset management,
5. liquidity pools.

Highly interoperable: Can be


accessed any user or DApp.

From Schar, 2021


Uniswap interface

Current UNI/USD

Defi conceptually UNI/USD time series

Breakdown of tokens ($ value) in user portfolio


Buy more UNI with your credit card

4
This is the front end (the
interface): What you see
when you a Dapp.

Question: Is UNI the native


asset on this blockchain?

From Schar, 2021


OpenSea interface: Largest exchange for
NFTs

Name of NFT and number in series

User can make a bid

Description includes the total number of NFTs in


collection and sometimes a story

This is the interface the application layer enables


Defi conceptually

Service that connects to


5 several of the applications.

For example think of what


skycanner does when
purchasing flights

From Schar, 2021


Defi conceptually

Assets, debt, and net worth All assets

Equalizer is a flash loan provider

Aave, Compound, and MakerDao Uniswap is a decentralized


provide allow you to lend and exchange that allows you to buy,
borrow through decentralized sell and provide liquidity to a
protocols liquidity pool

From Schar, 2021


The current lay of the land for crypto-assets

… and where DeFi fits in


Where is the value currently? (in public
ecosystem)
Applications
• March 2022: Taking the top 150 crypto-assets
(of >20k)
• Includes 95% of total crypto-asset market cap
($1.8 trillion)
“Other” = tokenised assets like gold, tokenised stocks,
centralised exchange tokens, layer 2 scaling networks,
wrapped crypto assets, data services like oracles and the
graph, meme coins, metaverse/gaming, etc

Market is primarily valuing the blockchain


infrastructure, not the use cases
We are in early days and the market is betting Infrastructure
far more applications/uses will emerge
Zoom in on  > 20,000 digital assets, but highly concentrated
value distribution skewed to major public blockchains
blockchains, (BTC and ETH dominate)
stablecoins, and DeFi
DeFi total value staked ≈ $200 billion

DeFi staking

Source: DeFi Lama


Note: TLV refers to the reserve
slocked in smart contract
Putting assets on a blockchain: Tokenization
Tokenization in Defi
• Tokenization: Adding new assets to a blockchain
• Token: Representation of asset on blockchain
• Idea: Make assets more accessible and easier to transfer
• Can be stored in smart contracts
• Can be used in Dapps
• Most tokens issued on Ethereum using smart contract template ERC-20.
• Tokens are interoperable: Can be used on most defi applications
• By November 2021 there were 450,000 ERC-20 tokens on Ethereum
Asset tokenization: Adding assets to the
blockchain
Types of tokens:
• Governance tokens: Gives holder rights to influence a protocol
• Security (fungible) tokens: Traditional assets (stocks, bonds etc.) on
the blockchain
• Non-fungible tokens: Unique/non-interchangeable assets on the
blockchain
• Stablecoins: Track a fiat currency. For example, Tether tracks the US
dollar.
Tokens claims and value
• Tokens value is dependent on the claims credibility: For example, if I have a tokenized version
of apple share how likely am I to receive value from apple’s appreciation (my claim)?

• Off-chain collateral
• Collateral stored in escrow service (off-chain). For example a commercial bank. Let’s look a
this closer
• On-chain collateral
• Collateral locked within a smart contract on the blockchain
• Highly transparent
• Claims can be executed automatically
• Downside: Collateral (usually) held in native asset and fluctuates in price accordingly.
• No-collateral
• No collateral on the claim and the claim is completely trust based
• High counterparty risk
Tokens claims and value: Off-chain collateral
example (USDT and USDC)
Here there collateral is held my an intermediary which mitigates
exchange rate risk.
USDT and USDC are examples: Here an intermediary holds the actual
asset in collateral (US dollars.)
However, what risks do you think this introduces?
Counterparty risk: we now have to trust the intermediary which requires
regular (costly) audits and precautionary measures to ensure that the
collateral is there at all times.
Decentralized exchanges
• Defi also facilitates exchanges. In our framework they are on the
“application layer.”
• Currently the crypto market dominated by centralized exchanges with
inherent problems:
• Users must deposit crypto into escrow and thereby loose access reintroducing
a need for trust.
• Centralized exchanges make for single point of attack/failure.
• They are far less regulated than regular exchanges (e.g., ASIC) and they have
scaled their operations in a very short time.
• Let’s go to an example
Two types of exchanges: Centralized and
Decentralized

Centralized exchanges (CEXs) Decentralized exchanges (DEXs)


• Custodial • Non-custodial
• MT GOX was attacked in 2014 • Transparent
and 800,000 BTC were stolen
• In 2019 a combined $300M
stolen from centralized
exchanges
• Non-transparency
DEX vs CEX: Growing in size
Centralized exchange problem example
• Mt. GOX was the largest exchange in 2014 handling 70% of all
bitcoin transactions worldwide.
• Ceased operations in 2014 when news emerged that 850 thousand of
BTC were stolen from the exchange’s hot wallet (7% of all BTC at the
time).
• To this date no one knows who stole the bitcoin: The CEO (Mark
Karpelès), another employee, or external hackers.

Note: A hot wallet is (as opposed to a cold wallet) always connected to the internet which makes it vulnerable to
attacks. Reputable exchanges usually keep the majority of their funds in cold wallets. In cold wallets the signatures are
done “in-device” so even if your cold wallet is connected to the internet the hacker cannot sign transactions.
Decentralized exchanges
• Custody: Decentralized exchanges enable users to hold custody of
their funds.
• Mitigating counterparty risk: Smart contract executes the trade
atomically: Both sides of the trade happens in one indivisible
transaction.
• Move towards open exchange protocol: Decentralized exchanges can
share liquidity pools:
• Higher transaction volumes and liquidity
• Lower transaction latency between exchanges
Decentralized exchanges: The (3) types
• Decentralized orderbook exchanges
• On-chain orderbooks
• Against: Every transaction requires a blockchain transaction
• Gas fees and lantency: Amend order, cancel order, declare intent to trade…
• Pro: Entirely decentralized and every order stored within smart contract
• Off-chain orderbooks
• Against: Dependent on third parties, but they are never in control of funds, or match/execute trades
• Pro: Blockchain used for settlement, orderbook updated by third parties (relayers), and relayers
compete to relay information
• Process
1. Makers sends pre-signed order to relayer who updates the orderbook
2. Taker queries relayer and picks and order from the orderbook
3. Taker signs and submit order to smart contract triggering an atomic transaction
Decentralized exchanges: The (3) types
• Constant function market maker • Does not rely on oracles
• Contains at least two crypto
assets, where one is
exchanged for the other
• Uses constant product e.g.,
• Tokens cannot be depleted as
assets become relatively
more expensive when
withdrawn
• Liquidity providers increase
X tokens exchanged for Y. Liquidity provided to the
Price of y increase, price of protocol (no exchange)
k and receive redeemable
x decreases tokens
How do these exchange maintain efficient
prices? Answer: Arbitrage
• Two fruit stand next to each other (no risk) buying/selling at different prices. What do you do?

Selling Selling
apples for apples for $1,
$1.2, buying buying for
for $1.1 $0.9

Bob,
Fruit stand Arbitrageur Fruit stand
B A
Arbitrage: What do you do?
• Answer: Buy apples at stand A and sell them at B. As many as you can for $0.1 profit per transaction

Selling Selling
apples for apples for $1,
$1.2, buying buying for
for $1.1 $0.9

Bob,
Fruit stand Arbitrageur Fruit stand
B A
• Question: What happens to the prices at the two fruit stands If you do this enough?
Arbitrageur removing arbitrage through flash
loan
Pool A: Balanced Pool B: (Dai
imbalance)

Pay 1,000 Tether Pay 987 Dai


𝑇𝑒𝑡ℎ𝑒𝑟 𝐷𝑎𝑖 𝑇𝑒𝑡ℎ𝑒𝑟 𝐷𝑎𝑖
Get 987 Dai Get 1,004 Tether
Fee 0.3 % Fee 0.3 %
Arbitrageur

𝐷 𝐷
=0 . 99 Borrow 1,000 Pay back =0 . 98
𝑇 𝑇
1,000
Here I get 0.99 Dai for Tether Tether Here I get 0.98 Dai for
each of my Tether
each of my Tether
(Dai is cheap)
(Dai is expensive)
Flash loan
provider
Note all exchange rates are quoted indirectly: D/T = 0.99 means that you can buy 0.99 Dai for one Tether.
Decentralized exchanges: The (3) types
• Peer-to-peer protocols
• OTC market
• Participants query the network for a counterparty and exchange rates
• “Indexers” establish a connection between peers
• Trade executed on-chain once parties agree on price
• Offer can only be accepted by the individuals involved (no front-running)
Decentralized lending platforms
• Centralized lending
• Based on credit worthiness (higher credit score = eligible for higher loan)
• Loans are undercollateralized and lender must be compensated for this risk (expensive)
through their rents.

• Decentralized lending
• Over collateralized; in event of default the loan can be recuperated (no need for credit
score).
• Collateralized debt positions: Creating new tokens using collateral
• Collateralized debt markets:
• Pooled collateralized debt markets
• Peer-to-peer collateralized debt markets
• Under collateralization
Decentralized lending platforms
• We will talk about collateralized debt positions and collateralized
markets
• Collateralized debt positions
• Users “lock” crypto assets in the smart contract to get newly issued tokens
• User keeps market exposure (through their locked asset) and receive a newly
minted (and liquid) asset.
Example: MakerDao
1. User deposits ETH creating a collateralized debt position (CDP)
2. User call contract function to receive DAI and lock their collateral
3. MakerDao requires 150% collateral threshold

𝐶𝑜𝑙𝑙𝑎𝑡𝑒𝑟𝑎𝑙 𝑣𝑎𝑙𝑢𝑒
< 150 %
𝐵𝑜𝑟𝑟𝑜𝑤𝑒𝑑 𝑣𝑎𝑙𝑢𝑒
Example: MakerDao
1. The user pays a fee set by a community of governance token (MKR)
holders
2. Two things can then happen
1. The user returns the DAI and receives their (ETH) collateral
2. The value of the collateral drops below the threshold and is auctioned off
3. MRK holders are rewarded for carrying risk extreme ETH price
movements:
1. Compensation: Interest payments “burn” MRK tokens increasing their value
2. Risk: If ETH falls below certain value, the collateral will not cover the loan
and the protocol will mint and auction off at discounted value reducing the
MKR token value
Decentralized derivatives: What are
derivatives?
• Derivatives pay depending on the price of the underlying asset in the
future.
• The payment is not instantaneous but in the future. This introduces
counterparty risk.
$$ ?

• The number events that can happen in the future increases with the
time to payment.
0 t

Time to payment
Decentralized derivatives
• Asset-based derivative tokens
• Like in Decentralized lending users “lock” collateral and receive (asset)
tokens
• Asset tokens could follow the price of:
• Stocks
• Precious metal (e.g., gold)
• Event other crypto assets
• What does volatility of the underlying asset mean for collateralization?
• So called “Inverse tokens” allow for negative (short) exposure to an asset
Decentralized derivatives
• Event-based derivative tokens
• Based on objectively observed variable with known outcomes in a specified
timeframe.
• 1 ETH buys a complete set of outcomes each with their own sub token
• Subtokens can be traded individually and smart contract cryptoassets will be
split among winning subtokens when the market resolves
• In the absence of market distortions each subtokens should be worth the
probability of their outcome
• Event-based derivative tokens can in themselves be used as oracles
• Challenge: Event-based derivatives still require external information to tell the
outcome
On-chain asset management
• Assets locked in a smart contract and investor receive fund tokens
• Fund tokens represent partial ownership of the fund and investors can observe and withdraw their
funds at any time
• Fund can follow simplified strategies (e.g. trend trading with MAs) or have one or even several funds
mangers
• Fund managers have to follow a predefined ruleset set out in the smart contract:
• Maximum concentration
• Price tolerance
• Maximum # of positions
• User whitelisted/blacklisted assets
• As the smart contract essentially guides the fund managers actions the (setup and auditing) costs are
significantly lowered.
• A 1% ownership would entitle fund token holder to 1% of crypto assets in fund.
• Investors can redeem their investment by returning their fund tokens which the protocol burns. The
protocol sells the underlying attests on an exchange and return the ETH equivalent of the investment.
Opportunities
• Efficiency
• Counterparties: Transactions settled atomically (all or nothing) reducing counterparty risk
• Trust: Lower need for regulators and auditors
• Speed: Token transfers are much faster than those in traditional financial markets
• Transparency
• Activity: Transactions are publicly observable
• Code: Smart contract code can be observed on-chain
• Research: Data availability may increase research opportunities into potential flaws I the system
• Accessibility
• Accessible to virtually anyone around the world
• Discrimination impossible due to lack of identities
• Composability
• As Defi application are all built on the same settlement layer they can “communicate”
• Fund can take decentralized leverage positions and invest through a DEX all on the same chain
Risks
• Smart contract execution
• Bugs in code: Coding errors could enable an attacker to drain the smart
contracts funds. Protocol only as secure as the code.
• Transparency: How transparent are the contracts really if only few people
understand the code?
• Operational security
• Admin keys: Some individuals have private keys that enable them upgrade the
protocol or perform emergency shutdowns. Those keys, if not stored securely,
could be used by an attacker.
• Risk can mitigate this with multisig locks or governance tokens
Risks: Breach of security examples
• Network attack
• Eclipse attack: Cut the user off from the rest of the network
• Denial of service (DOS) attack: Shutting down the network by flooding it with traffic
• Consensus attack
• 51% attack: Taking control of more than 50 percent of the voting power
• Double spending attack: Reversing a (an already spent) cryptocurrency transaction
• Selfish mining: Miners ganging up and creating a fork in the blockchain
• Smart contract code bug
• Reentrancy: For example in the DAO attack a technicality in the protocol let attackers spend more ether than they were
eligible for.
• Defi protocol composability attacks
• Arbitrage attacks
• Oracle attacks: The oracle is the information source, attack that and the network receives incorrect information.
• Bridge attacks
• Governance attacks
Risks
• Dependencies
• Domino effect: If several smart contracts are dependent on each other then a problem
in one will affect others.
• ETH problems: Many smart contracts are dependent on Ethereum’s native token.
• External data:
• The oracle problem
• Illicit activity
• The anonymous attributes of Defi protocols opens up for illicit opportunities
• Scalability:
• Ethereum struggles to keep up with demand evident by increasing gas fees and latency
• Scalability tends to undermine composability

You might also like