Transaction Types
Deposit, transfer, withdrawal
Last updated
Deposit, transfer, withdrawal
Last updated
The current protocol implementation supports three transaction types: deposit, transfer and withdrawal. Each type has a numeric code included in the transaction calldata.
A deposit transaction delivers external funds to the user's account. It is assumed the user initiating the deposit transaction has made a prior token approval to the zkBob contract.
The deposit transaction has no input and output notes. The deposit amount is added to the output account balance to account for incoming funds.
The deposit transaction is checked on the contract side. Approved tokens should be successfully transferred to the contract address to finalize the transaction and update the Merkle tree.
The user must include a deposit signature field to the transaction. This field contains an account nullifier signed by the client's private key from the native chain. The contract extracts the client public address via the ecrecover
Solidity function.
Tx type = 0
has no output notes
token_amount
field contains deposit amount (a positive value)
energy_amount
field equals 0
Output account balance is increased to the deposit amount
depositSignature
field exists