Decentralized Finance

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Blockchain

1) Blockchain is a timestamp append only log: an immutable series of blocks.


Each block contains:
 Version
 Block header:
o Previous block hash
o Timestamp
o Merkle root hash (binary tree of hash of transactions)
o Nonce = value miners can alter to create different permutations and generate a correct
hash in the sequence
 Block header hash
 Difficulty target = represents how hard it is for the miners working to solve the block and
consists in a number of leading zeros to be put at the beginning of the hash. It increases with
number of miners in order to keep constant the average time of new blocks to be find and
therefore cryptocurrencies to be awarded

2) Digital signature leverages asymmetric cryptography:


 A private key can be used only by its owner to sign a message
 A public key can be used by anyone to verify the signature of the owner of the private key
It is infeasible (but not impossible) to derive the private key from the public key.
Private and public key are created through a random number generator.
Each transaction is signed through a private key and is decrypted through a Bitcoin address (basically
the public key hashed and compressed)

3) Miners compete in solving a problem and whoever it is the first to solve it, creating a new block,
gets rewarded with a certain amount of cryptocurrency.
The cryptocurrency used by a certain blockchain is its native currency.
Mining pools combines the computational power of a group of miners and split the bitcoins generated
among the participants to smooth revenues (i.e., decrease the volatility of results). Usually mining
pools charge a fee to provide this and other (e.g., providing a Merkle root hash) services.

4) The byzantine generals problem says is a game in which participants win only if everyone takes the
same decision.
Blockchain proof-of-work uses the same logic for requiring consensus: if one single block is changed
the entire chain will “lose”, i.e. identify the error. QUINDI TUTTI VALIDANO O SOLO LA
MAGGIORANZA?
Alternative to Proof-of-Work is proof of stake, which select a group of validators of the transaction
based on the amount of stake they have (since if you have high stake you are not incentivized to hack
the chain) and punish who validate it in the wrong way, decreasing its stake.

5) A transaction requires as inputs:


 the ID of the previous transaction (the first transaction of each block is a coinbase (i.e., the
allocation of freshly minted coins to the miner)
 a signature (created through a private key)
A transaction requires as outputs:
 the value of the transaction
 the bitcoin address (i.e., the hashed and compressed public key) of the receivers of the
transaction. These include also the address of the sender which basically sends to himself all
the coins it owns and have not be sent to someone else on the transaction. The sender can
choose to leave a voluntary incentive fee for validators to validate its transaction before
others’.

Decentralized Finance (DeFi)

1) Stablecoins
Currency with fixed value, obtained stacking cryptocurrency.

The value of stablecoins you receive is lower than the amount of crypocurrency you deposit. The
overcollateral is used to secure potential losses of value of the deposited crypto.
If value of the deposit reaches the value of stablecoins, the position is closed.

Stablecoins are an equivalent of a overcollateralized loans. They provide liquidity to crypto holders,
allowing them to have cash while still being exposed to deposited cryptocurrency (avoiding losing
potential returns in the case the position is closed).

2) Decentralized exchanges (DEXes)


DEXes allow to exchange a crypto for another without passing though central institutions such as
Coinbase.
Automated Market Makers (AMMs) are markets which determine the relative price of different
cryptos based on a function of demand and supply, called “trading rule”. The trading rule used by
Uniswap is a constant product function: x*y = z, where x and y are quantities of two different coins in
the pool.
Price impact of the adding/removing coins from the pool will be:
(x+a)/(y-b), where a = added units of x; b = ay2 / (k+ay) = removed units of b.

AMMs work with liquidity pools: instead of executing orders one by one, all the supply is collected in
a pool. The advantage of that method is that in low liquidity situation there will be no need to wait for
a match between demand and supply.
The AMM does not update this price as other markets move around it. The market price only
moves as the reserve ratio of the tokens in the pool changes, which happens when someone
trades against it. If, for any two cryptos, exchange rate in the pool differs from ratio of traded
prices there is an arbitrage opportunity.
3) Lending market
You can lend crypto earning interest rate (fixed or variable) based on rules of smart
contracts.

Interest income is split among all lenders. Since usually amount borrowed > amount
supplied, interest rate by a borrower > interest received by a lender (which is split among
different lenders)

You might also like