In Solidity, contracts often check their own Ether balance. While address(this).balance
is common, it’s not the most gas-efficient way.
The SELFBALANCE
opcode, accessible via selfbalance()
, is a cheaper alternative:
BALANCE
costs 100–2,600 gas, depending on the address state.
SELFBALANCE
does the same but with a fixed 5-gas cost.
Using selfbalance()
can significantly reduce gas costs in balance checks.
For better gas efficiency in Solidity, use selfbalance()
instead of address(this).balance
. It leverages the SELFBALANCE
opcode, reducing gas costs significantly.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.