If I create a smart contract inside a channel, will that smart contract ever be deployed on chain? Are there variables that persist on blockchain?
Yep, quite a few of them: who the participants are, what their signing method is (if attached), what is the total amount of tokens dedicated to the channel, last seen on-chain
state_hash and etc. Most of those are defined in the
channel_create_tx opening transaction and are not allowed to be changed later on. You can see all of the data persisted for the channel on-chain here. Note that this changes a bit after Fortuna hardfork.
Usually off-chain data stays off-chain, except of the dispute scenario. Since the Force progress transaction produces the next off-chain state on-chain, it is expected the whole latest state to be provided on-chain, including any contracts and their states. You can read more about it here.
an additional question regarding that topic:
- so in case of a forced closing only the latest state and the used contract(s) are being published right? this means that there won’t be any history visible right? (assuming we don’t have a certain amount of slash transactions being published)
Yes, exactly. Only the latest state is published. If you had a contract in the past that is not present in the latest state - it is not posted on-chain.