I know that smart contract is deployed as bytecode.
When we call a function from application, we use the encoding with the help of ABI and we get some bytes. let's say 220 bytes.
These are the bytes we send in data
property of the transaction to the smart contract.
So, our bytes have gotten to smart contract.
Question 1) is it the EVM who will take transaction's data(which in bytes) and then look at the bytecode and then figure out how transaction's data is related to which part of the bytecode and then figure it out ?
from
field), a pointer to the function within that contract, in the form of the hash of that function's name and parameter types (data
field), and the values of the parameters (alsodata
field).function func(uint256 x, address y)
, then you can find this function's selector within your contract's bytecode. In this case, you can generate the function selector, for example, using web3.js, by taking the first 4 bytes (8 hexadecimal characters) from the returned value ofWeb3.utils.keccak256('func(uint256,address)')
.