The method to execute a function on a contract in Ethereum is to use the JSON RPC protocol to make a request which has the details of which function you want to call.
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction
When it's eg. a function called get() what will happen is:
- Take the sha3 hash:
sha3("get()") - Get the first 4 bytes:
sha3("get()")[0:4]==0x6d4ce63c - Add this function "selector" in the
datafield of youreth_sendTransactioncall.
I am wondering what happens if you try to compile and deploy a contract with conflicting function selectors.
When 1 contract has 2 functions with the same selector:
a. There will be an error during the contract compilation
b. There will be an error during the contract deploy (but it will compile)
c. No errors but when a function is called you cannot know which function will be triggered.
Does anyone know?