Podcast
Questions and Answers
In the context of DApps, what is the primary role of state management?
In the context of DApps, what is the primary role of state management?
- Optimizing the application's performance on different devices
- Securing the application from external threats
- Controlling the user interface of the application
- Managing the data and the current status of the application (correct)
What is a key characteristic of Distributed Applications (DApps) that distinguishes them from traditional applications?
What is a key characteristic of Distributed Applications (DApps) that distinguishes them from traditional applications?
- They are developed using a single programming language.
- They run on a distributed P2P network rather than a single computer. (correct)
- They have a centralized authority that controls the application's functionality.
- They are not capable of interacting with a frontend web interface.
In the 'money.sol' smart contract example, what would be the expected outcome when the Withdraw()
function is called after depositing 60?
In the 'money.sol' smart contract example, what would be the expected outcome when the Withdraw()
function is called after depositing 60?
- The function will return 60, representing the originally desposited amount.
- The function will return 120, calculated as twice the deposited amount. (correct)
- The function will fail due to insufficient gas.
- The function will return 0, as the withdrawal function is not properly implemented.
Why is it necessary to copy the contract address and ABI for frontend development when working with smart contracts?
Why is it necessary to copy the contract address and ABI for frontend development when working with smart contracts?
What purpose does the Goerli testnet serve in the context of DApp development and deployment?
What purpose does the Goerli testnet serve in the context of DApp development and deployment?
What is the core concept behind IPFS that aims to improve upon HTTP?
What is the core concept behind IPFS that aims to improve upon HTTP?
What is the role of a Distributed Hash Table (DHT) in IPFS?
What is the role of a Distributed Hash Table (DHT) in IPFS?
What is the primary purpose of a Merkle DAG in the context of IPFS?
What is the primary purpose of a Merkle DAG in the context of IPFS?
What is a key advantage of using IPFS over traditional HTTP when accessing files?
What is a key advantage of using IPFS over traditional HTTP when accessing files?
What is the main vision behind the concept of a Decentralized Autonomous Organization (DAO)?
What is the main vision behind the concept of a Decentralized Autonomous Organization (DAO)?
Why was The DAO considered stateless?
Why was The DAO considered stateless?
What critical flaw was exploited in The DAO, leading to a significant loss of funds?
What critical flaw was exploited in The DAO, leading to a significant loss of funds?
What was the primary purpose of the hard fork implemented after The DAO attack?
What was the primary purpose of the hard fork implemented after The DAO attack?
What is the key difference between a hard fork and a soft fork in a blockchain network?
What is the key difference between a hard fork and a soft fork in a blockchain network?
Following The DAO incident, what was one of the key lessons learned regarding smart contracts?
Following The DAO incident, what was one of the key lessons learned regarding smart contracts?
What is the initial step in developing a DApp as described in the lecture?
What is the initial step in developing a DApp as described in the lecture?
What is the purpose behind testing the functionality on Remix IDE during DApp development?
What is the purpose behind testing the functionality on Remix IDE during DApp development?
Why is Metamask Wallet used during the integration and deployment phase of a DApp?
Why is Metamask Wallet used during the integration and deployment phase of a DApp?
In the context of IPFS, what does content addressing ensure?
In the context of IPFS, what does content addressing ensure?
What is the main goal of IPFS in relation to the traditional client-server model of the web?
What is the main goal of IPFS in relation to the traditional client-server model of the web?
Which of the following is a key characteristic of the DAO's original code that contributed to its vulnerability?
Which of the following is a key characteristic of the DAO's original code that contributed to its vulnerability?
What immediate action followed the discovery of the vulnerability in The DAO, primarily driven by the community?
What immediate action followed the discovery of the vulnerability in The DAO, primarily driven by the community?
What fundamental property of blockchain technology was challenged by the hard fork that addressed The DAO incident?
What fundamental property of blockchain technology was challenged by the hard fork that addressed The DAO incident?
How does the IPFS address the issue of broken links associated with HTTP?
How does the IPFS address the issue of broken links associated with HTTP?
Which feature of Smart Contracts allows it to automatically control blockchain transaction and investments?
Which feature of Smart Contracts allows it to automatically control blockchain transaction and investments?
Following the hardfork, which characteristic of blockchain was affected?
Following the hardfork, which characteristic of blockchain was affected?
After a hard fork in July 20, 2016, what event occured?
After a hard fork in July 20, 2016, what event occured?
What is stateless DAO?
What is stateless DAO?
Flashcards
What are Distributed Applications (DApps)?
What are Distributed Applications (DApps)?
Software applications that run on a distributed peer-to-peer network, rather than a single computer.
What is InterPlanetary File System (IPFS)?
What is InterPlanetary File System (IPFS)?
Peer-to-peer distributed file system that stores files and tracks all transactions on the distributed network.
What type of system does IPFS use?
What type of system does IPFS use?
A system where every user in the network holds a portion of the overall data, creating a resilient system for storage and sharing.
What is HTTP?
What is HTTP?
Signup and view all the flashcards
How does IPFS address HTTP problems?
How does IPFS address HTTP problems?
Signup and view all the flashcards
What is content addressing in IPFS?
What is content addressing in IPFS?
Signup and view all the flashcards
What was the purpose of The DAO?
What was the purpose of The DAO?
Signup and view all the flashcards
What caused The DAO attack?
What caused The DAO attack?
Signup and view all the flashcards
What is a Hard Fork?
What is a Hard Fork?
Signup and view all the flashcards
What is a Soft Fork?
What is a Soft Fork?
Signup and view all the flashcards
Study Notes
DApps Lecture Notes
- Distributed applications (DApps) are software applications that run on a distributed P2P network rather than a single computer.
- These interact with a Frontend Web3.
Smart Contract: "money.sol"
- Smart contracts need to be written to implement the functionality of DApps
- To test this functionality, Remix IDE can be used
- Deploy the smart contract
- Transact with the smart contract
- Deposit the required amount
- Check the withdrawn amount
Metamask Wallet
- Metamask wallet can be used to integrate and deploy
- Any test network on Metamask can be used
- The Goerli Testnet (PoA consensus -> PoS with open validators) or Sepolia testnet (a Proof-of-Stake (PoS) testnet with permissioned validators)
- Deploy on the Goerli Testnet using the Metamask account using the deployment tab.
Frontend Development
- To develop the frontend contract address and the ABI are required for separate notepad.
Frontend Development of Smart Contracts
- To load the index.html, a visual studio-like text editor is required.
- Edit the contract address to match in step 4.
- Edit the ABI file to the copied ABI from step 4.
Interacting with Smart contract using frontend
- Go to xampp installation and move the updated index.html file to the htdocs folder.
- Start the xampp web server.
- Open the money smart contract using the Admin button and launch it in the web browser.
- Interact with the smart contract front end with localhost/index.html.
IPFS Introduction
- InterPlanetary File System (IPFS) is a peer-to-peer distributed file system.
- IPFS stores files and tracks all the transactions on the distributed network.
- It's a combinational technology of the version controlling system and P2P network spread over a global namespace.
- IPFS is a single BitTorrent swarm, exchanging objects within one Git repository.
- In contrast to a central storage based file system, IPFS works on a decentralized system.
- Every user in the network holds a portion of the overall data, creating a resilient system for storage and sharing over the globe.
- Any user in the network can share a file which is accessible to everyone by requesting from a node using DHT(Distributed Hash Table)
HTTP issues
- HTTP is a request-response based protocol
- When a web browser sends a request to an external server, the function of the server is to return the request with a response message.
- HTTP faces problems when there is a disruption in the network or when the client can't connect with the server.
- HTTP web is usually full of broken links in the network.
- HTTP with its location-based addressing model encourages centralization.
- The data is becoming siloed on the web.
IPFS Addressing
- Content is addressed by using IPFS instead of HTTP
- IPFS guarantees a permanent and distributed web by incorporating content-addressed system, instead of location-based (used by HTTP).
- IPFS uses a form of representation by integrating a hash on a file, which is taken as the address.
- The hash is a root object, and it provides its path to other objects as well.
- As opposed to requesting a server for data access, you can gain access to this hash, which acts as a starting point of data.
- We can reach the peer who has the content at the hash location, and download the content from the node which holds the data.
- A DHT or Distributed Hash Table is used by IPFS for storing data.
IPFS Components
- Distributed Hash Table
- Merkle DAG
- Version Control System
- Self-certifying File System
Building the DHT
- Discovery: Ask for CID 1
- Peer B has CID 1
- Request CID 1 from Peer B
- Peer B sends Block CID 1
Summarizing IPFS
- Content is accessible through peers, located anywhere, that relay information, store it, or do both.
- IPFS finds what you ask for via its content address.
- Three fundamental IPFS principles:
- Unique identification via content addressing.
- Content linking via directed acyclic graphs (DAGs).
- Content discovery via distributed hash tables (DHTs).
Installing IPFS for Lab
- Can be installed using https://docs.ipfs.tech/install/ipfs-desktop/
DAOs Background
- DAO (Decentralized Autonomous Organization) is an early example of tokenizing ether Purpose is a Venture Capital Fund for blockchain-based investments that would be directed by investors (owners of the DAO token).
- It is a smart contract on Ethereum blockchain designed by Slock.it
- Lacks a management structure, a Board of Directors, and employees
- The code was open-source and stateless.
DAO Launch
- Launched in April 2016 on Ethereum block 1428757 with a crowdsale to fund the organization.
- Ether value was about $150 million by May 21 (about 14% of all ether at the time).
DAO Reentrancy Bug
- June 9, 2016: Two developers reported most Ethereum-based contracts managing funds were vulnerable to a bug (Reentrancy Bug).
- June 12, 2016: Stephan Tual (Slock.it founder) reported that The DAO code was not vulnerable to this exploit.
- The code had two lines in the wrong order, allowing repeated ether withdrawals before checking entitlement.
- June 17, 2016: The DAO was attacked, and a user gained access to ~$50 million of ETH (30% of ether in the contract). Another group, Robin Hood Group (RHG), simultaneously used a similar exploit, promising to return ether to owners (they got the remaining 70%).
Community Debate
- The funds were put in a 28-day holding period before they could be withdrawn.
- The community debated rewriting history by hard forking, with a July 20 deadline (end of 28-day period).
The Hard Fork
- July 20, 2016: A hard fork at block 1,920,000 rewrote history, returning the DAO-directed ether to investors.
- The old protocol, Ethereum Classic (ETC), preserved history (immutability property), mandating RHG to return 70% of the ETC to the original investors.
Hard Fork vs. Soft Fork
- Soft Forks:
- Relatively minor software changes.
- Software upgrades backward-compatible with previous versions.
- Nodes do not need upgrading to form consensus.
- Hard forks:
- Major software changes.
- Not backward-compatible with previous versions.
- New rules for node consensus.
- It can be planned (Constantinople) or contentious (ETC).
Lessons from the DAO Incident
- Smart Contracts:
- Are not always smart and once deployed, cannot be "fixed."
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.