Base Learn is a comprehensive, free guide to learning smart contract and onchain app development.
if
, else
, while
, and for
require
to write a function that can only be used when a variable is set to true
revert
statement to abort execution of a function in a specific stateerror
to control flow more efficiently than with require
msg.sender
global variablestruct
(user-defined type) that contains several different data typesstruct
to maximize storage efficiencystruct
s depending on the types they containcall()
function to interact with another contract without using an interfaceuseAccount
HookuseAccount
hook to show the user’s address, connection state, network, and balanceisMounted
hook to prevent hydration errorsuseReadContract
HookuseReadContract
hook to fetch data from a smart contractuseReadContract
useBlockNumber
and the queryClient
to automatically fetch updates from the blockchainpure
or view
smart contract functionuseReadContract
on demandisLoading
and isFetching
to improve user experienceuseWriteContract
hookuseWriteContract
hook to send transactions to a smart contractuseWriteContract
useSimulateContract
hookuseSimulateContract
and useWriteContract
to send transactions to a smart contractuseSimulateContract
and useWriteContract
useWriteContract
, with arguments and a value