I read that smart contracts don’t have a private key, so they can’t sign a transaction. My question is: when a smart contract starts a transaction to an EOA, how are we sure that the smart contract made the transaction if it doesn’t sign anything? I’m new in this world and I'm still studying English, so please forgive the mistakes. Thanks you
Only an EOA can sign and send a transaction. It can be addressed to a contract in which case the contracts functions must run.
A contract's functions can send messages and/or value to other contracts in which case they also run, or to an EOA which just receives because it has no code.
All of this happens approximately instantaneously (after mining) because it is all considered part of a single atomic transaction that must either complete entirely or fail.
Hope it helps.
It's not so much about whether a smart contract has a private key or not; it's more about the fact that smart contracts can't initiate a transaction. All transactions are started by an EOA to either a smart contract or to another EOA.
If a transaction is sent to a contract the contract may include functionality to call another address within the same transaction (be it to another contract or to an EOA). We can always check
msg.sender to see where the transaction came from (who was the previous relayer - the very very original sender is visible with
The smart contract can only send a transaction to an EOA if the transaction was initiated by an EOA. Smart contracts cannot initiate a transaction because they do not have a private key and cannot sign a transaction, as you said.
When value is being sent from a smart contract to an EOA, what is really happening is an EOA sending a transaction to the network that tells the smart contract to send value to the other EOA.