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

  1. Auction in the Primary Markets: the auctions in the Primary Markets occur every eight hours. Every eight hours the sequencer will sequence the following transaction orders:

    1. New orders placed by both borrowers and lenders in the past 8 hours;

    2. Partially filled orders in the past

    3. Unmatched orders in the past

Event-based Transactions

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Instant matching in the Secondary Markets: when a user places a market order in the Secondary 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:

  1. Witness: the derivative output of ZKP.

  2. Proof: the output to be verified by the Operator.

  3. 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