What Is the Difference between a Receive and a Fallback Function in Solidity?

The receive function is specifically executed when a transaction sends Ether to the contract with no data (empty calldata ). It must be declared as payable and cannot have arguments.

The fallback function is executed when a contract is called without matching any other function, or if it receives Ether with data. Both can be entry points for a reentrancy attack, but receive is specifically for plain Ether transfers.

What Is the Smallest Unit of Ether?
What Is a Denial-of-Service (DoS) Attack Related to Fallback Functions?
What Is the Conversion Factor between Ether and Gwei?
What Is the Role of a Fallback Function in Facilitating a Reentrancy Attack?
What Is the Difference between Gas and Ether on the Ethereum Network?
What Is the Minimum Amount of Ether Required to Run a Validator Node on Ethereum?
How Have Recent Versions of Solidity Changed the Behavior of Fallback Functions to Mitigate This Risk?
Why Are Fallback Functions Critical in a Reentrancy Scenario?

Glossar