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.