I am looking at the slides of this link. As I see there the author differentiates between a message and a transaction. As can be depicted in this slide enter image description here

Furthermore, looking at the four cases of messages it seems clear that CA can only create a message (internal transaction) as opposed to a transaction! As can be seen here.

enter image description here

But it seems that some developers say that a contract account can create another contract account and this means that they can initiate a code on the EVM which means that they can initiate a transaction. Is that true?


Contract accounts can't initiate any transaction on their own. You can program a contract to deploy another contract or a set of contracts, but the initiation would always have to be triggered by an EOA. In the former example, that deployed contract would have a function responsible for deploying all those child contracts. The contracts would only be deployed once the function is called by an EOA, which would mean that the EOA would be paying the gas fee of those contract deployments. All contracts would be deployed as part of a single Ethereum transaction, as each deployment would be an atomic operation which is part of that function call transaction.

  • Many thanks for attempting to answer my question. So you mean that a contract account when being triggered from an EOA will only run an instance same as class in JavaScript. So if the code requires to create child contracts it is mainly running instances of it's code on the evm. So the creation of child contracts are recorded on the Blockchain showing that they are from the EOA that triggered the mother contract not the child contracts. In other words, the block will show the transaction from EOA to child contract account and not mother contract account to child. Right?
    – rsc05
    Aug 29 at 21:40
  • 1
    The ETH transaction would only show the call from the EOA to the mother contract via the method call. But from the child contract's perspective, it's going to see that the mother is the one that deployed it as an atomic operation part of that transaction. Note that there is not definition for parent contract or child contract in ethereum, all deploy contracts are treated the same and have no interrelations unless you code that interrelation yourself. Aug 29 at 22:01
  • 1
    You calling the function is the TX, the mother creating a child is an atomic operation part of your transaction. Your entire function call is one big transaction, and anything that happens in that function call, including any contracts deployed, is part of that same big transaction as an atomic operation. Aug 29 at 23:16
  • 1
    There is only one transaction. It is the transaction that leads to a change in the world state with "from" param as the EOA and "to" param as the mother contract. The data of the transaction would contain the specific mother contract function call w/ parameters, all ABI-encoded. Everything that happens as a result of the function execution is also part of that TX, and would be an atomic operation (would result in world state change, but it would be part of that same function call tx and not a new tx). Aug 30 at 21:16
  • 1
    I think you should test around with Remix and verify your contracts on Etherscan to make debugging easier with Tenderly. You need to take a look under the hood and experiment to fully get a grasp on this. Aug 30 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.