Finance has existed for as long as civilization. And like most things before the Internet age was based on the trust of centralized law and authority (like banks and governments). Decentralized Finance (DeFi) is the movement that asks could we perform our financial transaction with out centralized trust. Finance has evolved many instruments to meet the needs of civilization, all of which are based on trust (store of value, currency, loans), de-fi will search for equivalences of each of these.
- The jobs of finance
- Representing and storing value
- Fungible Entities - Sheep
- Non Fungible Entities - The Shaman’s crown
- Exchanging value - Markets
- Liquidity - When is the market open, and who is there?
- Compensating Risk - Interest
- Capitalizing an entity - Rent
- Insurance - Paying to redue risk
- Hedging - Derrivatives
- Speculations - Derrivatives
- Market Makers -
- Auctions -
- Loans with collatoral -
- Loans w/o collatoral -
- Market Makers -
- Speculations - Derrivatives
- Market Makers -
- Auctions -
- From TradFi to DeFi
- DeFi 101
- Ethereum and Smart Contracts
- Building your own contracts
- Risks
- Defi - “Nations”. Laws, Governance and Monetary Policy
- Policy Questions
- To be categorized
The jobs of finance
I spent some time thinking about finance. I’m guessig there’s some truth here, but a finance guy would probably help me get a better grip on it.
Representing and storing value
Fungible Entities - Sheep
Non Fungible Entities - The Shaman’s crown
Exchanging value - Markets
Liquidity - When is the market open, and who is there?
Compensating Risk - Interest
Capitalizing an entity - Rent
Insurance - Paying to redue risk
Hedging - Derrivatives
Speculations - Derrivatives
Market Makers -
Auctions -
Loans with collatoral -
Loans w/o collatoral -
Market Makers -
Speculations - Derrivatives
Market Makers -
Auctions -
From TradFi to DeFi
Representing and storing value | Traditional Instrument | DeFi Instrument |
---|---|---|
Representing and storing value | Concept | Concept |
Fungible Entities | Sheep | Bitcoin/ ERC20 |
Non Fungible Entities - The Shaman’s crown | Shaman’s Crown | ERC721 |
Exchanging value - Markets | Concept | Concept |
Markets - Order Book | NASDAQ | |
Liquidity | When is the market open, and who is there? | Uniswap |
Compensating Risk | Interest | |
Compensating For use of an entity | Rent | Rent |
Hedging | Derrivatives | dx/dy |
Speculation | Derrivatives | dx/dy |
Loans w/Collatoratal | Mortgage | BlockFi |
Loans w/o Collatoral | Bookie; Mafia (bodily harm is collatoral) | Flashloans ERC 3156 |
Reducing Risk | Insurance |
DeFi 101
Store Of value - Bitcoin
Currency - ERC20
Identity
The ledger for store of value
Imagine we’re a parent of young kids Alice and Bob. Instead of giving them cash you keep track of how much money they have on a piece of paper. That piece of paper is a ledger so:
At the start of time Alice has 100$
- T0: Initialize: 100$ to Alice
Now Bob does the dishes for Alice, and she gives him 20$
- T1: Alice gives 20$ to BOB
At this point if we look at the ledger we know Alice has 80$ and Bob has 20$
What is the actual trust model here?
Easy to say we don’t trust anyone, but we must trust something. Here is our requirements to have a trust worthy system.
Lets start with the bitcoin model which is easier:
- There is one public ledger and it is the source of truth.
- The ledger can only be updated with valid transactions
- Valid transactions imply the sender and receiver both both consent to the transaction.
Ethereum and Smart Contracts
More then a ledger
Transaction costs
Ethereum Virtual Machine
Smart Contracts, DAPPS
Smart Contrats, DAPPS
Fungible Tokens ERC20
Non Fungible Tokens ER721
Interacting with off chain state
Oracles to keep offstate on state
Building your own contracts
Tool chains
Poly - the default language
The default language
Vyper - the simpler programming language for python programmers
Ganache - a personal etherium ledger and VM
https://www.trufflesuite.com/ganache
Risks
Speculatave Bubble- The Tulip Bubble
No one wants to miss a chance for a quick buck, and back in 1637 the quick buck was to be had by investing in Tulips *Many individuals suddenly became rich. A golden bait hung temptingly out before the people, and, one after the other, they rushed to the tulip marts, like flies around a honey-pot. Every one imagined that the passion for tulips would last for ever, and that the wealthy from every part of the world would send to Holland, and pay whatever prices were asked for them. The riches of Europe would be concentrated on the shores of the Zuyder Zee, and poverty banished from the favoured clime of Holland. Nobles, citizens, farmers, mechanics, seamen, footmen, maidservants, even chimney sweeps and old clotheswomen, dabbled in tulips.
People were purchasing bulbs at higher and higher prices, intending to re-sell them for a profit. Such a scheme could not last unless someone was ultimately willing to pay such high prices and take possession of the bulbs. In February 1637, tulip traders could no longer find new buyers willing to pay increasingly inflated prices for their bulbs. As this realization set in, the demand for tulips collapsed, and prices plummeted—the speculative bubble burst. Some were left holding contracts to purchase tulips at prices now ten times greater than those on the open market, while others found themselves in possession of bulbs now worth a fraction of the price they had paid. Mackay says the Dutch devolved into distressed accusations and recriminations against others in the trade.[13]*
Taking over the chain, the 51% attack
https://www.investopedia.com/terms/1/51-attack.asp
The attackers would be able to prevent new transactions from gaining confirmations, allowing them to halt payments between some or all users. They would also be able to reverse transactions that were completed while they were in control of the network, meaning they could double-spend coins.
Buggy Software - Yam
Great Story around speculation and software bugs
Team decided to create a new currency, Yam, with several good properties. Elastic money supply, community governance, treasury to fund future improvements via stable coin, through money supply code.
- August 1st - Team had an idea for a new smart contract, furious coding
- August 11th - Currency launches
- August 11th - 150M in funding for initial offering
- August 12th - 500M in funding for second round.
- August 12th - Bug found, requiring majority of community to vote on govenrance before 8am
- August 13th 7am - Enough people voted, but found a bug, so the protocol could not be used.
- August 14th - Protocol worthless. Many people got their money out of the protocol, but 25%?? did not?
Buggy software and anonymous helpers
600M was stolen from Poly. What’s fascinating about this attack, is that due to the public ledger nature of the attack the “robbed from”, could ask others to not accept coins from the robbers which they did on twitter But then, a hacker wrote into the ledger a recommendation for the robbers to liquidate their bounty, which worked. The robbers then gave the tipster a 45K tip.
MEV
Miner extractable value (MEV) is a measure to study the profit of a miner (or validator, sequencer, or other privileged protocol actor) can make through their ability to arbitrarily include, exclude, or re-order transactions from the blocks they produce. MEV includes both ‘conventional’ profits from transaction fees and block rewards, and ‘unconventional’ profits from transaction reordering, transaction insertion, and transaction censorship within the block a miner is producing.
Salmonella Attack
https://github.com/Defi-Cartel/salmonella
Sandwich Attack
Cost of consensus - Proof of Work
Cost of consensus - Proof of Stake
You “vouch” for valid transaction getting paid if they are valid, and losing your money if you attest to invalid transactions. Way less computing power required.
https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/
Unlike proof-of-work, validators don’t need to use significant amounts of computational power because they’re selected at random and aren’t competing. They don’t need to mine blocks, they just need to create blocks when chosen and validate proposed blocks when they’re not. This validation is known as attesting. You can think of attesting as saying “this block looks good to me”. Validators get rewards for proposing new blocks and for attesting to ones they’ve seen.
If you attest to malicious blocks, you lose your stake.
Defi - “Nations”. Laws, Governance and Monetary Policy
Arguably, the different blockchains are the equivalent of major entities, with their own sets of laws (though laws enforced by computer programs), governance and monetary policy.
For example:
Nation | Capabilities | Montery Policy | Governance | Proof Of Work |
---|---|---|---|---|
BitCoin | Ledger | |||
Etherium | Virtual Machine - Solidatary | |||
Etherium 2.0 | Virtual Machine | |||
Polygon | ||||
Chia | VirtualMachine ChiaLisp |
Capabilities
Foreign Exchanges
Monetary Policy
Governance
Poof of Work
Within each of these “Defi Nations” there are different currencies and Defi Systems, and forieng exchanges
Policy Questions
Within each of these there