Add CKB Payment Channel Example #257
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: pull_request | |
jobs: | |
test-examples: | |
name: Test Examples | |
runs-on: ubuntu-latest | |
env: | |
ganache-image: trufflesuite/ganache:v7.9.1 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22' | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Pull ganache-cli image | |
run: docker pull ${{ env.ganache-image }} | |
- name: Simple Client | |
working-directory: simple-client | |
env: | |
MNEMONIC: pistol kiwi shrug future ozone ostrich match remove crucial oblige cream critic | |
run: | | |
docker run --rm --name ganache --detach --publish 8545:8545 ${{ env.ganache-image }} -b 5 -a 2 -m "$MNEMONIC" | |
sleep 5 | |
go run . | |
docker stop ganache | |
- name: Payment Channel CKB | |
working-directory: payment-channel-ckb | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq sed gawk tmux tmuxp expect make | |
curl -LO https://github.com/nervosnetwork/ckb/releases/download/v0.109.0/ckb_v0.109.0_x86_64-unknown-linux-gnu.tar.gz | |
tar -xzf ckb_v0.109.0_x86_64-unknown-linux-gnu.tar.gz | |
sudo cp ckb_v0.109.0_x86_64-unknown-linux-gnu/ckb /usr/local/bin/ | |
curl -LO https://github.com/nervosnetwork/ckb-cli/releases/download/v1.4.0/ckb-cli_v1.4.0_x86_64-unknown-linux-gnu.tar.gz | |
tar -xzf ckb-cli_v1.4.0_x86_64-unknown-linux-gnu.tar.gz | |
sudo cp ckb-cli_v1.4.0_x86_64-unknown-linux-gnu/ckb-cli /usr/local/bin/ | |
curl -LO https://github.com/nervosnetwork/capsule/releases/download/v0.9.2/capsule_v0.9.2_x86_64-linux.tar.gz | |
tar -xzf capsule_v0.9.2_x86_64-linux.tar.gz | |
sudo cp capsule_v0.9.2_x86_64-linux/capsule /usr/local/bin/ | |
cd ./devnet | |
chmod +x setup-devnet.sh print_accounts.sh deploy_contracts.sh sudt_helper.sh | |
./setup-devnet.sh | |
ckb run > /dev/null 2>&1 & | |
sleep 3 | |
./print_accounts.sh | |
sleep 6 | |
expect fund_accounts.expect | |
sleep 10 | |
./deploy_contracts.sh | |
sleep 15 | |
./sudt_helper.sh fund | |
sleep 10 | |
./sudt_helper.sh balances | |
sleep 15 | |
cd .. | |
go run main.go | |
- name: Payment Channel ETH | |
working-directory: payment-channel | |
env: | |
KEY_DEPLOYER: "0x79ea8f62d97bc0591a4224c1725fca6b00de5b2cea286fe2e0bb35c5e76be46e" | |
KEY_ALICE: "0x1af2e950272dd403de7a5760d41c6e44d92b6d02797e51810795ff03cc2cda4f" | |
KEY_BOB: "0xf63d7d8e930bccd74e93cf5662fde2c28fd8be95edb70c73f1bdd863d07f412e" | |
BALANCE: "10000000000000000000" | |
run: | | |
docker run --rm --name ganache --detach --publish 8545:8545 ${{ env.ganache-image }} --wallet.accounts $KEY_DEPLOYER,$BALANCE $KEY_ALICE,$BALANCE $KEY_BOB,$BALANCE --b=5 | |
sleep 5 | |
go run . | |
docker stop ganache | |
- name: Payment Channel DOT | |
working-directory: payment-channel-dot | |
run: | | |
docker run --name polkadot --detach --rm -it -p 9944:9944 ghcr.io/perun-network/polkadot-test-node:0.4.0 | |
sleep 5 | |
go run . | |
docker stop polkadot | |
- name: App Channel | |
working-directory: app-channel | |
env: | |
KEY_DEPLOYER: "0x79ea8f62d97bc0591a4224c1725fca6b00de5b2cea286fe2e0bb35c5e76be46e" | |
KEY_ALICE: "0x1af2e950272dd403de7a5760d41c6e44d92b6d02797e51810795ff03cc2cda4f" | |
KEY_BOB: "0xf63d7d8e930bccd74e93cf5662fde2c28fd8be95edb70c73f1bdd863d07f412e" | |
BALANCE: "10000000000000000000" | |
run: | | |
docker run --rm --name ganache --detach --publish 8545:8545 ${{ env.ganache-image }} --wallet.accounts $KEY_DEPLOYER,$BALANCE $KEY_ALICE,$BALANCE $KEY_BOB,$BALANCE --b=5 | |
sleep 5 | |
go run . | |
docker stop ganache | |
- name: Payment Channel XLM | |
working-directory: payment-channel-xlm | |
run: | | |
chmod +x ./testdata/docker/build.sh | |
./testdata/docker/build.sh | |
chmod +x ./quickstart.sh | |
./quickstart.sh standalone & | |
sleep 30 | |
go run ./ | |