These are two different transactions on the blockchain. On chain transactions are the transactions available on the blockchain (distributed ledger) and are also visible to all the nodes on the blockchain network. Off-chain transactions, on the other hand,is the movement of value outside of the blockchain. Most people take a look at the definition and wonder, is there any difference? In cryptocurrencies, on- chain transactions are a norm since this is what crypto is all about.
How do they work?
On chain, transactions are considered to be valid when a blockchain reflects the transactions on the distributed public ledger. This includes authentication and validation of a transaction by a defined number of participants. The different details of a transaction are recorded on the block and distributed to the entire blockchain making the transaction irreversible since it can’t be altered.
On-chain transactions take longer because of the different steps that have to happen before a transaction is deemed to be successful. On top of that, the potentially high cost of a transaction can prove off-putting to some of the members in the network.
These are the transactions dealing with the values outside the blockchain and can be carried out using different number of methods. First of all, two parties can have a transfer agreement. Second, a third party might exist who guarantees that the transaction is complete and correct. The third party is some sort of a guarantor in the transaction. Today, payments processors such as PayPal work along these lines.
Off-chain transactions also use a code based payment mechanism. Here, the participant purchases redeemable code to exchange with the cryptoassets. They then give the codes to a third party who redeems them. The third party can choose to redeem the codes in the same cryptoassets or in a different one depending on the service provider of a code.
To make it simple, two parties can exchange even their private keys involving a secure amount of cryptoassets It will never leave the wallet/address but the currency receives a new owner off the blockchain.
Off-chain transactions are executed instantly as compared to the on-chain transactions that can lag for a long time depending on the number of transactions waiting to happen on the same network as well as the network load and the transactions on the queue not yet confirmed.