04 Blockchains and Cryptocurrencies Flashcards
What is a BLockchain?
A blockchain is a ledger or list where the entitties are grouped in blocks that are cryptographically linked
* blocks are timestamped and cannot be altered once included in the chain
High level distinguish between four differetent types of tokens?
- Cryptocurrencies/ payment tokens
- Utility tokens
- Security tokens and tokenized assets
- Non-fungible tokens
What do cryptocurrencies promise?
- secure and immutable transaction
- increases in efficiency
- reduction in cost (no intermediation)
- no trust in particular authority
- financial inclusion due to lower costs and decentralization
What are the main functions of money? and fullfilled by cryptocurrencies?
- Unit of account
- Medium of exchange
- Store of value
–>No decentralized money:
* volatility is high
* acceptance is low
The two generations of blockchains/cryptocurrenices
1. Generation cryptocurrencies: Payments and store of value
2. Generation: Platform/ distributed computation tokens
What is a Stablecoin?
is a cryptocurrency where the price is linked to some other asset such as fieat currencies or a commodity
Characteristics of stable coins
- low volatility compared to other cryptocurrencies
- provide quick and relativeley safe way of entering into cryptocurrencies
- less regulation than the asset they are pegged to
- some allow for smart contracts
What is Central bank digital currencies? (CBDCs)
–>a virtuel currency representing a direct liability of a central bank, similar to banknotes and coins
The two types of Central Bank digital currencies?
- Wholesale CBDC –>used among financial intermediaries
- Retail CBDC –>used in the wider economy
What are utility tokens?
Utility tokens offer the right to a service or product
* have value and can typically be used similarly to cryptocurrencies
* some act as internal currencies for payments on a blockchain (E.g. ether)
Wider functionality of utility tokens?
- some utility tokens are “consumed” in exchange for products or services, comparable for voucher or gift gards
- othery only have to be held, for example offering voting rights
Ex:
* Golem (GNT) for renting computing power
* Filecoin (FIL) for renting storage space
* Exchange tokens like Binance coin (BNB)
What are security tokens/ tokenized assets?
Security tokesn represent blockchain-based recorded ownerships of other assets (Stocks, bonds and real estate)
–>derive value from an external asset
What are the benefits of tokenization for tradeing?
Beneifts: Allow for fractional ownership
- Equitites:
- Real Estate
* Trading costs and other fictions may be lowerr for tokenized assets
* tokenization is typically not decentralized
–>a company ususally owns the underlying asset
- The price is pegged by allowing token holders to exchange their tokens for the underlying asset
What are tokenized assets?
Tokenization of (existing) assets provides a way of recording the ownership of other types of assets on a blockchain
How can security tokens be issued?
Can be issued via decentralized ICO, but may also be issued in a more centralized way by a company
- A security token offering (STO) may be less expensive for smaller ventures as compared to an IPO
Market for security tokens and their regulation?
–>Security tokens are usually subject to the same regulation as the underlying asset
–>Market is still relatively small, but potentially impacts the way trading is organized
Benefits using security tokens for trading?
- transaction allows for fractional ownership
- Blockchain transactions are transparent
- settlement of trade substantially faster
- secondary market liquidity may (or may not) benefit
- transactions cost may be lower than on conventional exchanges
What are non-fungible tokens?
Non-fungible tokens are not interchangeable
–>usually represent digital artwork and collectibles, where the ownership is recorded on a blockchain
What is a cryptographic hash function?
= a cryptographic hash function maps an input x of any length to an output Hash(x) of fixed length
What do the two properties Deterministic, Efficient mean for Hash Functions?
Deterministic: The same input x will always give the same output
Efficient: GIven x, calculating Hash(x) is computationally easy
What do the two properties One-way, collusion resistant mean for Hash Functions?
One-way: GIven Hash(x), calculating x is computationally infeasible
Collision resistant: Finding two inputs x and y that give the same output Hash(x)=Hash(y) is infeasible
What do the two properties Avalanche-effect and Puzzle friendly mean for Hash Functions?
Avalanche-Effect: Changing x slightly changes the Output Hash(X) substantially
Puzzle Friendly: GIven Hash(x) and part of x, it is still difficult to find the rest of x
Key properties of Hash functions
- deterministic
- efficienct
- oneway
- collision resistant
- avalance effect
- puzzle friendly
What are Merkle trees and Merkle roots?
Merkle trees: are trees containing hashes of hases
–>The top has of a merkle tree is called the Merkle root
What is cryptohraphy and security?
Cryptographcy used for secure communication:
* prevent third parties from reading and manipulation private messages
asymmetric (or public key) cryptography uses pairs of key:
Difference between public and private key?
Private key: is basically just a random number that is only known by the owner
Public key: is mathematically linked to private key and is known by others
–>easy to get public from private key, but not vice versa
use cases of asymmetric cryptography?
- encryption of messages with the public key, that only can be decrypted by the private key
- generation of message-specific digital signatures
–>protect against tampering and impersonation
Types of blockchains?
Public or private:
public: everyone can read, view participate by writing, and validating
private: only read after approval or some verification
Permissionless or permissioned:
permissionless: no access contral, trust-free, usually slower
permissioned: validating and wirting to the chain requires approval, usually faster, trusted authority required
Two problems that needed to be addressed by decentralized currencies?
- Only alice should be allowed to spend her coins
- the “Double spending problem”
What is the solution to Problem 1: (Only alice spend her coins?
Asymmetric Cryptography:
* all transaction are cryptographically signed by private key of that individual
* everyone can verify the signature by the public key
*
What is the solution to Problem 1: (Only alice spend her coins?
–>what are keys and addresses?
- Private keys are basically long random numbers
- Public key is easy to compute from the private key
–>Addresses are easy to compute from the public key (for bitcoin, the public key is hashed twice, and a chechsum is added)
What is the solution to Problem 2: Double spending problem
Consensus Mechanism:
–>there are different consensus mechanisms to get an agreeement on what the correct version of the ledger is
–>if temporarilty conflicting versions, in the long-run the longest version is chosen
Describition of PoW
–>including transaction on the ledger requires computational effort and thus is costly
* Miners solve cryptographic puzzle to maintain the ledger
* These puzzles consists of finding a nounce–>this is a special number that results in a hash of that block with a particular pattern
POW: What is a Nounce
Nounce= a special number that when added to the block results in the hash of that block
POW: NOunce characteristics
- the hash has to start with a certain number of zeros that depends on the difficulty of the network
—>This difficult level is adjusted automaticaöy every 2016 blocks to keep the average time between two blocks at about 10 minutes
–>finding the correct nounce is done by try and error
What is done after finding the Correct Nounce?
PoW
–>The miner broadcasts the solution to the network
* it appends the block of transatiom, including the nounce, to the ledger
* The other miners (nodes) can verify the nounce results in a correct hash is computationally easy
Describe the 51% Attack in context of blockchains bitcoin with PoW
The blocks are all cryptographically linked by including the hash of the previous block in the new block
* to make changes or minor modifications to a previous block would require to re-do all the work starting with that block
–>this can in the long run only happend if the person controls 51% of the computational power of the network
What are the two mining incentives?
-
Block rewards through newly generated coins
* successful miners receives bitcoins these reward halves rougly every four years
* in about 2140 the reward is expected to be zero -
Transaction fees from users
* capacity in each block is limited —>users can optinally pay a fee to minizers to incentivize them to include their transaction in a block
–>During times of blockchain congestion, the fees can reach very high levels
What is included in the Block header?
The Block header contains:
* Bitcoin protocol number
* CUrrent difficult level
* Timestamp
* previous block header hash
* Merkle root hash of hased transactions
* Nounce
What is Unspent Transaction Output
Nodes track unspent transaction output (UTXO)
* the bitcoin transactions list input and output addresses
–>UTXO is the output of a transaction and exists until it is used as input for another transaction
–>How many UTXTO´s reside in a given address is computed by counting all prior UXTOs that list this address as their destination
Explaing the unspent transaction output
Works like a wallet, if one has 50 BTC, 1- 30 BTC and 1-20 BTC and wants to send 35 btc
–>Will use both addresses (30 BTC and 20 BTC) and send that to the other addresses, additionally there will be a new “change address” created where the remaining “Unspent transsaction outpu” go in (30+20 - 35) = 15 BTC
What is a Mempool?
New transactions are broadcasted to the whole network, the ones that are valid wait to be included in a block
–>These waiting transactions (confiremed) are stored in the mempool
What does the Mempool mean for the transaction within?
Everyone can see the transactions in the mempool:
* Trading intentions might be revealed
* Front running poses a serious problem —> insider trading
what does the Hashrate meansure?
The Hashrate measure the computing power within the Bitcoin network
* the total network hashrate has increased tremendously
–>The mining difficulty adjust automatically, but what matters for miners is their relative share of computating power
why were Mining pools created in the first place?
For an individual miner it is extremely unlikely to get the block reward
–>Thus to get a more stable stream of income, miners join in mining pools
–>Each members of a pool contribute computational power
How is reward in mining pools distributed?
- the rewards are typically distributed according to member´s contributed hashrate
- pool operators keeps a small percentage to cover administrative costs
–>relatively few mining pools represent a large part of overall Bitcoin mining, raising concerns about centralization
PoW Externalitites
–>electricity is the main input for PoW mining, thus miners tend to be located in areas with cheap energy
- uses vast amounts of energy
- energy market spillover effects to local businesses and households
- Bitcoin could have a considerable impact on the climate
–>a lot of the engery comes from gray energy
Ethereum platform short describtion (provides…
Ethereum network proved a base layer computation platform based on a programmable blockchains
–>used for
- executing smart contracts
- runing decentralized applications (dApps)
Ethereum Governance and difference to Bitcoin? conserning changes?
Much more so than Bitcoin, the Ethereum protocol is subject to changes
e.g:
- changes to how fees, difficulty, or block rewards are calculated
- increasing scalability, privacy, efficiency, and flexibility
- switich to different consensus mechanism
How are changes in the Ethereum like protocol implemented?
Changes are usually implemented via a “hard fork”
Hard fork and soft fork
hard fork: a new blockchain unsing the updated protocol, where miners pick the chain they want to continue by appending to that chain
soft fork: is a forward-compatible change to the rules.
–>It doesn’t create a new blockchain. Instead, it maintains the old blockchain by running on two lanes with different sets of rules.
How does the governance model of Ethereum work?
- Users suggest changes to ethereum using off-chain channels of Ethereum Improvement Proposals (EIP) and Ethereum Requests for Comment (ERC)
- EIP´s are discussed (particulary among core developers)) and then suggested for adoption via a fork or dropped
Critism in the governance model of Ethereum
- Some critize the governenance model as being too centralized and dependent on a core team of developers and the founder Vitalik Buterin
Which tracking method for accounts and balance does Ethereum use?
Etereum uses an account-based model that tracks the balance of each account (as part of the “global state”)
Advantages of the ACcount-based model over UTXO
- The account based model may be more intutive thant UTXO
- need to keep track of order of transaction from an account (every transaction has a number)
- UTXO may offer more privacy
- Obtaining the current state of the nework is easier for “liegt” clients/nodes in an account-based model
Account types in the Ethereum network
There are two types of accounts:
1. Externally owned accounts (EOAs)
2. Contract accounts
–>All accounts can eqully access and interact with the Ethereum network
What does each Account in the Ethereum network have?
- unique, crpytopgrahic address
- nounce
- Current ether balance
- Contract code
- Data storage
What are External owned accounts?
Controlled by (human) end users that have access to the private key for sending transactions
* have a balance and can send transactions
* do not have associated code
What are contract accounts?
=Completely controlled by associated code that can contain pretty much any type of calculation.
–>once set up the code itself cannot change
* Contract account have a balance and can transfer ether (or other tokens)
How is a execution of the code in a contract account triggered?
Only trigged by transactions from EOAs or from other contract accounts
* contacts do not just run in the background
* everything that is happening in the network is always set in motin by EOAs
How are Transactions between contact accounts called?
They are called “internal transactions or “messages” and will not be permantly put on the blockchain
How does Ethereum prevent a programm from running to long on the blockchain?
–>Put a price tag on computing resources
* Chrage a fee called gas for using the network
* Transactions have to include the amount of gas and the price the sender is willing to spend on executing the transaction.
Gas prices typically expressed in gwei
Transaction execution and gas?
As the transaction is excetued, gas is used for every computational step
- unspent gas is retunred to the sender
- if exection not finished an gas is not enough, everything is reversed and gas is sent back
What are the functionalities of Contract accounts?
- Transfer funds
- Create new digital tokens
- Exchange different tokens (as in decentralized exchanges)
- Trigger code from other contract accounts
- Construct derivatives with automated payouts
Are these smart contacts smart?
These “smart contracts” are permanently kept on the blockchain
–>They are not really smart and not necessarily a (legal) contract
–>more like a vending machine
–>Code is law
What is the main use of smart contracts?
The main use of smart contracts is the creation of new tokens, many of whcih are utility tokens
–>Ethereum contains several standards for new tokens that use the Ethereum blockchain
–>ERC-20 for fungible tokens
–>ERC-721 for non-fungible tokens
–>ERC-1400 for security tokens
FtHow doe Initial coin offerings work?
Investors buy into the offering and in return get new tokens, for example
- Utility tokens that have some use in using the product of the company
- the internal cryptocurrency of the venture
Different to IPOs; ICOs are mostly unregulated
What is Initial Coin Offerings?
ICOs are a new type of crowdfunding, combining aspects of fundraisng with platform building and network growing
What can change the global state ? (Blanace, data,…)
Ethereum
only transsactions can change the global state
* transfer ether between EOAs
* Change contract data by triggering contract accounts
* Initialize contract accounts
What are decentralized applications?
dApps are computer programs that run on a distributed, decentralized network like the Ethereum blockchains
Characteristics of dApps?
Most dApps run on Ethereum
* Smart contracts are the building blocks of dApps
* user interfaces are often similar to other cloud apps
–>Code and data are stored on the blockchain
–>dApps are generally not owned by anyone (though the correspsonding utility tokens are) –>Trust?
Advantages and Disadvantages of dApps?
- dApps cannot be shut down,
- have no downtime and
- are censorship resistant
Contra:
* can be extremely slow
* user experience may (yet) be poor
Proof-of-stake Mechanism
- No mining, randomly chosen validators update the blockchain
- validators are user that deposit some coins at stake
- The stake is typically locked up for some time and cannot be used for transactions
- The probability of being drawn increases in the amount deposited as stake
–>Chosen validators then verify the transactions in the block and update the chain
How are Validators incentivized?
PoS
–>Validators are incentivzed positively and negatively
* As a reward, they typically get newly minded coins and transaction fees
* They can loose their stake if they are dishonest
What is the “Nothing at stake” Problem in PoS?
PoS
suppose there is a fork (two versions of the chain)
* in theory validators have an incentive to keep signing blocks on both versions of the blockchian because they collect fees and newly minted coins on whichever fork eventually ends up winning
–>In PoW this is not possible because you have to spend computing power
What does the “long range attacks mean in the context of PoS?
–>to perform a 51% attack in PoW, you need to manipulate a block of the recent past
–>In PoS theoretically you could stat such an attack much earlier, even at the Genesis block.
–>One solution: always reject forks that differ before some “checkpont”
Was is the Double spend —> Nothing at stake problem?
PoS
The double spender could for example only validate blocks on the fraudulent version, which then would be the longest chain
How transparent are Blockchains?
- Most cryptocurrencies are pseudonymous
Require unique address, and use private keys - Data on blockchain is usually totally transparent
All transactions are recorded - Users prefer less transparency
–>Two approaches:- Privacy coins
- Mixers
How does the Lightning Network work=
THe Transaction between the two parties change the balance of the payment channel.
–>THe updated balance is signed by btoh parties using their private keys.
–>No transaction is recorded on the main blockchain
- Eventually the payment channel is closed and the net is broadcasted to the main network
- –>Which results in another single transaction of the main blockchain
What is a Lightning Network?
Is a off-chain solution for smaller payments
* First there is a payment channel opened between two parties by recording a transaction on the main blockchain
Payment channel: is a multi-signature address using both parties keys keeping track of each parties respective balance
Example of zero knowledge proof? (red and blue pills)
One firend A is blind and cannot differentiate between red and blue
–>How can you prove to him that the two are different without telling him which one has what colour?
- you let him change the pills hand behind his back and then tell him wheteher he changed it or not.
- Since you can see the color you can prove to him that they are different withoiut telling him
What is zero knowledge proofs in the context of privacy coins?
How can we make sure that only Alice can get to spend her coins?
–>Use zero knowledge proofs
- proof a secret to another party without letting anyone know what the secret is
What are privacy coins?
Alternative to cryptocurrencies that allow for completely anonymous transactions
Advantages and Disadvantages of PoS
Advantages:
* verly low energy demand
* scalability isoftentimes better (and more faster transactions)
* no expensive, specialized, soon-to-be redundant equipment needed
Disadvantages:
* Not robust 51% attacks, instead need 51% of stake, However when other find out the Stake would be worthless probably
* There are and have to be still costs for validatos –>Oppotunity cost of locking away the stake
* Liduidity may be reduced due to locked-stake
* not withstood the test of time for as long as PoW
Some issue with stablecoins?
- Some are very intransparent regarding their services
- Stablecoins pegged to other currencies are fully influenced by their monetary policy
- Regulation (collaterialized stablecoins, may suddenly have to buy or sell alrge amount of collateral, potentially impacting traditional financial markets
- Depending on the mechanism, stablecoins can be centralized
(in sace of fiat and commodity-backed: someone has to hold the reserve somewhere - they might not be as stable as they claim
Two basic types of backing mechanisms? Stablecoins
- Collateralized stablecoins
- Algorithmic stablecoins
Short description of Collateralized stablecoins?
they hold some other asset in reserve
->This asset can be the same asset as the stablecoin is pegged to
Collateralized stablecoins
Describtion between pegged and reserve asset
Peg = reservce –> a mechanism allows investors to direclty exchange the stablecoin for the reserve asset in 1:1 ratio
Peg =/ reserve –> the reserve asset hat to be bought and sold to meet the demans of investors wanting to exchange
- these stablecoins then need to be overcollaterialized, especially for volatile reserve assets
- reserve assets have to be sufficiently liquid
Algorithmic Stablecoins short descrioption
Versions of stablecoins
are not backed by any other asset
* rely on automated algorithms via smart contracts to adjust the value of the coin by increasing or decreasing supply
–>These share of each user stays constant during the adjustments, but the total suplly changes
What are wallets?
Wallets are tools to create and store the keys and addresses
* create a seed phrase of typically 12 or more words used to set up and access the wallet
* From this one seed, infinite number of addresses can be generated
–>all can be accessed and backup by the single seed phrase
What do Mixers do?
Mier pool together funds from multiple sources over some time and then split them acoss multiple addresses at random times
–>They are used to obscure fund flows and to increase anonymity
* can be intermediate mixing steps of pooling and distributing
* operators keep a small fee
* are frequently used for criminal activity
What kin of Wallets exist?
Hot Wallets: are connected to the internet and readily available for trading
Cold Wallets: are offllince and suited for long-term storage of funds
Name the two types of exchanges?
Centralized exhanges: operate similar to exchanges of other finanical assets
Decentralized exchanges: are new to cryptocurrencies
–>Transaction on the blokcchian can be used to transfer funds of the same currency between parties.
Explain LImit Order Book Trading (Centralized Exchanges)
–>centralized exchanges typically iperates a central limit order book:
* Traders can submit limit and market orders
* The matching enging then matches buy and sell orders
What do users need for centralized exchange?
–>to trade the users need an account at the exchange
* all funds are kept in the exchange´s own wallet, from the blockchain´s perspective the coins are still owned by the exchange
* Only deposits and withdrawals of cryptocurrencies are recorded on the blockchain, and actually moves coins to other addresses
–>simplifies the process, increases speed, and reduces blockchain congestion and fees
Things to conisder with centralized exchanges?
- are convenient and fast, but introduce a single point of failure and require trust in the exchange
- severall centralized exchanges allow user to buy cryptocurrnecies with fiat currency (contracy to decentralized exchanges)
- several have been shown to report fake volumne to appear more trustworthy
Short Description of decenteralized exchanges
decentralized exchanges (DEX) is a type of on-blockchain exchange that does not require an intermediary but instead relies on smart contracts
Description of Constant Product Market Making (CPMM)?
Deecentralized Exchanges
= trading takes place in liquidity pools where two tokens can be exchanged with each other
* Liquidity provider (LP) add both tokens to the pool in the same ration as tokens are already in the pool
* in return, LP´s receive liquidity tokens that reflect the LP´s share in the pool and can be exchanged for both coins in their share
How does a trade exchanges Tokens in CPMM?
Traders wanting to exchange tokens, deposit one token in the pool and receive the other token in return
–>The price is implied by the current raio of the two tokens in the pool
- LP´s are rewarded by receiving transaction fees
What types of Loans exists in Lending markets for cryptocurrencies?
- Collateralized Loans
- Flash Loans
Describe Collaterialized Loans
–>Similar to bank loans
* Typical application would be to borrow a given amount in a stablecoin and put up another cryptocurrency as collateral
–>Since cryptos are so volatile, the loans have to be overcollateralized
describe Flash loans?
Flash Loans are uncollateralized DeFi Loans
* Funds are borrowed, used, and returned within the same transaction via smart contracts
* If the loan is not repaid within the same transaction, the whole transation is reversed
–>Liquidity is provided via pools similar to DEX (with one token)
—>Flas loans are used for exploiting arbitragre opportunitites or attacking dApps
Describe CBDC?
= DB digital currencies represent a claim on a central bank
What are Retail CBDC?
Retail CBDC is accessible to everyone
* Single-tier retail CBDC: CB directly handles retail payments
* Two-tier CBDC (hybrid or intermediated): Intermediaries handle retail payments
What are whole-sale CBDC?
In Wholesale CBDB, only a few isntitutions have access and use it for settlement
What types of CBDC are there?
Token-based CBDC: are anonymous, may use blockchains (not open or public), and are closer to cryptocurrencies (and pyhsical cash)
Account-based CBDC: users are identifiable and have an account with the CB
Pros of Central Bankd Digital Currencies (CBDC)?
Pros:
* provide new and better ways to implement monetary policy
* can be used for efficient fiscal transfers
* faciliate improved anti money laundering processes
* might be attractive and competitive with other payment systems
* Default risk of CBs is practically zero
* might make cross-border payments more efficient
* Retail implementations decrease the need for commercial bank intermediation
Cons of Central Bankd Digital Currencies (CBDC)?
Cons:
*effects on financial stability still not fully understood
* Privacy concerns copared to physical cash and more centralization compared to established banking system
* Security might be an issue if the CB is hacked
* Retail implementations decrease the need for commercial bank intermediation
Further Blockchains Applications?
- Clearing and Settlement (trade)
- Insurance
- Energy markets
- Compliance
- Commerce and Trade
- Logistics and Supply Chain Management
- Healtcare
What is the computing layer within Ethereum?
The computing layer is a virtual machine (EVM), which is a Turing complete machine that can ** execute loops and run** all sorts of programs