Smart Contracts and state channels

Hello, I had my first meet up in Santiago Chile on Thursday, one of the participants ask the follow, once a state channel is open, participants can modify the code of the smart contract?

1 Like

somebody else sould correct me if I am wrong. but I am assuming you are refering to the execution of smart contracts that were used within state channel transactions, right?

so each party (in the current case 2 parties) needs to execute the code of a smart contract in order to verify and check whether the other party produced the right output with the call of a certain function of that contract.

so if the other party tries to “trick” you then you should get another output when executing the method and thus deny to sign the transaction.

so yes it is possible to modify the code but if this is the case you would be able to identify that and able to reject signing the proposed output.

Yes, I’m asking about the execution of the smart contract on the state channel.

Thanks for the answer.

In a channel you can use transactions similar to on chain, so you can’t update a contract, but you can deploy a new version of it and use this.

1 Like

Hi @herminiaG
Thanks for asking, this is a great question, but I believe you did not formulate it clear enough for all to understand. Please correct me if I am wrong but you are asking “The state channel on-chain logic is handled by a smart contract. Can participants of the channel modify this on-chain contract once the channnel is opened?”. This is how understood the question, so this is what I am answering.

Some context: all other projects build their state channels on top of the blockchain they’ve picked using the provided primitives - ex. smart contracts. That’s why channels are often referred as a layer 2 architecture. This leads to more unpredictable and expensive state channels. Also having a couple of different channel’s implementations will make it more difficult to produce a single wallet app to handle all of those.

The approach Aeternity had taken is radically different - we had built channels inside the protocol itself. That’s how they are a first class citizen. You don’t need a smart contract in order to open a channel - all the opening, closing, disputing, withdrawing and depositing logic is embedded on a protocol level. There are some primitives for watchtowers as well - still on a protocol level. That’s how we get a homogenous channels, all acting in the same predictable way and they are much cheaper and much easier to reason about.

My answer to your question (at least as I understood it) - there is no smart contract that handles the on-chain logic for the state channel at all, thus there is nothing to be modified :slight_smile:

3 Likes