Blockchain v2 Flashcards
Q: What is the role of smart contracts in DeFi?
Smart contracts automate and enforce the terms and conditions of transactions in a decentralized manner.
Q: What is an algorithmic stablecoin? Also, provide an example
• Maintain stable value by utilizing algorithms to regulate supply and demand.
• Unlike volatile Bitcoin and Ethereum
Example:
If price of coin is above $1, algorithm will increase the supply. New tokens created that dilute the value and bring the price down
Q: What is a Peg?
• Fixed Exchange Rates between two assets
• Different to “floating currencies”
• Stablecoins
Q: What is the purpose of Hashing and Encryption?
a) Hashing: Validate Information (uniqueness)
b) Encryption: Protect sensitive information
Q: What is Hashing?
Hashing: Validate information
Unique identifier for the transaction data. Each transaction has its own. When the block is added to the blockchain, the hash value of the previous block is also included in the new block’s data. This creates a chain of blocks where each block’s hash value is dependent on the data of the previous block.
• One-way: the code will not be reversed but stored in the chain
Q: How are hash functions designed?
Hash functions are designed to be one-way, meaning it is computationally infeasible to derive the original input from its hash.
Q: How does hashing ensure data integrity?
Hashing ensures data integrity by allowing quick and efficient verification of whether the data has been tampered with. Even a small change in the input data will result in a completely different hash value.
Whats meant by hashing beeing one-way?
When it is said that hash functions are designed to be one-way, it means that it is extremely difficult, computationally speaking, to reverse the process and determine the original input from its hash value. In other words, given the output (the hash), it is nearly impossible to figure out what the original data or message was. This property ensures the security and integrity of the hash function, making it suitable for tasks like password storage and data verification.
Q: How to create a valid digital signature?
- Sender uses private key to encrypt the signature
- The recipient uses the sender’s public key to decrypt the signature (verifies the authenticity)
- Recipient compares decrypted signature with a newly computet hash. If it matches, its good
Q: What is Encryption?
Encryption: Protect information
The practice of encoding information in a way that only someone with a corresponding key can unscramble and read it.
• Two-way: When you encrypt something, you’re doing so with the intention of decrypting it later.
Q: Explain the encryption process for signatures
- Sender uses private key to encrypt the signature
- The recipient uses the sender’s public key to decrypt the signature (verifies the authenticity)
- Recipient compares decrypted signature with a newly computed hash. If it matches, its good
Q: Similarities between hashing and encryption?
Both transform or change data into a different format.
Q: Differences between hashing and encryption?
Hashing and Encryption have different functions. Encryption is a two-way process that includes encryption and decryption while hashing is a one-way process that changes data into the message digest which is irreversible.
Q: What is the “double spending problem”?
The risk that someone could fraudulently spend the same digital currency unit multiple times.
How can blockchain be the solution to the “double spending problem”, and why? (easy answer)
Public Ledger that records all transactions
Q: What is the solution to the “double spending problem”, and why? (easy answer)
- Public ledger:
Blockchain prevents double spending by securely recording every transaction in a public ledger. - Consensus mechanisms (PoW/PoS):
With consensus mechanisms, blockchain ensures that all nodes agree on transactions
What is the solution to the “double spending problem”, and why? (hard answer)
- Decentralized Public Ledger:
Each transaction is recorded on a public ledger. This way, any double-spending attempt can be quickly identified and rejected. - Consensus mechanisms (PoW/PoS):
Computers must agree on a single version of transaction history If users try to double spend, the network will reject it because it contradicts with the agrees-upon transaction history. - Imutability:
Once a block is confirmed and added to the blockchain, it cannot be altered.
Why do miners have incentive to do mining?
- Block rewards:
When a miner solves a complex mathematical puzzle and adds a new block of transactions to the blockchain, they receive a certain number of newly minted cryptocurrency (like Bitcoin). This is called the block reward. - Transaction Fees:
Each transaction in the block includes a small fee. The miner who adds the block to the blockchain gets to keep these fees. So, the more transactions a miner validates and adds to the blockchain, the more fees they earn.
Q: Is there inflation of Bitcoin?
The powerpoint says this: “No, the issuance has a limit”, but:
Yes, there is. But it is different from traditional currencies. Bitcoin inflation refers to the increase in the number of Bitcoins in circulation.
Q: How does the Bitcoin inflation change over the years?
In the case of Bitcoin, the inflation rate decreases over time due to the “halving” events that occur approximately every four years. During each halving, the block reward for miners, which is the newly minted Bitcoins they receive as a reward for mining a new block, is cut in half. This reduction in the block reward reduces the rate at which new Bitcoins are created and introduced into circulation.
With each halving, the supply of new Bitcoins entering the market decreases, leading to a lower rate of inflation. This diminishing inflation rate, coupled with the limited supply of 21 million Bitcoins, contributes to the perception of Bitcoin as a deflationary currency. It suggests that over time, the purchasing power of Bitcoin may increase, making each Bitcoin potentially more valuable.
Q: When will Bitcoin mining end?
until all 21 million Bitcoins are mined, around the year 2140.
Explain the transaction fee rewards for miners
|Transaction Fee Rewards:
When users send Bitcoin transactions, they include a transaction fee. This fee is determined by market forces and can be set by the users themselves. Miners prioritize transactions with higher fees because they can include those transactions in the limited space available in each block. By including transactions with higher fees, miners can maximize their profits.
Q: What is the complete role of miners?
- Maintain the blockchain
Miners validate new transactions and record them on public ledger - Verify transactions
Miners check the digital signatures associated with each transaction - Compete in mining
Proof-of-Work: Miners compete in finding a nonce (number only used once) to generate hashes - Adding New Block to the Blockchain:
The miner who solves the puzzle first gets to add the new block to the blockchain.
Q: What is a nonce?
The nonce is a random number used in the mining process to solve the proof-of-work puzzle. Miners repeatedly change the nonce value until they find a hash that meets the required difficulty level.
Q: What is the average size of a block, and how many separate transactions does it contain?
On average 1MB in size. Generally contains around 2,500 (max 4000) separate transactions.
Q: What happens if two blocks are creates simultaneously?
- Fork:
Sometimes mines solves the puzzle and create a new block at the same time. This results in two version of the blockchain that are identical except for the last block. This situation is known as a fork. - The Longest Chain Rule:
To resolve this fork, the blockchain network follows a rule called “the longest chain rule.”
This rule states that the valid blockchain is the one with the most blocks (most Proof-of-Work). So, whichever of the two competing blocks gets another block added to it first becomes part of the longest chain and is accepted as the valid blockchain. The block from the shorter chain is discarded.
Other, simple:
“The longest chain rule.” – Miners continue to mine on top of block A and B. If the next block is mined on top of A, B becomes discarded.
Q: How many blocks are generally recommended for security?
In Bitcoin, 100 additional blocks to be built on top of a particular block in the chain.
Q: What are consensus mechanism in blockchain, in general? (dont explain PoW and PoS)
Rules/Protocols in how all computers (nodes) in a blockchain agree about what transactions are valid
There are two commonly used consensus mechanisms:
- Proof of Work (PoW)
- Proof of Stake (PoS)
Explain Proof of Work
A consensus mechanism used by cryptocurrencies like Bitcoin. Miners compete to solve complex cryptographic problems, and the first to solve the problem gets to add a new block to the blockchain.
Explain Proof-of-Stake
Validators selected randomly to confirm transactions and validate block information.
To become a validator, a coin owner must “stake” a specific amount of coins. (Ethereum requires 32 ETH, around 2000 dollars)
Blocks get validated by multiple validators, and when a specific number of validators verify that the block is accurate, it is finalized and closed.