The Ontology Team

Foreword

Think about a state of affairs during which a blockchain platform is growing quickly and the variety of customers is exploding, shortly reaching tens of thousands and thousands, bringing a pointy rise in associated prices over a short while. At this stage, what methods are wanted to take care of operational effectivity with out hindering the tempo of improvement attributable to advanced consensus and affirmation processes? As enterprises agree, scalability must be a precedence.

As an off-chain scalability know-how, Ontology Layer 2 provides increased efficiency and decrease charges. Enterprises can safely retailer a lot of transaction data off-chain after which switch them to the chain when they should work together, lowering person transaction prices and drastically growing efficiency.

Introduction

As outlined within the Aristotle 2020 roadmap, coupled with Ontology’s cross-chain, Wasm-JIT, Multi-VM and different cutting-edge core applied sciences, Ontology Layer 2 now reveals main efficiency in distinction with different Layer 2 options. That is mirrored in its low storage prices, multi-language help, and full compatibility of parsing and execution variations. enabling deployment contracts to work together seamlessly, like operating a number of digital working techniques on the identical pc, leading to increased execution effectivity and decrease processing charges.

Work Course of

Ontology Layer 2 has Three predominant components: Ontology Deposit to Layer 2, Layer 2 Withdraw to Ontology, and Layer 2 transactions and safety assure.

Within the Layer 2 buying and selling heart, customers could make transactions, execute contract requests, and signal contracts. This transaction may be the identical because the Ontology predominant chain transaction format, or it may be completely different. The transaction collectors (known as “Collectors”) are answerable for gathering the person’s Layer 2 transactions. There may be a number of Collectors all through the method. Customers may broadcast their Layer 2 transactions to a number of Collectors.

The Collector periodically packages the collected Layer 2 transactions and runs them to generate a brand new State. The Collector can be answerable for submitting the foundation of the brand new State to the Ontology predominant chain. After executing the transactions packaged within the Layer 2 block, the Root of the brand new state turns into the State of the Layer 2 block. The Challenger is answerable for verifying the Layer 2 block state submitted by the Collector to the Ontology predominant chain. This requires the Challenger to synchronize the Layer 2 block by way of the Collector to take care of the entire world state.

The account standing proof contains account standing data and its merkle proof, which may be obtained from the Collector and Challenger queries. Solely they preserve a whole world state.

Deposit to Layer 2

1. Firstly, the person performs a “Deposit” operation on the Ontology predominant chain. The principle chain contract locks the person’s deposit funds and data the state of this fund in Layer 2. At this level, the standing is “unreleased”.

2. The Collector is then notified that there’s a Deposit operation pending on the principle chain of the Ontology. The Collector will modify its state in Layer 2 in keeping with the operation of the Deposit. The Collector then provides a Deposit to launch the transaction and packages it with the opposite person transactions to the Layer 2 block. When the Layer 2 block state reaches the Ontology predominant chain, it can notify the system that the Deposit has been launched.

3. The principle chain contract executes the deposit launch operation and modifications the standing of the deposit fund to “launched”.

Withdraw from Ontology

1. The person constructs a “Withdraw” Layer 2 transaction and submits it to the Collector.

2. The Collector modifies its state in keeping with Withdraw, and, on the similar time, packages the Withdraw transaction and different person transactions collectively right into a Layer 2 block. When submitting the Layer 2 block state to the Ontology predominant chain, the Withdraw request might be submitted.

3. The principle chain contract executes the Withdraw request, data a fund report, and units the standing to “not launched”.

4. After state affirmation, the person submits a Withdraw launch request.

5. The principle chain contract executes the Withdraw launch request, transfers funds to the goal account, and units the Withdraw report to “launched”.

Layer 2 transactions and safety assurance

Layer 2 transactions

1. The person constructs a “Switch” Layer 2 transaction and submits it to the Collector.

2. The Collector packages the switch transaction and different transactions right into a Layer 2 block, executes the transactions within the block, and submits the State of this Layer 2 block to the Ontology predominant chain.

3. Anticipate State affirmation.

After the Operator submits the Layer 2 block State to the Ontology predominant chain, the Challenger may run the Layer 2 block transaction and confirm the correctness of the Layer 2 block State. If it’s not appropriate, the Challenger will gather fraud proof and undergo the Layer 2 good contract to problem the Operator.

Presently, Ontology Layer 2 is offered on the Ontology TestNet for builders to experiment with.

Hyperlink: http://152.32.217.204/

Doc hyperlink: https://github.com/ontio/layer2

Within the subsequent article, we’ll present an in depth efficiency comparability with Layer 2 on different chains.

Appendix: Clarification of Phrases

Layer 2 Transactions

The person has made a request to switch or execute a contract at Layer 2 and has already signed it. This transaction may be the identical because the transaction format of the Ontology predominant chain, or it may be completely different.

Collector

The Collector is a Layer 2 transaction collector. It’s answerable for gathering person’s Layer 2 transactions, verifying and executing the transaction. Each time a Layer 2 block is generated, the Collector is answerable for executing the transactions within the block, updating the standing, and producing Layer 2 contracts that may be interpreted as proof of the state used for safety assurance.

Layer 2 Block

The Collector periodically packages the collected Layer 2 transactions, generates a block containing all Layer 2 transactions, and generates a brand new Layer 2 block.

Layer 2 State

The Collector executes the packaged transactions within the Layer 2 block, updates the state, types all of the up to date state information to generate a Merkle tree, and calculates the foundation hash of the Merkle tree. The foundation hash is the Layer 2 state of the block.

Operator

The Operator is the safety daemon of Layer 2 and is answerable for monitoring whether or not there’s a token switch to Layer 2 or a token switch transaction from Layer 2 to the Ontology predominant chain. The Operator can be answerable for periodically submitting the standing proof of Layer 2. You may go to the Ontology mainnet as proof.

Challenger

The Challenger is answerable for verifying the standing proof submitted by the Operator to the Ontology predominant chain. This requires the Challenger to synchronize Layer 2 transactions from the Operator or the chain to take care of the entire world state. After the Challenger synchronously executes the transaction and updates the standing, it might probably confirm the correctness of the standing proof submitted by the Operator on the mainnet. If it’s not appropriate, the Challenger can generate a fraud proof problem that the Layer 2 contract can clarify.

Proof of Account Standing

Achieved by way of Merkle proof, proof of account standing requires may be obtained from Operators and Challengers. They’re the one events to take care of a whole world state.

Proof of Fraud

Proof of fraud contains the account standing proof earlier than the present Layer 2 block replace.

The earlier Layer 2 block standing certificates and the submitted account standing certificates, proves the legitimacy of the outdated state earlier than the replace. Proof that the outdated state is authorized may be achieved by operating the present block.

Ontology’s enterprise-focused blockchain is able to assist enterprises rework and improve their companies. In case you are experiencing issues with off-chain scalability, digital machines, or a full set of technical techniques, please contact us by way of [email protected]

Supply hyperlink