Blockchain Developer Decentralized Application (dApp) Architecture 2 — Questions and Answers
Question 1: In a typical dApp stack, what role does the smart contract layer primarily serve?
- Backend business logic and state on-chain (Correct answer)
- Client-side rendering
- DNS resolution
- TLS certificate management
Correct answer: Backend business logic and state on-chain
Smart contracts act as the on-chain backend, holding state and enforcing business logic deterministically.
Question 2: Which library is most commonly used by a dApp frontend to interact with an EVM blockchain?
- ethers.js (Correct answer)
- jQuery
- Lodash
- Bootstrap
Correct answer: ethers.js
ethers.js (and web3.js) provide JavaScript APIs to read contracts and send transactions.
Question 3: Why are decentralized storage systems like IPFS used in dApps instead of storing files on-chain?
- On-chain storage is expensive and limited (Correct answer)
- IPFS is faster than RAM
- Blockchains cannot store text
- IPFS encrypts automatically
Correct answer: On-chain storage is expensive and limited
Storing large files on-chain costs enormous gas, so dApps store data off-chain and keep only the hash on-chain.
Question 4: What does a wallet like MetaMask provide to a dApp architecture?
- Key management and transaction signing (Correct answer)
- Smart contract compilation
- Block production
- Database indexing
Correct answer: Key management and transaction signing
Wallets manage the user's private keys and sign transactions without exposing the keys to the dApp.
Question 5: Which component lets a dApp efficiently query historical and aggregated on-chain data?
- An indexer like The Graph (Correct answer)
- A raw JSON-RPC eth_getBalance call
- A CSS preprocessor
- A CDN edge cache
Correct answer: An indexer like The Graph
Indexing protocols like The Graph parse events into queryable subgraphs since blockchains are poor at complex queries.
Question 6: What is the purpose of an ABI in dApp architecture?
- Defines how to encode/decode contract calls (Correct answer)
- Stores private keys
- Compresses block data
- Routes peer connections
Correct answer: Defines how to encode/decode contract calls
The Application Binary Interface describes contract functions and types so clients can encode calls and decode results.
Question 7: A 'trustless' dApp means users must trust which of the following?
- The deployed contract code and chain consensus (Correct answer)
- A central admin server
- The frontend host's database
- The wallet vendor's cloud
Correct answer: The deployed contract code and chain consensus
Trustlessness comes from verifiable on-chain code and consensus rather than a trusted intermediary.
In a typical dApp stack, what role does the smart contract layer primarily serve?