0

I have a contract and inside the contract there is a non-payable function that can call externally. this function do some analysis,and calls other payable function than can make real transaction using the contract balance(like transfer,swap). So if i call the first function using eth_call(), can the inside function make real transaction?

1 Answer 1

0

No. If there's no transaction signed by a private key being broadcasted and gas paid, the chains state won't change, no matter what.

5
  • if i send raw transaction and if no state is changed, does still burns gas? like if reads state and finishes the excution, does still costs gas? Commented Oct 15, 2023 at 17:42
  • @BirukDamte If it's done through eth_sendtransaction or sendrawtransaction, yes. There's absolutely no point in doing that though
    – Foxxxey
    Commented Oct 15, 2023 at 18:26
  • lets say my function reads state of the chain and decides to do no transaction and finishes the execution because some conditions aren't meet. Does this costs gas? I want to execute both the decision part and the transaction part in one call. Commented Oct 15, 2023 at 18:31
  • Yes. Take the descision off chain instead. @BirukDamte
    – Foxxxey
    Commented Oct 15, 2023 at 19:50
  • getting state of the block chain, making decision off chain and sending new raw transaction is very time costy for me. Because I'm trying to arbitrage. Any suggestion please? Commented Oct 15, 2023 at 20:20

Your Answer

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

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