I recently read a twitter thread by the user KtorZ which Charles retweeted.
If i’m not mistaken, this means that smart contract code will never exist nor be executed on the validator nodes. Instead, only the input and the output of that code will be validated on chain and then sent to wherever the smart contract is hosted for processing.
For example, say I create a sports betting smart contract for a football game. The contract is sent a transaction which contains the bet amount and which team they think will win. After the game is over, the smart contract executes logic to determine the winners and sends the appropriate amount back to them. Im very confused as to how this could be implemented on Cardano given that I would be hosting this code say for instance on my home computer and not on the validator nodes. I have posted some questions below.
How exactly would the validator nodes know where to forward the validated input transactions? Would I need to expose my smart contract via an API?
How are users of my contract able to audit and verify that the smart contract code I am running is not malicious or faulty if it is not distributed on chain?
On Ethereum, when a transaction is minted into a block, all of the other validator nodes on the network not only validate the transactions, but run the smart contract code as well, thus validating the contract execution. I presume this does not happen on Cardano. Does this mean that a contract execution happens once and only once on the server hosting the contract off chain?
A lot of what I said here is my current understanding of how smart contracts work on Cardano and I know my understanding may not be correct so PLEASE help me out in correcting me where I am wrong.