CBE - Certified Blockchain Expert Smart Contracts and DApps Questions and Answers — Questions and Answers
Question 1: A development team is building a decentralized application (DApp) for supply chain management. The DApp needs to automatically trigger a payment to a supplier once a shipment's arrival is confirmed by an external logistics provider's API. What component is essential for the smart contract to securely interact with this off-chain data?
- A decentralized file storage system like IPFS.
- The Ethereum Virtual Machine (EVM).
- A blockchain oracle. (Correct answer)
- An integrated development environment (IDE) like Remix.
Correct answer: A blockchain oracle.
Smart contracts on a blockchain cannot directly access real-world, off-chain data. A blockchain oracle is a service that acts as a bridge, fetching and verifying external information (like an API response) and feeding it to the smart contract to trigger its execution.
Question 2: Which of the following is a primary characteristic that distinguishes a smart contract from a traditional legal contract?
- It is written in a natural, human-readable language.
- It relies on a central authority or legal system for enforcement.
- Its terms are self-executing and enforced by code on a blockchain. (Correct answer)
- It can be easily amended by any party after it has been agreed upon.
Correct answer: Its terms are self-executing and enforced by code on a blockchain.
The core difference is that a smart contract is a self-executing agreement with the terms of the agreement directly written into lines of code. It automatically enforces the rules and obligations defined within it when predetermined conditions are met, without the need for a traditional intermediary or legal system.
Question 3: A developer is writing a Solidity smart contract that handles user withdrawals. They write the code to send the Ether to the user's address *before* updating the user's balance in the contract's state. This sequence of operations makes the contract vulnerable to which specific type of attack?
- Integer Overflow
- Denial of Service (DoS)
- Timestamp Dependence
- Reentrancy (Correct answer)
Correct answer: Reentrancy
A reentrancy attack occurs when an external call is made to another contract before the original function has finished its execution, particularly before updating its state. A malicious contract can exploit this by repeatedly calling the withdraw function, re-entering the code before the balance is updated, and draining funds.
Question 4: What is the fundamental role of the backend in a typical Decentralized Application (DApp) architecture?
- To host the user interface and frontend code on a centralized server.
- To run on a decentralized peer-to-peer network, typically consisting of smart contracts. (Correct answer)
- To store large files and user data in a traditional SQL database.
- To handle user authentication through a centralized identity provider.
Correct answer: To run on a decentralized peer-to-peer network, typically consisting of smart contracts.
The defining characteristic of a DApp is that its backend logic runs on a decentralized network, not a central server. This backend is primarily composed of smart contracts that execute on the blockchain, ensuring the application is censorship-resistant and operates in a trustless manner.
Question 5: A financial DApp allows users to lend and borrow assets. The interest rates for these loans must be adjusted based on real-world market data. Which of the following is NOT a primary component needed to build this DApp?
- Smart contracts to manage the logic of lending and borrowing.
- A frontend user interface for users to interact with the application.
- A centralized server to store all transaction history for faster queries. (Correct answer)
- An oracle to feed real-time asset prices into the smart contracts.
Correct answer: A centralized server to store all transaction history for faster queries.
A core principle of a DApp is decentralization. While some off-chain storage might be used, storing all transaction history on a centralized server would create a single point of failure and defeat the purpose of using a blockchain. The transaction history is immutably stored on the blockchain itself.
Question 6: When deploying a smart contract to the Ethereum network, what is the primary purpose of 'gas'?
- A token used for governance votes within the DApp.
- A fixed fee paid to the developers of the Solidity language.
- To pay for the computational effort required to execute operations and record transactions on the blockchain. (Correct answer)
- A unit of data storage for the smart contract's variables.
Correct answer: To pay for the computational effort required to execute operations and record transactions on the blockchain.
Gas is the unit used to measure the computational work required to perform operations on the Ethereum network. Users pay gas fees in Ether (ETH) to compensate miners or validators for the resources consumed to execute transactions and smart contract interactions, preventing spam and allocating resources on the decentralized network.
A development team is building a decentralized application (DApp) for supply chain management.
The DApp needs to automatically trigger a payment to a supplier once a shipment's arrival is confirmed by an external logistics provider's API.
What component is essential for the smart contract to securely interact with this off-chain data?