Ethereum Advanced

Hi @thecil, @filip

I hope you’re doing fine guys :slight_smile: 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 

  1. 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?
  2. Is there a one global or each node has their own pool? What’s more it’s the same in Bitcoin?
  3. 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 :slight_smile: I count on you to make one big picture and understand that structure fully.

Thanks !

2 Likes

Correct, but not the last sentence: If it’s correct each node put that transaction into the transaction pool (Question 2)., only the node that receive the transaction will put it into the transactions pools for the miners, although all nodes have access to this transaction pool, only the one who broadcast the transaction will put it in the pool.

Now after a miner pick up the transaction and process it, it will be appended into the blockchain and then all the nodes will update their ledger to sync it with the blockchain, because the transaction has been mined and appended in the blockchain.

The first transaction should be the deposit of the funds that will be released after another transaction which will provide the kid grades. (the second transaction is to provide the grades to the contract and if their valid, the funds will be sent to the kid).

Miners just lend their computing power (hash power) to encrypt the transaction and append it in the blockchain, the gas fees are like the price for purchasing the computing power to process the transaction, so miners does not care about the transaction data, they will just process it to get the transactions fees (gas fees), nodes are the one that verify the structure of the transaction before it reaches to the miners.

The CPU never execute the smart contract directly, it is on the EVM where the contract execute first and all the verification progress can be made by one or many nodes, when they validate that the contract logic (bytecode) will not harm the EVM, blockchain or node CPU, this will be broadcasted to other nodes (by broadcasting i mean that the contract is already deployed on the blockchain and has been verified before its deployment).

When you want to deploy a contract, it will be deployed on the address that request the transaction (deployment of a contract), after that the address of the contract will be the one who deployed it.

this questions could be solve at the moment of programming the contract, the limit is your imagination. To give you an example, the contract could hold the funds for the kids and will only release them if the grades fulfill the contract conditions (like getting a grade above 80/100), in case the grades fulfill the conditions, the funds can be sent to a kid account (a wallet).

They have their own pool but is also shared publicly into other nodes.

Basically what you said, the contract should be programmed to ensure all unexpected situations are/will be covered,.

An oracle is an external service (mostly outside blockchain) which inputs information to the blockchain upon request.

So the flow works like this:

  1. Your contract sends a request to an oracle smart contract. For example to get the current temperature on Mars.

  2. The oracle contract does something to catch the attention of the oracle service provider - probably emit an event but the exact means is not relevant.

  3. The oracle’s backend system notices that there is a new request for information in the oracle contract and it retrieves that information from somewhere

  4. Oracle’s backend system sends a transaction to the oracle contract with the requested information

  5. The oracle contract receives the requested information in the transaction and it either forwards it directly to your contract or your contract has to pull the information from the oracle contract. Or perhaps the oracle’s backend system can the transaction directly to your contract.

So oracle is just an external service which has a smart contract for communicating with users’ smart contracts and relaying the data. Of course there are gas costs associated with the usage but that’s up to the oracle provider to decide on who pays for them and how - it’s a business decision. But in the end the end user pays for the service (gas).

It takes me some time to response to all your questions but I hope this help you have a better picture :nerd_face:

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like

Thank you @thecil, may I ask you to take a look on the summary and confirm if it makes sense?

  • Creation of the SmartContract
  • Deployment of SmartContract and at the same time initiation of transaction causing sending the funds from our address to SmartContract’s address
  • Nodes verification of the transaction to SmartContract
  • Validation of transaction and broadcasting to other Nodes
  • Insertion of transaction into transaction pool
  • Miner(s) pick the transaction and do their POW
  • Successful miner put the transaction into the blockchain and broadcast the block to other nodes

Once the above is done, the SmartContract has ‘their own life’? It stays a bit separated until, at least, we get information about the results of the grade?

  • Once grades available EVM reads a contract.
  • EVM verifies if nothing malicious happens if contract executed etc.
  • EVM executes contract and instruct CPU to take actions
  • Same action happens on other EVM in order to reach a consensus (broadcasting as well?)

*** Questions ***

Is SmartContract part of the block?
Which EVM effectively trigger the release of funds from SmartContract to kid?

Hi all, so far so good.

I like the way ideas are being shared in the forum, it really turns the forum into bank of information where we can lean from each in a very fun way. Great job guys! :+1: :+1: :wave:

1 Like

Just cruising the posts. Thank you!

1 Like

Hi everyone,

So Far So Good :+1::raising_hand_woman:

2 Likes

From what I have learned so far, Ethereum is very different than Bitcoin. Being able to program money through smart contracts, it aims to revolutionize the internet to the next level. Is Ethereum the foundation of the Web 3.0?

2 Likes

Can some one tell me why is important from where BTC token comes from and why are less valuable and harder to sell? Tokens from shady past I mean. Thank you

1 Like

I have a friend who is in a band called, Thrice. We were talking about smart contracts. I don’t understanding the programming aspect of ETH, however, are there any bands using smart contracts in the music industry?

I am so happy I finally did this. I am grateful to Ivan and the team for dedicating their time to educate us in this incredible space.

1 Like

Hello there , if i started to learn this topics bymyself i would loose years, so thank you again for the opportunity. Generaly i learn all by myself but this course made this topic interesting and understandable

2 Likes
  1. If it has been established that a scammer has scammed the victim of some Eth in Ethereum blockchain, is there no way of recovering that fund or at least blacklist those stolen Eth so it becomes difficult/useless to the scammer?
  2. Is it not possible for the EVM to establish that a smart contract is a potential scam? For instance, if a smart contract is such that once a user swaps Eth or Bitcoin of a certain value, the user gets another coin or token of some value which should be equivalent to the value of the Eth or BTC swapped. This is to avoid a scam situation whereby an unsuspecting victim swaps valuable coins with a shit coin or token of zero value. There are several scams of this nature going on in the ethereum network and I don’t think it provides confidence for the mass adoption the ecosystem seeks.
1 Like

Greetings Everyone,

I’ve enjoyed the method of presenting the information which has been short and succinct. Most of the concepts are totally new to me coming from a medical background. I have learned a lot thus far and look forward to expanding my knowledge base.
I’m still in the process of assimilating the material so questions will come later.
Thank you for sharing your depth of knowledge.

1 Like

Before beginning this course I had assumed that Ethereum was not as easily tracked and that had higher standards for privacy and that is why it was used for DeFi.

I am glad this course is clearing up misconceptions I have had about Ethereum.

1 Like

Very enjoyable and informative so far…

2 Likes

Hi, I hope everyone else is having as much fun as I am!

What do you all think of Ethereum Gas Fee at the moment and what attempts are made to change the situation? A simple Swap on UniSwap costs between 60$ - 70$, which makes it very unattractive for small transactions, f. e. to get familiar with different dApps and trying them out before going in with bigger savings.

2 Likes

Great job! It’s really been awesome so far. I don’t know if there’s anyway for me to go back to previous assignments and revise my answers? It’ll be a very useful revision tool.

Hey @Emmaculate, hope you are well.

That is pretty simple, just click on your profile image (right top corner) then your nickname and click “Activity”, then you can see a list of all your replies to many topics. :nerd_face:

image

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like