The scenario is: I have 2 smartcontracts and contractA calls the method in contractB. Lets assume a transaction is signed in one of the method in contractA which does something and then also calls the method in contractB. Now, something happened and method in contractB throws an exception and transaction fails and reverted. However transaction failed but certain transaction fee gets deducted while making the call.

Is there a way to rollback the transaction like we usually do in DBMS when something fails in the middle?

Can we somehow achieve the ATOMICITY properties like in DBMS? Or what is the best approach at least we can practice in smartcontract transactions?

1 Answer 1


Transactions are already atomic by nature.

Contracts/functions do not sign transactions. Only EOAs (Externally Owned Account, such as your wallet) sign transaction. A contract function can simply call another contract, within the same transaction.

When a transaction reverts, you are charged the gas fees until the revert happens. This is so that you couldn't DoS the network with reverting transactions for free. Nodes do need to spend time to execute your transaction regardless.

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.