Skip to content

boschresearch/perun-eth-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Perun

Perun Ethereum Demo CLI

Goreportcard status License: Apache 2.0 CI Testing status

perun-eth-demo allows you to interact with perun Payment-Channels over a CLI powered by go-perun.
You can open a Payment-Channel, send off-chain payments and close it, whereby all interaction with the Ethereum blockchain is handled by go-perun. Give it a try and be amazed by Perun Network 🚀 🌔 !

Security Disclaimer

The authors take no responsibility for any loss of digital assets or other damage caused by the use of this software.
Do not use this software with real funds.

Getting Started

Running perun-eth-demo requires a working Go distribution (version 1.14 or higher).

# Clone the repository into a directory of your choice
git clone https://github.com/perun-network/perun-eth-demo
cd perun-eth-demo
# Compile with
go build
# Check that the binary works
./perun-eth-demo

Demo

The currently only sub-command is demo, which starts the CLI node. The node's configuration file can be chosen with the --config flag. Two sample configurations alice.yaml and bob.yaml are provided. A default network configuration for Alice and Bob is provided in file network.yaml.

Example Walkthrough

In a first terminal, start a ganache-cli development blockchain, prefunding the accounts of Alice and Bob:

ganache-cli --account="0x7d51a817ee07c3f28581c47a5072142193337fdca4d7911e58c5af2d03895d1a,100000000000000000000000" --account="0x6aeeb7f09e757baa9d3935a042c3d0d46a2eda19e9b676283dce4eaf32e29dc9,100000000000000000000000"

In a second and third terminal, cd inside folder perun of go-perun and start the nodes of Alice and Bob with

./perun-eth-demo main.go demo --config alice.yaml

and

./perun-eth-demo main.go demo --config bob.yaml

You can see two transaction in the ganache terminal, which correspond to the deployment of the AssetHolder and Adjudicator contracts.

Once both CLIs are running, e.g. in Alice's terminal, connect to bob with

> connect bob

Then open a payment channel with 100 ETH deposit from both sides with

> open bob 100 100

In the ganache terminal, you can see two new transactions, which correspond to the funding transactions by Alice and Bob.

Now you can execute off-chain payments, e.g. in Bob's terminal with

> send alice 10

The updated balance will immediately be printed in both terminals, but no transaction will be visible in the ganache's terminal.

You may always check the current status with command info.

You can also run a performance benchmark with command

> benchmark alice 1000

which will benchmark 1000 transactions without updating the payment channel balances. The results will be printed in a table.

Finally, you can settle the channel on either side with

> close alice

which will send one concludeFinal and two withdrawal transactions to the ganache blockchain.

Now you can exit the CLI with command exit.

Copyright

Copyright © 2020 Chair of Applied Cryptography, Technische Universität Darmstadt, Germany. All rights reserved. Use of the source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

Contact us at info@perun.network.

About

Proof-of-concept implementation of a CLI payment-channel node for Ethereum.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.8%
  • Shell 1.2%