Authors: Steffen Rattay & Marcel Kaiser

Perun Network is developing a blockchain agnostic state channel framework in the form of a golang library: go-perun. After successfully implementing a backend for Ethereum, Polkadot and Cosmos, we are now extending our solution to the Internet Computer and have received a Dfinity grant for the project. Possible use cases for our peer-to-peer framework reach from micropayments to low-latency gaming integrations. We currently implement it on the Internet Computer as a canister.

Why do we move to ICP as well?

Lately, it could be observed how bridges failed and centralization in DeFi and other ecosystems wreaked havoc. In contrast to this, we see the future of Web3 and DLT in general in its interconnectedness and trust-free usability. Like cities, different blockchain ecosystems make up different units of the digital economy. Communities are the builders of bridges, docks and railways between those. Our primary interest is safety and the reduction of trust required in participants. Starting off as a research project for payment channels on Ethereum, Perun has evolved to support several ecosystems and the functionality and degree of abstraction grew massively: in the long haul, we expect to be able to keep expanding Perun and related projects to support an interoperable cross-chain and cross-L2 ecosystem.

ICP’s architecture adds to the repertoire of chains-to-connect. Its community and developer base is most certainly unique in its interaction with us. We are grateful to have the chance to work with all of you!

What are Channels?

Two users can lock coins on-chain into a so-called payment channel. Once set up, they send transactions by redistributing the coins between them, without contacting the blockchain. When a channel is closed, the last agreed-upon coin distribution is paid out to the users. A channel is similar to a prepaid card: Topped up once, it can be used for a large number of smaller transactions.

Whenever a malicious user tries to close the channel with wrong values, an underlying smart contract guarantees that no coins can be stolen from honest users. State channels are a more powerful channel variant where users can also run smart contracts off-chain. To overcome the fact that channels only connect two users, channel networks have been proposed. They allow payments to be routed off-chain over multiple channels within the network. This variant is called a virtual channel. However, whenever payments are sent over an off-chain link in such a network, every intermediary on this route must lock collateral coins to ensure the correct payout. On top of this, on-chain payment routing introduces delays and additional fees.

Internet Computer integration

Figure 1: Based on the state channel technology, our project is the Perun Framework

We use a canister since it gives us the possibility to directly integrate channels into the blockchain instead of being a 3rd party service. This also makes it easier to realize future projects like cross-chain channels. A structural overview can be found in Figure 1.

The Perun canister tracks all on-chain information about state channels. Users interact with it by calling its public functions.

The Perun protocol

There are four public Functions available: Deposit, Conclude, Conclude Dispute and Withdraw. They work together as shown below.

Figure 2: Channel phase diagram

When Alice and Bob want to open a channel with each other (see Figure 2), they both call Deposit. This sends funds from their accounts to the Perun canister. The channel is then open and can be used for sending transactions as long as both see fit. After they are done, two possibilities exist: the honest case and the dispute case.

In the honest case, both Alice and Bob want to close the channel. Here they can directly call Conclude and withdraw the outcome with Withdraw.

The dispute case happens when Alice and Bob have different outcomes for the channel in mind; they will then use the canister to adjudicate.

A dispute can go over multiple rounds and is always terminated by a call to ConcludeDispute. Alice and Bob can then withdraw the outcome. Thus, the Perun framework works trust-free, independent of who runs a node.

Outlook

Hopefully, we piqued your interest! The Payment channels for ICP are almost done and we are looking forward to completing the off-chain part. We thank the Dfinity Foundation for supporting this project through a grant and are looking forward to future collaboration! Check out our forum post where we want to interact with the community directly. Feel free to reach out.

Future

We plan to add State channels that can execute more complex logic and are much more interesting than pure Payment channels. Besides this, there are many exciting features in the ICP space. We are especially looking forward to supporting multiple currencies per channel and even cross-chain channels. Stay tuned!

Contact

If you want to get in touch with us, feel free to ask us in the ICP forum! We have already contributed in several ways to discussions. Now it’s your turn to ask what you want to know and to express how you feel about our project!

If you are interested in learning more about the Perun Channel Technology and how it can be used to scale your blockchain application, visit our website (https://perun.network/) and our GitHub repo or contact us directly by writing us an email at info@perun.network.