This repository contains the CKB demo client, which utilizes the go-perun channel library.
We use various tools to enable a convenient setup for the local development testnet. If you want to use our setup-devnet.sh script, make sure the following commandline tools are installed:
jq:- Used to parse and edit some configuration files.
sedandawk:- We modify some fields of the files generated by the
ckb init --chain devcommand usingsedandawk.
- We modify some fields of the files generated by the
tmuxandtmuxp:tmuxpis a session manager fortmuxthat allows to easily create descriptive.yamlconfiguration files to create and attach totmuxsessions.
expect:- We completely automize the process for test-wallet creation, deploying of contracts etc. To make this work reliably, we use
expectwhich allows to describe how a commandline application is fed input.
- We completely automize the process for test-wallet creation, deploying of contracts etc. To make this work reliably, we use
make:- Not strictly necessary, but it should be available on most systems by default. In case you do not want to install
makecheck out theMakefilecontent and issue the command on your own.
- Not strictly necessary, but it should be available on most systems by default. In case you do not want to install
ckbwith version0.109.0or higher.ckb-cliwith version1.4.0or higher.capsulewith version0.9.2.dockerand a runningdockerdinstance!
Clone this repository:
$ git clone git@github.com:perun-network/perun-ckb-demo
Initiliaze git submodules and make sure all dependencies are installed.
$ cd perun-ckb-demo
$ git submodule update --init --recursive
Build the demo client:
$ go build -o perun-ckb-demo
Spin up the local testnet. For this change to the perun-ckb-demo/devnet directory and issue the make dev command.
NOTE: Make sure you are in a terminal that is not already running within tmux. make dev will use this terminal window and create a tmux session.
$ cd ./devnet
$ make dev
Wait for ~15 seconds. This is the time it takes for the devnet setup to be completed (deployed all contracts, funded testnet accounts etc.).
If you are comfortable using tmux you can of course use the devnet session, otherwise in a new terminal window start the perun-ckb-demo.
NOTE: Make sure you are in the root directory of the perun-ckb-demo repository.
$ cd perun-ckb-demo/
$ ./perun-ckb-demo
You will be greeted with a demo window that is split into two panes:
ctrl+a: Select left panectrl+b: Select right panetab: Cycle through selectable fieldsEnter: Select or confirm highlighted fieldr: Go back to parent pageq: Close the demo
Let's use the left side for Alice and the right side for Bob:
We will use Bob to view the channels he has currently open with others and Alice to open a new channel with Bob.
We will use Alice to open a channel with 400 CKBytes.
After issuing the open transaction, we have to wait for it to be confirmed on-chain. Both parties will wait:
After a few seconds the transaction is confirmed on-chain and both parties were able to observe that fact. This will result in both Alice and Bob viewing the now offically established channel.
Let's use Alice to send ten micropayments of 20 CKBytes per payment to Bob via their channel.
We can observe the fact that multiple payments were issued by looking at the channels version number, which was incremented by ten, the amount of micropayments issued by Alice.
Now we use Bob to settle the channel.
After a few seconds the channels settlement is confirmed on-chain and we can view the updated balances for Bob and Alice.











