In this track: Write and read Solidity
Functions and visibility
Call reachability and business authorization are separate layers.
A door can be publicly reachable while a guard still checks which operation a visitor may request.
This example begins with count zero and a request to call increment(). No real contract is deployed.
Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.
Read the visibility category
Solidity functions can be public, external, internal or private, each with language-defined reachability. Public and external functions can form part of the callable contract interface.
Reachability is not a role check
An external function does not automatically restrict callers to trusted websites. An owner-only condition requires actual code that checks permission. Naming it private in a comment changes nothing.
Private does not encrypt blockchain state
A private variable restricts source-level access from other contracts or derived code under language rules. It does not make the raw state cryptographically hidden from observers of a public chain.
Use a narrow teaching example
The helper below is internal and reached through an external wrapper. That demonstrates call structure without claiming it is an access-control policy. Read the permission-check lesson for authorization.
Read the example
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract LearningExample {
function twice(uint256 x) internal pure returns (uint256) {
return x * 2;
}
function quote(uint256 x) external pure returns (uint256) {
return twice(x);
}
}The wrapper makes the internal calculation reachable through a public interface.
Does a private Solidity state variable automatically become secret to public-chain observers?
Language visibility is not encryption of publicly inspectable state.
Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.