Blockchain Developer Decentralized Application Architecture 2 — Questions and Answers
Question 1: In a typical dApp architecture, what is the primary role of the smart contract layer?
- Storing large media files on-chain
- Encoding and enforcing the application's business logic and state transitions (Correct answer)
- Rendering the user interface
- Managing DNS resolution
Correct answer: Encoding and enforcing the application's business logic and state transitions
Smart contracts hold the trustless business logic and on-chain state for a dApp.
Question 2: Why do most dApps store large files on IPFS or Arweave rather than directly on-chain?
- On-chain storage is free but slow
- On-chain storage is extremely expensive per byte and bloats the chain (Correct answer)
- IPFS guarantees instant global consensus
- Smart contracts cannot reference external hashes
Correct answer: On-chain storage is extremely expensive per byte and bloats the chain
Storing bytes on-chain costs significant gas, so dApps store content off-chain and keep only the hash on-chain.
Question 3: What does a 'content-addressed' storage system like IPFS use as a file identifier?
- A sequential database ID
- The file's owner address
- A cryptographic hash of the content (CID) (Correct answer)
- A randomly assigned UUID
Correct answer: A cryptographic hash of the content (CID)
IPFS addresses content by a hash of its bytes, so the same content always yields the same CID.
Question 4: Which component lets a browser-based dApp frontend submit transactions signed by the user?
- A wallet provider injecting an Ethereum provider object (Correct answer)
- The block explorer API
- A centralized payment gateway
- The IPFS gateway
Correct answer: A wallet provider injecting an Ethereum provider object
Wallets like MetaMask inject a provider that the frontend uses to request signatures and send transactions.
Question 5: What is the main purpose of an indexing layer such as The Graph in a dApp stack?
- To execute smart contract code
- To efficiently query and serve historical/aggregated on-chain data (Correct answer)
- To store private keys securely
- To replace the consensus algorithm
Correct answer: To efficiently query and serve historical/aggregated on-chain data
Indexers transform raw chain events into queryable APIs since reading aggregated data directly from a node is slow.
Question 6: In dApp architecture, what is a 'node provider' such as Infura or Alchemy responsible for?
- Signing user transactions automatically
- Providing RPC access to blockchain nodes so apps avoid running their own (Correct answer)
- Hosting the dApp's HTML and CSS
- Generating new private keys for users
Correct answer: Providing RPC access to blockchain nodes so apps avoid running their own
Node providers offer managed RPC endpoints so developers don't have to maintain full nodes.
Question 7: Why is the frontend of most dApps still typically hosted on conventional or decentralized web hosting rather than on-chain?
- Smart contracts cannot store any data
- Serving UI assets on-chain would be prohibitively expensive and slow (Correct answer)
- Browsers cannot read blockchain data
- It is legally prohibited
Correct answer: Serving UI assets on-chain would be prohibitively expensive and slow
UI assets are served off-chain (e.g., IPFS/CDN) because on-chain hosting is costly and impractical.
In a typical dApp architecture, what is the primary role of the smart contract layer?