โ† All CBCP Flashcard Decks

Smart Contracts and dApps Flashcards

6 cards from real CBCP practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 6 Smart Contracts and dApps flashcards as text
  1. A smart contract for a decentralized insurance dApp needs to automatically process a claim based on the real-world occurrence of a hurricane. Since the blockchain cannot directly access external weather data, what component is essential for the smart contract to receive this information securely and reliably?

    Answer: A decentralized oracle network to fetch and verify external data.

    Blockchains are deterministic, isolated systems and cannot natively access off-chain data. A decentralized oracle network serves as a secure bridge, retrieving external data (like weather reports), verifying its accuracy through consensus, and delivering it to the smart contract to trigger its execution.

  2. A developer deploys a complex dApp to the Ethereum network. Users report that their transactions are failing or taking a very long time to confirm during periods of high network activity. The developer advises users to increase the 'gas price' in their wallet settings. What is the primary function of 'gas' in this context?

    Answer: It is a unit measuring the computational effort required for a transaction, which validators are compensated for.

    Gas is the unit used to measure the amount of computational work required to execute transactions or smart contract functions on the Ethereum network. Users pay a fee (gas fee), calculated by multiplying the gas used by the gas price, to compensate validators for the computational resources they expend to process and secure the transaction.

  3. A development team is building a decentralized social media platform. They want to ensure the user interface is fast and responsive, similar to a traditional web app, while the core logic for content ownership and user interactions is handled by smart contracts. Which of the following BEST describes a typical architectural stack for such a dApp?

    Answer: A traditional frontend (HTML/CSS/JS) interacts with smart contracts for backend logic, and may use decentralized storage (like IPFS) for media files.

    A standard dApp architecture involves a separation of concerns. The frontend (user interface) is typically built with standard web technologies (HTML, CSS, JavaScript) for a good user experience. This frontend then communicates with the backend, which consists of smart contracts deployed on a blockchain. For large files like images or videos, decentralized storage solutions like IPFS are often used instead of storing them directly on the blockchain due to cost and performance constraints.

  4. A DeFi protocol's smart contract contains a function that sends funds to an external address. An attacker discovers that they can repeatedly call this function from their own malicious contract before the original function completes its state update, allowing them to withdraw more funds than they are entitled to. This vulnerability is known as a:

    Answer: Reentrancy Attack

    A reentrancy attack occurs when an external call from a vulnerable contract allows the called contract to call back into the original contract before its state is updated. This can lead to the logic being executed multiple times, often to drain funds, as famously happened in the 2016 DAO hack.

  5. Due to the immutable nature of blockchains, fixing a bug in a deployed smart contract is a significant challenge. Which design pattern allows developers to update the application logic of a dApp without requiring users to migrate their data to a new contract address?

    Answer: The Proxy Pattern

    The Proxy Pattern is a common method for enabling smart contract upgrades. It involves separating the contract's state and logic. Users interact with a proxy contract that holds the state (data), which then delegates calls to a separate logic contract. To upgrade, a new logic contract is deployed, and the proxy contract is simply updated to point to the new logic contract's address, preserving the original state and contract address for users.

  6. Which of the following describes a Decentralized Autonomous Organization (DAO)?

    Answer: An internet-native organization where rules are encoded as smart contracts and operational decisions are made by its members, typically through voting with governance tokens.

    A Decentralized Autonomous Organization (DAO) is an entity with no central leadership. It is collectively owned and managed by its members. Its rules are encoded in smart contracts on a blockchain, and decisions are made through proposals and voting by members, who typically hold governance tokens that represent voting power.