Solidity developer interview questions and how to answer them

Solidity developer interview questions go deeper into the language than a general blockchain interview: visibility and mutability, inheritance order, custom errors, receive and fallback, how mappings and dynamic arrays sit in storage, ABI encoding and function selectors, and which lines of code actually cost gas. Expect a Foundry coding or code review exercise and questions on token standard quirks such as approvals, permit signatures and fee-on-transfer tokens. Strong candidates explain what the compiler does, not only what the code looks like.

By Published 8 min read

What Solidity interviews focus on

Solidity jobs sit at protocol teams, wallet and infrastructure companies, security audit firms and product companies that add on-chain features. A broad blockchain interview checks whether you understand the chain. A Solidity interview checks whether you can be trusted with the compiler: whether you predict exactly how a line will behave, what it will cost, how it will be encoded and how it will look to an attacker or an auditor. Many teams run a short quiz-style round on the language, then a hands-on exercise. If you need a refresher on the EVM itself and the classic vulnerability list, start with the blockchain developer guide; this page assumes it.

How Solidity developer interviews usually run

  1. ScreenContracts you have deployed or audited, the tools you use, and whether your work reached mainnet.
  2. Language roundRapid questions on types, visibility, inheritance, errors, storage and encoding. Precision matters more than speed.
  3. ExerciseWrite a small contract with Foundry tests, or review a contract and list its issues by severity. Take-homes are common.
  4. Deep diveWalk through code you wrote: design choices, gas trade-offs and what an auditor flagged.
  5. Team roundReviews, disagreements with auditors, and how you decide something is ready to deploy.

Language fundamentals

Core Solidity language questions
QuestionWhat it testsWhat a strong answer shows
Public, external, internal, private: what does each allow?VisibilityExternal is callable only from outside (or via this), public from anywhere and creates a getter for state variables, internal from the contract and children, private only the declaring contract. Private data is still readable on chain
What is the difference between view and pure?MutabilityView reads state but cannot write; pure reads neither. The compiler enforces both, and they matter for off-chain calls
Constant versus immutable?Deployment-time valuesConstant is fixed at compile time; immutable is set once in the constructor. Both are embedded in bytecode, so reading them avoids a storage load
Why use custom errors instead of revert strings?Errors and gasCustom errors are cheaper to deploy and revert with, can carry typed parameters, and are easier for clients and tests to match
Explain receive and fallback.Special functionsReceive runs on plain ether transfers with empty calldata; fallback runs when no function matches, or for ether with data if it is payable. Without either, such calls revert
How do indexed event parameters work?EventsIndexed parameters become log topics that clients can filter on; a non-anonymous event can have up to three; the rest is ABI-encoded in the data
Interface, abstract contract or library?Code organizationInterfaces declare functions only; abstract contracts can hold partial logic; libraries hold reusable functions, either internal (compiled into the calling contract) or public and deployed separately, then called with delegatecall
How does Solidity resolve multiple inheritance?LinearizationC3 linearization, from most base to most derived in the order you list parents; super calls the next contract in that order, not necessarily the direct parent
Is integer overflow possible in Solidity 0.8 and later?ArithmeticArithmetic is checked by default and reverts, except inside unchecked blocks and in some explicit type conversions, which can truncate silently
Core Solidity language questions. Scroll sideways on a small screen.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract TipJar {
    error NotOwner();
    error NothingToWithdraw();

    address public immutable owner;
    event Tipped(address indexed from, uint256 amount);

    constructor() {
        owner = msg.sender;
    }

    receive() external payable {
        emit Tipped(msg.sender, msg.value);
    }

    function withdraw() external {
        if (msg.sender != owner) revert NotOwner();
        uint256 amount = address(this).balance;
        if (amount == 0) revert NothingToWithdraw();
        (bool ok, ) = owner.call{value: amount}("");
        require(ok, "transfer failed");
    }
}
A small contract interviewers might ask you to explain line by line (teaching sketch, not compiled here).

Likely follow-ups: what happens if someone sends ether with calldata (it reverts, because there is no fallback); why the owner is immutable rather than a storage variable; whether a caret pragma is right for a production deployment (teams usually pin an exact compiler version); and whether the contract can receive ether it never accounts for, for example ether forced in by selfdestruct or paid to it as a block fee recipient.

