In Solidity, an immutable variable is assigned during contract creation and cannot be reassigned after deployment. It is useful for values that should remain fixed for that deployed implementation, but immutable does not mean every part of the contract is unchangeable.
Alicia’s science club opens a register with a fixed identifier for the founding school. Tricia can change booking records but not that original identifier. Kai Kai asks whether replacing the whole program would change the rules.
This educational article is written for children, parents and adult beginners. The classroom examples are fictional; learning requires no cryptocurrency purchases, real keys or student personal information.
The answer in one minute
In Solidity, an immutable variable is assigned during contract creation and cannot be reassigned after deployment. It is useful for values that should remain fixed for that deployed implementation, but immutable does not mean every part of the contract is unchangeable.
A school story to explain the idea
Alicia’s science club opens a register with a fixed identifier for the founding school. Tricia can change booking records but not that original identifier. Kai Kai asks whether replacing the whole program would change the rules.
1. Immutable and constant are different
Solidity constants are fixed at compile time, while immutable variables can be assigned during construction. Neither is an ordinary storage variable updated by later transactions.
2. Where the value comes from
An immutable value may be set through a declaration or in the constructor. Its creation-time value is embedded in the deployed runtime code according to compiler rules.
3. The contract can still have mutable state
A fixed issuer address does not prevent the contract from changing balances, bookings or permissions stored elsewhere. Readers should never infer that the whole contract is frozen from one immutable field.
4. Proxies change the picture
An upgradeable proxy may delegate to another implementation. An immutable value in implementation code and the proxy’s own storage have different semantics; upgrading the implementation may change what users experience.
5. Immutability is not correctness
If the wrong address is set during deployment, it can remain permanently wrong in that implementation. A fixed value needs careful review before creation.
6. A deployment receipt is not a policy audit
Check the network, contract address, verified code where available and constructor arguments. A successful deployment does not prove that the chosen fixed value was authorised.
7. The paper activity
Write a school identifier in permanent ink and a booking count in pencil. Update the booking count several times. Then ask what happens if the permanent identifier was incorrect from the beginning.
8. When an ordinary configuration is better
A school can usually manage fixed configuration in a conventional database or signed policy. Solidity immutables are relevant when a justified smart contract needs them.
A family evidence check
Ask what the code stores or checks, which network and state reference apply, who may change the information and what remains a claim about the physical world. A valid contract state is not automatically an accurate school record.
A short paper activity
Use the exercise above, then change one value or permission. Ask the learner to explain what can be checked and what would require a person to investigate. This paper model does not provide cryptographic security.
When a conventional solution is preferable
A school may meet its needs with a database, role-based permissions, signed records and an audit trail. A blockchain is justified only when independent shared verification or governance addresses a specific requirement.
Frequently asked questions
Does the mechanism establish real-world truth?
No. It establishes a technical property under its defined rules. External measurements and institutional claims require appropriate evidence.
Can children learn without cryptocurrency?
Yes. Fictional records and paper exercises teach the idea without financial exposure.
Is the concept the same on every blockchain?
No. These chapters describe Solidity and Ethereum-specific concepts. Other networks can use different languages and execution models.
Continue through the learning library
Read the related practical chapter, the English learning guide, the Chinese learning guide and the Master Blockchain hub.
Sources and limits
Primary technical source: https://docs.soliditylang.org/en/latest/contracts.html#constant-and-immutable-state-variables. General background: NIST Blockchain Technology Overview. The school examples are fictional.
