Lesson 2: Let's understand on-chain and off-chain

Why does this lesson matter?

Blockchain-based applications can be used in a variety of ways. In order to make the most of the characteristics of Bitcoin and Ethereum, it is important to understand in detail the parts of the blockchain that are used and not used. In this lesson, we will learn about on-chain and off-chain to expand the image of blockchain applications.

What you can learn in this lesson

  • Overview of on-chain
  • Advantages and disadvantages of on-chain
  • How to use on-chain and off-chain

目次を表示する

What is the difference between on-chain and off-chain?

We have learned about the features of DeFi, but the mechanism itself is not very simple.

Some of them do not make good use of the properties of public chains.

In this section, we will learn about the difference between on-chain and off-chain, and how to best use them together.


What is on-chain?

On-chain refers to processing using the blockchain.

The name comes from the context of "processing on a blockchain.

In the case of on-chain, transactions are immediately recorded in the blockchain, making them difficult to tamper with.


What is off-chain?

Off-chain refers to a process that does not use the blockchain.

The term was coined as a synonym for on-chain.

In the case of off-chain, transactions are not immediately recorded into the blockchain, but are mostly recorded in an internal database managed by the service provider.

In the case of off-chain, transactions are not immediately recorded in the blockchain, but are mostly recorded in an internal database managed by the service provider, thus allowing the administrator of the database to commit fraud.


The difference between on-chain and off-chain

At first glance, it may seem that all processing should be done on-chain, but blockchains have scalability issues.

For example, in a cryptocurrency exchange, countless transactions are executed per second.

In order to process all these transactions, an on-chain system with scalability issues is not suitable.

Therefore, instead of processing all transactions on-chain, the majority of transactions are processed off-chain and recorded periodically in the on-chain.


In addition, due to the fact that information recorded in the blockchain is difficult to falsify, it is necessary to be very careful when recording information.

For example, if personal information is accidentally recorded on-chain, it is extremely difficult to erase.

For these reasons, it has become common to combine off-chain processing instead of on-chain processing.


Check your achievement

Click the “Tick” button
if you understand the lesson so far.

Examples of different usage in DeFi

Let's take the examples we have learned so far on how to use on-chain and off-chain in the field of DeFi and deepen our understanding.

Here, we will use exchanges as an example.


Off-Chain Exchanges 

Most of the exchanges that we use on a daily basis are utilizing off-chain.

Since on-chain and off-chain are the underlying mechanisms, it is difficult to see them with the naked eye.

However, transactions in exchanges are processed in the exchanges' internal database.

The on-chain is only used when a user makes a withdrawal from an exchange to a wallet.

This type of exchange with a specific administrator is called a centralized exchange (CEX).


On-Chain Exchanges

An on-chain exchange is called a DEX (Decentralized Exchange).

DEX is characterized by the fact that it does not have a specific administrator and thus does not have inconveniences such as unavailability during holidays or maintenance periods like CEX.

An example of DEX is KyberSwap.

By connecting your wallet to KyberSwap, you can make transactions without a specific administrator, and the transaction results are immediately recorded in the blockchain.

Since you can trade directly with your own wallet, there is no need to deposit your assets on an exchange.


Exchanges that combine on-chain and off-chain

There are some exchanges that combine both on-chain and off-chain trading.

DEX, which was developed using the 0x mechanism, uses the off-chain for orders that require fast processing, and uses the on-chain only at the moment the transaction is actually executed.


Check your achievement

Click the “Tick” button
if you understand the lesson so far.

Lesson 2: Let's understand on-chain and off-chain

0%

0%

You haven’t finished all the lessons. Make sure to complete them before taking a quiz!

You can start a quiz by clicking the button below.