Storage layout and ABI encoding

  • Where is the value of `balances[user]` stored if `balances` is declared in slot 3? At the keccak256 hash of the ABI-encoded key followed by the slot number. The mapping's own slot stays empty.
  • Where do dynamic array elements live? The array's slot holds its length; the elements start at the keccak256 hash of that slot and run consecutively, packed if the element type is small.
  • How are structs and fixed arrays laid out? In order from a new slot, packing small members together, and the next variable after them starts a fresh slot.
  • What is a function selector? The first four bytes of the keccak256 hash of the function signature, such as transfer(address,uint256). It tells the contract which function the calldata targets.
  • Why can two functions clash in a proxy? Different signatures can share a four-byte selector. Proxy designs that separate admin and user functions, and tooling that checks for clashes, prevent surprises.
  • abi.encode versus abi.encodePacked? encode pads every value to 32 bytes; encodePacked does not, so two dynamic values side by side can produce the same bytes from different inputs. Avoid encodePacked with several dynamic types when hashing for signatures or IDs.
  • How do you read another contract's private variable? Read its storage slot directly with an RPC call. Private only means other contracts cannot access it in code.

Gas questions at the language level

Gas questions and what interviewers expect
QuestionWhat it testsWhat a strong answer shows
Why is the first read of a storage slot in a transaction more expensive than the next one?Access costsEVM upgrades introduced cold and warm access pricing; caching a storage value in a local variable avoids repeated loads
Is writing zero to a slot cheaper than writing a new value?Storage costsClearing a slot earns a partial refund, but refunds were reduced in later upgrades, so freeing storage is not a free win
Should external function parameters be memory or calldata?Data locationsCalldata for read-only arrays and strings avoids a copy; memory is needed only if you modify them
When is an unchecked block justified?Safe optimizationWhen a bound is proven by the code, such as a loop counter limited by an array length; never to skip thinking about overflow
When would you use inline assembly?JudgmentRarely: for operations Solidity cannot express or measured hot paths. It bypasses safety checks, so it needs extra tests and review
How do you prove an optimization helped?MeasurementGas snapshots or reports before and after, with tests unchanged, and a note on readability cost
Gas questions and what interviewers expect. Scroll sideways on a small screen.

Token standard and integration questions

  • What is the ERC-20 approval race, and how do you avoid it? Changing an allowance from one non-zero value to another lets a spender use both. Set it to zero first, use increase and decrease helpers, or use permit signatures.
  • How does permit work? The owner signs a typed message granting an allowance, and anyone can submit it, so approval and transfer can happen in one transaction. Check deadlines and nonces.
  • Why use a safe transfer wrapper for ERC-20 tokens? Some tokens do not return a boolean, and some return false instead of reverting. A wrapper handles both.
  • What breaks with fee-on-transfer or rebasing tokens? Accounting that assumes the amount sent equals the amount received. Measure the balance before and after, or refuse such tokens explicitly.
  • Why can safeTransferFrom on an NFT be a reentrancy point? It calls onERC721Received on a receiving contract, handing control to unknown code mid-function.
  • What is the share inflation risk in a tokenized vault? A first depositor can manipulate the share price through donations so later small deposits round to zero shares. Virtual shares, minimum deposits or seeding the vault reduce it.
  • Rounding: which direction should a vault round? Against the user and in favor of the vault for both minting and redeeming, so rounding errors cannot be farmed.

Testing with Foundry and the code review exercise

function test_OnlyOwnerCanWithdraw() public {
    vm.prank(address(0xBEEF));
    vm.expectRevert(TipJar.NotOwner.selector);
    jar.withdraw();
}

