Yamata
Website
  • Yamata Nodes
    • DISCLAIMER
    • Transaction Processing
      • Order Submission Process
      • Sequencer Processing
      • Posting on the Blockchain
    • Order Validation
      • What are Validating Nodes (VNs)
      • Order Matching
      • Challenge Process
        • Discrepancy Detection
        • Challenge Initiation
        • Challenge Approval
      • Voting & Sequencer Defense
    • Reward Process
      • Transaction Fee Distribution
      • Challenge Results
      • Validating Nodes (VNs) Rewards
      • Withdrawal Process
    • Reputation System
      • Reputation Gain/Loss
      • Punishment Process
      • Reputation Score Ranges
    • Node Activation
      • Activation Fee
      • Node License NFT
      • Hosting
      • YAMATA Software
Powered by GitBook
On this page
  • Matching Off-Chain and On-Chain Orders
  • Off-Chain Sequencer (Submission A)
  • On-Chain Orders (Submission B)
  • Off-Chain Discrepancies
  • Ensuring No Exclusion of Orders
  • Cycle of Validation
  1. Yamata Nodes
  2. Order Validation

Order Matching

PreviousWhat are Validating Nodes (VNs)NextChallenge Process

Last updated 7 months ago

In a decentralized system like Yamata, orders can be processed both off-chain (via a sequencer) and on-chain (directly recorded on the blockchain). The role of the Validating Nodes (VNs) is to ensure that all transactions are processed fairly and consistently across these two parallel paths.

The process of matching and verifying transactions involves several potential scenarios, which we’ll break down below.

Matching Off-Chain and On-Chain Orders

In all cases, an order will be processed by the off-chain sequencer (Submission A) and will also appear on-chain (Submission B). The VNs are responsible for ensuring that these two versions of the transaction match. However, because there is no globally coordinated time between off-chain and on-chain transactions, we cannot rely on on-chain ordering for verification. Instead:

Off-Chain Sequencer (Submission A)

Handles the orders based on when they arrive at the API. It maintains the order of transactions as they are received and processes them accordingly.

On-Chain Orders (Submission B)

Ensures that the transactions are included on the blockchain, but it cannot guarantee the same ordering as the off-chain sequencer. On-chain ordering can be influenced by gas fees and miner decisions, making it less reliable for verifying the exact sequence.

How it Works:

  1. The sequencer is the authoritative source for order sequencing. The VNs verify that the on-chain orders match the off-chain orders, but they do not compare the exact order between the two systems since the blockchain does not offer an objective time ordering.

  2. If there is a mismatch in the content (not the order) of the transaction between the sequencer and on-chain, the VNs can raise a challenge to investigate further.


Off-Chain Discrepancies

In this scenario, we are not dealing with on-chain orders, but rather a discrepancy in how the sequencer itself has processed two or more off-chain orders. For example, two orders may arrive off-chain in a particular sequence, but the sequencer may process them out of order.

Example:

  • Order A: Sell 1 BTC for 1 ETH.

  • Order B: Sell 1 ETH for 1 BTC.

  • Order C: Sell 1 ETH for 1 BTC.

Order A could match either Order B or Order C, and the correct match depends on which order, B or C, arrived first at the sequencer. If Order B arrived first at the API, it should be processed before Order C. However, if the sequencer mistakenly processes Order C first, this is a discrepancy that the VNs must address.

How it Works:

  1. The VNs monitor the off-chain sequencing of transactions. If they detect that the sequencer processed orders out of their correct order (e.g., processed Order C before Order B when B arrived first), they can raise a challenge.

  2. The challenge process ensures that the sequencer cannot manipulate the order of transactions and that everything is processed fairly based on the time of arrival at the API.


Ensuring No Exclusion of Orders

Another role of the on-chain mechanism is to ensure that no valid orders are excluded by the sequencer. While the sequencer is trusted to process orders efficiently off-chain, the on-chain mechanism acts as a safeguard to make sure that no orders are left out of the system entirely.

Even if the order of transactions on-chain doesn’t match the sequencer’s order, as long as all orders are included, the system remains fair.

How it Works:

  1. The primary goal of the on-chain system is to make sure that no order is excluded. If the sequencer fails to post an order on-chain, the VNs will detect this and raise a challenge.

  2. This process ensures that the sequencer cannot simply ignore or exclude orders, while it is in control of the off-chain order processing.


Cycle of Validation

As long as the orders from the sequencer and on-chain match, the VNs continue to validate each epoch in a circular fashion, simply ensuring that everything is correct and moving on to the next batch.

However, when the VNs detect a discrepancy, whether in the order, content, or exclusion of transactions, they immediately move into the to investigate and resolve the issue.

challenge process
Order Matching
Cycle of Validation Flow