
Preface
Imagine a scenario where a blockchain platform is rapidly evolving, and the number of users is swiftly growing, reaching into the tens of millions, resulting in a sharp increase in associated costs over a short period. What strategies are necessary at this stage to maintain operational efficiency without hindering growth due to complex approval and confirmation processes? As many businesses would agree, scalability must be a priority.
As an off-chain scaling technology, Ontology Layer 2 offers higher performance and lower costs. Enterprises can securely store a large number of transaction records off-chain and then bring them on-chain when needed, reducing users' transaction costs and significantly enhancing performance.
Introduction
As outlined in Aristotle's 2020 roadmap, combined with cross-chain Ontology, Wasm-JIT, Multi-VM, and other advanced foundational technologies, Ontology Layer 2 now demonstrates superior performance compared to other Layer 2 solutions. This is reflected in its low storage costs, multilingual support, and complete compatibility with versions for analysis and execution. It ensures seamless interaction of deployment contracts, such as running multiple virtual operating systems on a single computer, increasing execution efficiency and reducing processing costs.
Workflow
Ontology Layer 2 consists of three main components: deposit Ontology on Layer 2, withdrawals from Layer 2 to Ontology, Layer 2 transactions, and security guarantees.
In the Layer 2 trading center, users can conduct transactions, execute contract requests, and sign contracts. This transaction may match the format of a main Ontology chain transaction or may differ. Transaction collectors (called 'Collectors') are responsible for gathering user Layer 2 transactions. Throughout the process, there may be several collectors. Users can also broadcast their Layer 2 transactions to multiple collectors.
The collector periodically batches the collected Level 2 transactions and initiates them to create a new state. The collector is also responsible for transmitting the root of the new state to the main Ontology chain. After executing the transactions packaged in the Level 2 block, the root of the new state becomes the state of the Level 2 block. The challenger is responsible for validating the Level 2 block state presented by the collector in the main Ontology chain. This requires the challenger to synchronize the Level 2 block through the collector to maintain the complete global state.
ACCOUNT STATE CONFIRMATION INCLUDES INFORMATION ABOUT THE ACCOUNT STATUS AND ITS VERIFICATION, WHICH CAN BE OBTAINED FROM REQUESTS BY THE COLLECTOR AND CHALLENGER. ONLY THEY MAINTAIN THE COMPLETE GLOBAL STATE.
Deposit on Level 2
- First, the user performs a 'Deposit' operation on the main Ontology chain. The main chain contract locks the user's deposit funds and records the state of this fund at Level 2. At this point, the status is 'unreleased'.
- Then, the collector receives a notification that a Deposit operation is pending on the main Ontology chain. The collector will change its state at Level 2 according to the deposit operation. The collector then adds the deposit to unlock the transaction and packages it along with other user transactions in the Level 2 block. When the Level 2 block state reaches the main Ontology chain, it notifies the system about the release of the deposit.
- The main chain contract performs the deposit release operation and changes the status of the deposit fund to 'released'.
Withdrawals from Ontology
- The user creates a Level 2 'Withdraw' transaction and sends it to the collector.
- The collector changes its state according to the Withdraw and simultaneously packages the Withdraw transaction along with other user transactions into the Level 2 block. When sending the state of the Level 2 block to the main Ontology chain, a request for withdrawal will be sent.
- The main chain contract processes the withdrawal request, records the fund entry, and sets the status to 'not released'.
- After confirming the state, the user submits a request to withdraw funds from the account.
- The main chain contract executes the request to withdraw funds from the account, transfers the funds to the target account, and marks the withdrawal record as 'released'.
Level 2 Transactions and Security Assurance
Level 2 Transactions
- The user creates a Level 2 transaction 'Transfer' and sends it to the Collector.
- The Collector packages the transfer transaction and other transactions into a Level 2 block, processes the transactions in the block, and transmits the state of this Level 2 block to the main Ontology chain.
- Wait for the status confirmation.
Security Guarantee
Once the Operator sends the state of the Level 2 block to the main Ontology chain, the Challenger may also execute the Level 2 block transaction and verify the correctness of the Level 2 block state. If something is incorrect, the Challenger will gather evidence of fraud and send a Level 2 smart contract to challenge the Operator.
How to use
Currently, Level 2 Ontology is available on the Ontology TestNet for developers to experiment with.
to the documentation
In the next article, we will provide a detailed performance comparison with Level 2 across other chains.
Appendix: Terms
Level 2 Transactions
The user has requested the transfer or execution of the Level 2 contract and has already signed it. This transaction may match the format of the main Ontology chain transaction or may differ.
Collector
The Collector is the Level 2 transaction collector. It is responsible for collecting the user's Level 2 transactions, verifying and executing the transaction. Every time a Level 2 block is generated, the collector is responsible for executing the transactions in the block, updating the status, and generating Level 2 contracts that can be interpreted as confirmations of the state used for security assurance.
Level 2 Block
The Collector periodically packages the collected Level 2 transactions, generates a block containing all Level 2 transactions, and creates a new Level 2 block.
Level 2 State
The Collector processes batch transactions in the Level 2 block, updates the state, sorts all updated state data to create a Merkle tree, and computes the root hash of the Merkle tree. The root hash represents the state of the Level 2 block.
The
The operator is responsible for the security of Level 2 and monitors whether a token is being transferred to Level 2 or a token transfer from Level 2 to the main Ontology chain. The operator is also responsible for periodically sending a status confirmation for Level 2. As confirmation, you can refer to the Ontology network.
Candidate
The candidate is responsible for verifying the status confirmation provided by the operator to the main Ontology chain. This requires the candidate to synchronize Level 2 transactions from the operator or chain to maintain a complete global state. Once the candidate synchronously executes the transaction and updates the status, they can verify the correctness of the status confirmation provided by the operator in the network. If there are issues, the candidate can create a fraud proof challenge, which can be explained by the Level 2 contract.
Account status verification
Achieved through Merkle proof, account status verification can be obtained from operators and candidates. They are the only parties that maintain a complete global state.
Fraud proof
Fraud confirmation includes verification of account status before the current Level 2 block update.
The previous certificate of the Level 2 block status and the presented certificate of account status confirm the legitimacy of the old state before the update. Proof that the old state is legitimate can be obtained by running the current block.
The enterprise-focused Ontology blockchain is designed to help businesses transform and modernize their operations. If you are facing challenges with self-scaling, virtual machines, or a full suite of technical systems, contact us at contact@ont.io.
Learn more about Ontology
Fresh, up-to-date information and enjoyable communication in our Telegram chat —
Also, subscribe and explore our: — — — —
Source: habr.com
