Transfers
Submit a Batch
Step-1: Collecting transactions from users
The coordinator collects signed transactions from users via REST API's and adds them to the mempool
Step-2: Validate transactions
Validate the transaction by calling
the stateless
transactionEvaluation
function present on-chain.
All the application logic on how the transaction should be evaluated in present in the processTx
function. The transactions are evaluated against the balance root provided.
processTx
after running the transaction returns the the following tuple (bytes32, uint256, uint256, bool)
which consists of updatedBalanceRoot
, fromAccountBalancePostTransaction
, toAccountBalancePostTransaction
and if the transaction was valid
or not.
Step-3: Finally submit a new Batch!
Post running all transactions via the on-chain function we now have the latest balanceTreeRoot
and all the transactions that were used to create this root
which we will now use to update the contract with the new batch!
The transactions are encoded via abi.encode
method for now, but will be switched to a better compressed encoding in the next version.
The data stored per batch is as follows