In the state transition function, the following is the process that every transaction in Ethereum adheres to:
- Confirming of the transaction's validity and structure, by making sure that a signature is valid and nonce matching the nonce in the sender's account and syntax. If there are any issues, then an error is returned.
- The transaction fee calculation is done using the price of gas, and the sender address is determined using the signature. Then, the sender's account balance is checked and reduced accordingly, along with the increment of the nonce. In the case of an insufficient balance, an error occurs.
- Certain gas is taken to cover the cost of the transaction. It is charged per byte incrementally, according to the size of the transaction.
- In this step, the actual transfer of value occurs. The flow happens from the sender's account to the receiver's account. If the receiving account does not exist, then it is created. Also, if the receiving account is a contract account, then the code of the contract is executed. If there is enough gas available, then the contract code runs fully or to the point the gas runs out.
- If the transaction failed due to insufficient balance or gas, all the state changes are reverted, apart from the payment of fees, which is transferred to the miners.
- If there is reminder fee available, then it is sent back to the sender, as change after paying the miners as required. Function returns the resulting state at this point.
The following diagram depicts the state transition flow:

The function is implemented independently in each of the Ethereum clients.