Smart contract

The Kchannels smart contract anchors the system in the Ethereum base layer, providing both security and trust-minimization.

Kchannels works with a single core smart contract, and all assets are pooled there. A single smart contact allows us to reduce contract tracking and gas costs, among other things. The smart contract does not keep track of title (i.e. who owns what)--that is the zones' responsibility. It is also not aware of all the channels present in the system. It is there to hold on to assets being managed by the system and to provide an on-chain recourse for Kchannels clients who are disputing their zones' actions. It somewhat resembles a multi-signature wallet with some additional services added on top. The relatively simplicity of the contract provides for a small attack surface.

The smart contract does NOT implement any special access to let project staff access funds - any funds. Kchannels own actors are explicitly forbidden from even acting as clients to the system they are a part of. The users of the system are always in control of the assets they own. Having said this, the system has an administrative interface, which is limited to management duties such as adding additional zone identities.

Each zone monitors the smart contract for deposits, which are Layer 1 transactions that transfer assets to a channel via the contract. When a zone notices a deposit earmarked for one of its channel owners, it looks up the corresponding channel and credits it. That transaction, once applied, is permanent. It is the zone's responsibility to credit channels properly. Withdrawals are implemented as external transactions, which are also Layer 1 transactions where a zone instructs the removal of funds from the smart contract by submitting a properly signed transaction summary to the smart contract.

If a zone or any other part of Kchannels is ever unavailable, or somehow not in a "sane" state, a user can always withdraw their funds directly from the smart contract by filing a dispute and proving the assets they own. The onus is on the zone to prove it did its job correctly.

Dispute resolution

One of the essential services provided by the smart contract is dispute resolution. Dispute resolution is an on-chain process whereby the smart contract acts as an arbiter between a user and their assigned zone, who may be in disagreement about the state of the channel. The smart contract is deliberately biased against the zone, forcing the zone to justify its actions on-chain in case of a dispute. If the zone is unavailable, and thus unable to answer the challenge, the dispute will still proceed by making a default judgement in favour of the user. Judgements are final and non-repudiated. Once made, they can never be unmade, and the outcome of the dispute is always the final state of the channel.

The smart contract implements a well defined dispute resolution protocol, allowing both the user and his zone to submit proofs of state for inspection. You can read about this in the Dispute Resolution section below.