0

I am thinking of a scenario where there is a user (U) that wants to upload a smart contract to the Ethereum network to be run later by multiple users {U1,U2,...,Un}.

For example, assume we have a smart contract where U (the person uploading it) requires the users who will later call it to input certain parameters. If they input the correct parameters, the smart contract will transfer a certain amount from the uploader's wallet to the caller's wallet.

Is this scenario even possible? If yes, who would pay for the gas?

I have read that the uploader must provide enough gas for the number of times the smart contract is called by the other users.

Is it possible to do this so that the callers pay the gas themselves each time they call the smart contract?

1

I have read that the uploader must provide enough gas for the number of times the smart contract is called by the other users.

Where did you read that? It's wrong.

Is it possible to do this so that the callers pay the gas themselves each time they call the smart contract?

This is, in fact, the only way things can be done. Gas is paid for by the account that makes the transaction.

  • So the uploader of the smart contract just pays for uploading the transaction and doesn't pay for its execution. Other users that later call the smart contract will pay for its execution based on the STARTGAS and gas price they specify when calling it. Is this correct? – user101 Mar 7 '18 at 17:42
  • The account that creates the smart contract ("uploader?") pays for the transaction to create it. This includes some execution (i.e. whatever the constructor does). When an account calls the smart contract, that account pays for that transaction. In both cases, the cost of the transaction is the amount of gas consumed in that transaction multiplied by the gas price specified in that transaction. (The maximum gas consumed is the STARTGAS value.) – user19510 Mar 7 '18 at 18:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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