I hope you’re doing fine guys all the best in New Year.
I wanted to put all the puzzle together I prepared small summary about the flow of ETH Smart Contract transaction, of course I faced some question marks. Could you kindly review the below and correct me / assist with questions?
Transaction with Smart Contract lifecycle:
- We have that situation with kid inheriting money from his father. Therefore we decided to create a smart contract. Therefore we send a TX (Question 1) with coded Smart Contract on it. So starting from the beginning – that transaction is provided to node and share with all the nodes in the blockchain, they verify is it’s legit, correct (signatures, enough has to pay for delivering that transaction, block weight etc.). If it’s correct each node put that transaction into the transaction pool (Question 2).
a) here come already miners providing their POW to deliver properly transaction to Smart Contract and keep it there until we find out about the kid’s grades?
b) Or it goes automatically without any work here and miners comes only once we have a result which send a transaction to father or son (depending on the outcome) and here miners are required with POW?
From logical point of view as the ratio between gas-ETH changes I would say the miners come when there is a transfer from our account to SmartContact as we know precisely the price for that transfer, or am I wrong? Ivan mentioned as one of his sentences that consensus (the same end-result of inx reached by EMVs) and CPU is instructed to execute the SmartContract.
Once SC keeps the money, we’re waiting for the results to come (Question 3). Once the information comes, EVMs on each NODES process the smart contract, so execute all the instruction mentioned in Smart Contract and end up with some result and we need to reach consensus on entire Network (based on what Ivan said). How we know that this consensus is reached and CPU effectively execute smart contract? Is it one particular CPU which executes that? I’m missing here some insight
- How do we initiate that process? I assume we send a transaction with specific Smart Contract attached? Do we send a transaction to potential recipient? How we know where we should send the money? We send money from our account to our son’s and it ends up temporarily in Smart Contract ‘pocket’? And if son has good scores it’s deliver to him and the other way around if he fails, it’s send back to father? What if we program it for 2 kids at the same time and ‘better’ one wins? Then we would not be able to initiate transaction (at the moment we send it) to one of them… even though in bytecode we would have all instruction, conditions mentioned, no?
- Is there a one global or each node has their own pool? What’s more it’s the same in Bitcoin?
- What triggers the check if information is already available? It’s more Oracle’s responsibility or it’s SC who somehow, regularly enquire about it to Oracle? In case of grades I guess we might have a precise date of data – so on that date Smart Contact would check that? What if it’s delayed? It’s has to be properly coded I guess to ensure that all unexpected situations are ‘covered’ in scenarios?
I hope you managed to go through it I count on you to make one big picture and understand that structure fully.
Thanks !