My understanding is that if someone wants to sell and buy Bitcoin via off-chain transaction, that person needs to set up a payment channel(funding transaction) first and it will recorded on the blockchain. Similarly, when that person closes the off-chain transaction, the final transaction amount will be broadcasted back to the Bitcoin network at the end of the off-chain transaction.
It seems like the first transaction(funding transaction) and the last transaction will be recorded in the bitcoin network even though it's called off-chain.
I'm trying to analyze the Bitcoin transaction data and would like to know if there's a way to tell whether a transaction is a funding transaction or the final transaction resulted from the off-chain transaction. Does Bitcoin transaction data have any feature that tells you if a transaction is a source/result of off-chain transaction? Can I identify those transactions by using information from the columns like input or output?
Plus, if Bitcoin is sent from one Coinbase address to another Coinbase address, is it always an off-chain transaction?
Thank you.