0

I am just having issue understand the concept behind smart contracts. I understand that EOA triggers a tx to a contract account and that the hashcode calls a program on the EVM (a separate entity to the state machine) and the EVM acts as a singleton computer and runs an instance of the smart contract by the help of the triggered contract account hashcode. I also understand that the EVM charges money it gets from the contract account, but what are the profits of the contract account? Will the balance of the contract account be positive and will some shares of these profits go back to the developer?

Furthermore, what is the nature of the computation the EVM conducts for the contract account? I understand that the contract account is deployed to the state machine but how are the codes uploaded to the EVM so that when an EOA trigger a tx the Contract account calls the account on the EVM?

1 Answer 1

1

I think the main point you are missing is the middle word of EVM - Ethereum Virtual Machine. It's called virtual machine because it's a machine which is only emulated on physical machines.

All client nodes form the EVM. Some nodes are only verifying transactions, and some nodes do the actual heavy lifting: executing transactions and including them in blocks - this is called mining. If all the nodes clients would disappear, there would be no more EVM and the blockchain would cease to exist.

So when you send a transaction through some node, it gets propagated to other nodes. Eventually some miner node picks it up, includes it in their block, manages to mine the block and broadcasts the block to others. Then it gets added to the chain of blocks (blockchain) and work starts on another block. Whatever transaction costs (gas) are required, some of them are given to the miners and some is burned. (This is a simplified version.)

As for contracts, they only do what their code says. They don't implicitly give any rewards anywhere. If someone sends Eth to a contract and the contract code has some logic to do something with the Eth, it may for example send it forward to some other address.

5
  • Good answer, but an important thing to note is that the "Virtual" in EVM refers to it being emulated on a physical machine, rather than due to it "not existing in any specific location or place".
    – SamTebbs33
    Aug 27, 2021 at 12:34
  • Thanks for the feedback! Fixed Aug 27, 2021 at 12:51
  • @LauriPeltonen Many thanks for attempting to answer my question! I understand the concept of virtual, but still, it is considered a separate entity to "World state". The contract account code (hashcode) calls a code on the EVM that needs to be executed, right? Question1
    – Anonymous
    Aug 27, 2021 at 15:38
  • @LauriPeltonen so obviously the contract account charges the EOA some wei and store it in the balance (CA balance field). Then, would it be possible for this field to ever be positive? I understand that the developer of the smart contract can charge some fund if external users used the smart contract he deployed to the state machine. Can you please confirm this?
    – Anonymous
    Aug 27, 2021 at 15:41
  • The contract doesn't charge anything. It can have functions which accept Ethers and EOA users may call those functions. Therefore contract's Ether balance can only be zero or positive. Transaction costs are a different thing, and are always paid by an EOA. The "world state" is based on sent transactions - transactions are the only way to alter the state. Feel free to poke me in private if you want further clarifications, or post a new question Aug 27, 2021 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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