Relayer lifecycle detailed description
The relayer is a mediator between clients and the zkBob contracts subsystem. Following are typical use cases when interacting with the relayer.
The user must keep and synchronize the current pool state to build proper transaction proofs. The pool state is held in the client as an ordered set of encrypted transactions (memo blocks) and the user should decrypt each of these to obtain account and note information. To receive this info, the client uses the
eth_getLogsRPC endpoint method, and during periods of heavy volume RPC endpoints can become overloaded.
The relayer keeps the actual pool transaction set, synchronizes it continuously, and returns a desired set of transactions to the users. It significantly decreases overhead for mainnet nodes.
When sending a transaction, a user must create the tx body (memo block), calculate the corresponding tx proof, and send it to the relayer. In this case there is no need to worry about the Merkle tree root, only the actual state (balance and notes) is needed as all tree-related work is performed by the relayer.