0

In Ethereum yellowpaper the gas cost to create a contract is equal 32000. But what is the cost to validate and keep the contract operating until it is executed?

Edit:

Imagine the following situation: I want to transfer an amount of ether from wallet X to wallet Y. I will use a smart contract to do the validation of the transfer. By my understanding the cost would be:

32 000 gas to create a new contract; After the contract was validated, 21000 gas would be added to the cost of the contract because the transaction would be validated.

My questions are: is this analogy correct?

Anything I do in the Ethereum blockchain can be considered a transaction? (If I just want to store a value in the blockchain (i.e. 256 bit value has a cost of 20 000 gas) I would have to pay the gas for store the value and also the gas cost of a transaction?

3
  • "I would have to pay the gas for store the value and also the gas cost of a transaction?" The cost of the transaction would include the cost of storing the bytes. (There's no cost for anything other than a transaction, but a transaction's cost can vary depending on what it does.)
    – user19510
    Nov 1, 2018 at 21:33
  • Understood, so basically the total cost should be 20000(storage)+21000(transaction) = 41 000 gas. Correct?
    – Mutante
    Nov 1, 2018 at 21:41
  • Yes. (A bit more due to other instructions being executed, the cost of the data being sent, etc.)
    – user19510
    Nov 1, 2018 at 21:42

1 Answer 1

0

I'm not 100% sure I understand the question, but I think the answer is 0. Gas is only paid when you make a transaction. Deploying (creating) a contract is a transaction, and then calling a function in that contract is a transaction, but in between there are no transactions and thus no gas paid.

1
  • Thanks for the answer. I eddited my question to better detail my doubt.
    – Mutante
    Nov 1, 2018 at 21:12

Your Answer

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

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