On-chain refers to any activity, transaction, or data directly recorded on a blockchain. When an event happens “on-chain,” it is included in the everlasting history of the blockchain, and it can be seen by anyone as well as being protected by the consensus rules of the network. Such kinds of activities include sending coins and tokens, engaging with a smart contract, generating NFTs, participating in a DAO, or confirming a block.
The reason for on-chain actions being included by the blockchain is that they receive the main features of the network: openness, unalterability, and security. A transaction cannot be modified or deleted once it is confirmed. Anyone can check it using a block explorer, which gives users the ability to monitor the distribution, engage in contract activities, and the flow of funds without depending on a single authority.
Normally, on-chain transactions come with the cost of a fee, frequently termed โgasโ, because the computers of the network have to handle, confirm, and keep the data. As a result, on-chain operations are seen as very reliable but at the same time being the most costly or slowest, particularly when the network traffic is high.
However, many of the latest protocols now opt for “off-chain” processing to enhance the speed factor, submitting only the final results back to the blockchain. Nevertheless, the on-chain layer still holds the truth.