/algorand-state-channels

Development of State Channels for Algorand

Primary LanguageGo

algorand-state-channels

Run the Payment Channel Node Demo

  1. Install and Start Docker and Docker-Compose
  2. Clone this repository:
    git clone https://github.com/dancodery/algorand-state-channels.git
    
  3. Change directory to the cloned repository:
    cd algorand-state-channels
    
  4. Generate .env file:
    touch .env
    
  5. Start the Algorand Sandbox:
    ./sandbox up -v
    
  6. Build and start the Algorand State Channel Nodes:
    docker-compose up -d --build asc-alice asc-bob
    
  7. Run the Payment Channel Demo Script:
    ./docker_payment_channel_demo.sh --config_file=testbed/experiment1.conf
    
  • You can change the commands in docker_payment_channel_demo.sh to run different actions on the payment channel nodes.
  • You can read the logs by running docker-compose logs asc-alice or docker-compose logs asc-bob.
  • You can run cli commands on the payment channel nodes directly by running docker exec -it asc-alice ascli -h or docker exec -it asc-bob ascli -h.
  • You can inspect the blockchain by visiting https://app.dappflow.org/explorer/home in your browser and select the Algorand Sandbox network.

Optional: Development of the Python files

  1. python3.11 -m venv venv_algorand_state_channels
  2. source venv_algorand_state_channels/bin/activate
  3. pip3 install -r requirements.txt

Run the python example usage file

  1. python3 example_usage.py

For Development: Rebuild specific docker container

  1. docker-compose stop asc-alice
  2. docker-compose rm -f asc-alice
  3. docker-compose up -d --build asc-alice
    ...
  4. docker-compose logs asc-alice

For Development: Open terminal for Alice

docker exec -it asc-alice bash

For Development: Open terminal for Bob

docker exec -it asc-bob bash

For Development: Docker-Compose Commands Cheat Sheet

Docker-Compose Action Commands:

  1. docker-compose up [--remove-orphans] [-d] [--build] [container_name] ----> Creates and starts all containers defined in docker-compose.yml, [--remove-orphans] removes ophaned containers, [-d] runs in detached mode, [--build] builds images before starting containers
  2. docker-compose down ----> Stops and removes all containers, images and networks defined in docker-compose.yml
  3. docker-compose start ----> Starts any stopped container defined in docker-compose.yml
  4. docker-compose stop ----> Stops any running container defined in docker-compose.yml
  5. docker-compose pause ----> Pauses any running container defined in docker-compose.yml
  6. docker-compose unpause ----> Unpauses any paused container defined in docker-compose.yml

Docker-Compose Status Commands:

  1. docker-compose ps ----> Lists all containers that are running
  2. docker-compose logs [-f] [container_name] ----> Shows the logs of all containers, [-f] follows log output, [container_name] shows logs of specific container

Acknowledgements

This implementation has taken the following resources for assistance: https://github.com/lightningnetwork/lnd by Olaoluwa Osuntokun at Lightning Labs and https://github.com/lnbook/lnbook by Andreas M. Antonopoulos, Olaoluwa Osuntokun and Rene Pickhardt.

Intended use for educational purposes only.