Rollup Services
The main jobs of rollup services include sequencing transactions to a batch, sending batched orders to ZK engines for generating proof, proof generating, and verifying the proof. These jobs are executed by the following five essential components.
Sequencer
Transaction Orders Sequencing
There is a queue service inside rollup services to trigger the sequencer to batch transactions periodically or on an event-driven basis.
Routine Transactions
Auction in Fixed-Rate Borrowing/Lending: the auctions in Fixed-Rate Borrowing/Lending occur every eight hours. Every eight hours the sequencer will sequence the following transaction orders:
New orders placed by both borrowers and lenders in the past 8 hours;
Partially filled orders in the past
Unmatched orders in the past
Event-based Transactions
Register: when a user deposits digital assets to Term Structure first time, a registration event will be triggered. The user's deposit amount, token, and wallet address will be sent to the sequencer and queued to the batch transactions.
Deposit: when a user deposits digital assets to Term Structure, a deposit event will be triggered. The user's deposit amount, token, and wallet address will be sent to the sequencer and queued to the batch transactions.
Withdraw: when a user withdraws his/her tokens from Term Structure, a withdrawal event will be triggered. The user's withdrawal amount, token, and wallet address will be sent to the sequencer and queued to the batch transactions.
Cancel orders: when a user cancels his/her orders, an order cancelation event will be triggered. The user's order placement and wallet address will be sent to the sequencer and queued to the batch transactions.
Instant matching in the tToken Markets: when a user places a market order in the tToken Markets, the matching event will be triggered. The user's order and wallet address will be sent to the sequencer and queued to the batch transactions.
The sequencer collects and organizes the transaction orders and then compresses them to Merkle Tree format for each round of batch transactions. The sequencer will then send the strict-formatted data to Prover in order to generate the proof.
When the sequencer accumulates 1,000 event-based transaction records, a round of event-based batch transactions will be triggered and sent to the Prover. A round of queue duration will not be longer than one hour no matter whether the number of transaction records reaches 1,000 or not.
Matcher
The role of the Matcher is to gather, organize, and match orders according to their specifications. Once the orders are matched, the Matcher generates transactions that are sent to the Sequencer for processing. This crucial process ensures that orders are properly executed and that transactions are processed efficiently and accurately.
Prover
The Prover is a trigger of the ZK engine. When the Prover receives the data from the Sequencer, it will start the ZK engine and then send the data to it for generating proof. After that, the Prover will shut down the ZK engine.
ZK Engine
The ZK engine is responsible to generate the proof from the batch transactions data sent from the Sequencer. The ZK engine will return the following results:
Witness: the derivative output of ZKP.
Proof: the output to be verified by the Operator.
Public Inputs (Calldata information): the output to be sent to the Ethereum after verification. This is compressed and encrypted transaction data required for users to perform the Evacuation Mode.
Operator
Proof Verifying
After the ZK engine generates the witness, proof, and calldata information, the Operator will be triggered to verify the proof. Once the proof is verified, the calldata information will be sent to the Ethereum. This is the rollup process.
Rollup
The Operator will send the verified calldata information to the Ethereum. After the rollup process is done, the transactions are finalized completely.
Data Synchronization from Mainnet
When users Register or Deposit on zkTrue-Up smart contract, the Operator will synchronize the data from the Ethereum Mainnet and send transactions to the Sequencer.
Last updated