function testFuzz_TipsAreRecorded(uint96 amount) public {
    vm.deal(address(this), amount);
    (bool ok, ) = address(jar).call{value: amount}("");
    assertTrue(ok);
    assertEq(address(jar).balance, amount);
}
A Foundry test using cheatcodes to check access control (teaching sketch, not run here).
  • What does vm.prank do? Makes the next call come from a chosen address, so you can test access control from an outsider's point of view.
  • How does Foundry fuzzing pick inputs? Test functions with parameters are run many times with generated values; bound inputs to realistic ranges so failures mean something.
  • What is an invariant test? A property checked after random sequences of calls, such as total shares never exceeding total assets in value.
  • How do you test against real deployed contracts? Fork a live network at a pinned block, so tests are repeatable.
  • In a review exercise, what do you check first? Who can call each external function, every external call and what happens if it reenters or fails, arithmetic and rounding, and assumptions about tokens. Then report findings with severity and a fix.
  • Which static analyzers have you used? Slither is a common example. Say what it catches well and that it does not understand business intent.
  • What common issues would you flag in review? Division before multiplication, unchecked token transfer results, signature checks without nonce or chain ID, block.timestamp used for randomness, and missing events on admin changes.

Fictional example

Answering "Tell me about a gas optimization you made and how you checked it"
Our staking contract's claim function read the same reward-per-share value from storage inside a loop over a user's positions. I cached it in a local variable before the loop, changed the positions array parameter in a helper from memory to calldata, and moved two booleans next to an address so they shared a slot. I ran the existing tests to prove nothing changed in behavior and compared gas snapshots before and after. The claim function got noticeably cheaper for users with several positions. I left a short comment on the storage ordering, because the next developer adding a variable there could undo the packing without realizing it. I also skipped one change, an assembly loop, because the saving was small and the review cost was not.

Behavioral questions

  • Tell me about a finding in your own code that someone else caught. How you responded and what you added to your checklist.
  • How do you balance gas savings against readability? Optimize hot paths with evidence; keep the rest plain so auditors and teammates can follow it.
  • How do you keep up with the language and the EVM? Compiler release notes, upgrade proposals, published audit reports and security write-ups after incidents.

Structure these stories with the behavioral question guide. If you are also considering non-EVM chains, the Solana developer guide shows how a different account model changes the questions you will face.

A two-week preparation plan

  1. Days 1 to 3: languageRewrite the fundamentals table above in your own words, then test each claim in a scratch Foundry project.
  2. Days 4 to 5: storage and encodingCompute mapping and array slots by hand and confirm with a storage read in a test. Hash a few signatures to selectors.
  3. Days 6 to 8: tokensIntegrate a standard token, a fee-on-transfer mock and a token without return values, and make your contract handle all three.
  4. Days 9 to 11: review drillsReview practice contracts with known bugs and write findings as if for a client report.
  5. Days 12 to 14: rehearsalExplain one contract you wrote from top to bottom out loud, and practice a gas story and a review story.

In a language round, vague answers such as "it saves gas" lose points that a precise sentence would win. Natively, an AI interview assistant for Mac and Windows, transcribes a mock language round on your computer, so you can find the answers where you described a storage rule loosely. While practicing, it can read a contract or a failing Foundry trace from a screenshot and suggest what to explain next, and the saved sessions give you a list of weak spots to drill.

Questions people ask

What are common Solidity interview questions?

Visibility and mutability rules, constant versus immutable, custom errors, receive and fallback, inheritance order, where mapping values sit in storage, function selectors and ABI encoding, gas costs of storage access, and quirks of ERC-20 and ERC-721 integrations.

How is a Solidity interview different from a blockchain developer interview?

A blockchain interview covers the chain broadly: the EVM, common attacks, upgrades and off-chain services. A Solidity interview goes deeper into the language and compiler, such as storage layout, encoding and exact gas behavior.

Do Solidity interviews include a coding test?

Usually. Common formats are a small contract with Foundry or Hardhat tests, a take-home build, or a code review where you list and rank the issues in a contract.

Which tools should I know for a Solidity developer interview?

Foundry for tests, fuzzing and gas snapshots is widely used, Hardhat appears in many codebases, and static analyzers such as Slither are common in review. Know what each does well and what it misses.

Where to go next

Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.

Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.

Keep reading

Put it on your own machine.

A live-conversation assistant that runs locally. Your conversations stay on your machine.

macOS 12+ · Windows 10/11

© 2026 Natively AI Private Limited

Source-available under the Natively Personal Use Source License v1.0 · IP geolocation by DB-IP