In Ethereum, delegatecall lets a contract execute code from another contract while using the calling contract’s storage and relevant execution context. It is powerful for proxy architectures and reusable logic, but dangerous when the delegated code or target can be changed without appropriate controls.
Alicia’s club keeps its booking register in one cabinet. Tricia borrows a set of instructions written by another team but applies them to Alicia’s cabinet. Kai Kai realises that an instruction designed for someone else’s drawers could overwrite the wrong records.
This is a family-friendly educational explanation. It does not require cryptocurrency purchases, wallets or real student information. The classroom story is fictional.
The answer in one minute
In Ethereum, delegatecall lets a contract execute code from another contract while using the calling contract’s storage and relevant execution context. It is powerful for proxy architectures and reusable logic, but dangerous when the delegated code or target can be changed without appropriate controls.
The school example
Alicia’s club keeps its booking register in one cabinet. Tricia borrows a set of instructions written by another team but applies them to Alicia’s cabinet. Kai Kai realises that an instruction designed for someone else’s drawers could overwrite the wrong records.
1. Code location and storage location differ
With a normal external contract call, the called contract generally uses its own storage. With delegatecall, code at the target address executes in the calling contract’s context, including its storage. That distinction is central to proxy designs.
2. Why proxies use it
An upgradeable proxy can delegate user requests to implementation code while keeping persistent state at the proxy address. Changing the implementation can change behaviour without changing the address users interact with.
3. Storage layout must match
If implementation code assumes a different storage layout, it can interpret or overwrite existing values incorrectly. Upgrade reviews must compare layout and permissions, not only check that a new function compiles.
4. Caller context matters
Delegatecall preserves important aspects of the caller context, including msg.sender and msg.value in the delegated execution. Security decisions must be based on the exact semantics, not on a vague idea that one contract simply ‘asks another for help’.
5. Untrusted targets are dangerous
Delegating to code controlled by an attacker can give that code influence over the calling contract’s storage and execution. A contract should not allow arbitrary untrusted implementation addresses.
6. A verified target is not a lifetime guarantee
Even if the target’s source code is published, the authority to change a proxy’s implementation may create future risk. Users should identify who controls upgrades and whether a delay or multisignature approval applies.
7. Delegatecall does not fix bad input
If an authorised officer records the wrong booking date, perfectly executed delegated code can still preserve the mistaken value. Source truth and contract correctness are separate.
8. Paper activity: shared cabinet, different instruction sheet
Draw a cabinet with drawers Inventory and Permissions. Let one child apply an instruction sheet that assumes the drawers are reversed. Observe how a correct-looking instruction can damage the wrong field.
9. What parents should ask
Who controls the delegated target? Which storage is changed? Can the target be upgraded? What happens if it fails? Those questions reveal more than the contract’s name.
A five-question evidence check
What action is proposed? Who is authorised? What contract and network are involved? Which accepted state confirms the outcome? What real-world fact still needs evidence? A technical check is useful precisely when its limits are clear.
A family learning activity
Use the paper exercise above, then introduce one mistake or missing approval. Ask what changes, what can be verified and which person should respond. Paper analogies do not implement cryptographic security.
When a simpler system is better
A school can usually manage booking rules, approvals and records through a database and signed audit trail. Blockchain is justified only when independent shared verification or distributed governance is a genuine requirement.
Frequently asked questions
Does this guarantee real-world truth?
No. The mechanism establishes a defined digital result under protocol rules. Physical outcomes and institutional decisions require separate evidence.
Can children learn this without cryptocurrency?
Yes. Fictional records and paper cards teach the important concepts without real keys or financial risk.
Does every blockchain work identically?
No. The concepts here concern particular smart-contract platforms and implementations. The relevant network, contract code and permissions must be checked.
Continue through the learning system
Read the related practical chapter, the English Blockchain Learning Guide, the Chinese Blockchain Learning Guide and the Master Blockchain hub.
Sources and limitations
Primary technical source: https://docs.soliditylang.org/en/latest/introduction-to-smart-contracts.html#delegatecall-and-libraries. General foundation: NIST Blockchain Technology Overview. The school scenarios are fictional.
