Git Product home page Git Product logo

blockchain_test's Introduction

Blockchain4Students (B4S)

Blockchain4Students (B4S) is a simple blockchain with focus on understandability, tailored to teach blockchain technology.

Requirements:

Python 3.8.3 Docker version 19 (tested with version 19.03.8, build afacb8b7f0)

This project has been tested with Ubuntu 20.04

Running Blockchain4Students (B4S)

Via Docker

Run ./setup-docker. This creates a blockchain with one node, runnning on default port 5000, mapped to the local machine port 8001. You can access the node's endpoints by opening a browser at: http://0.0.0.0:8001. For example, to get the peers, go to http://0.0.0.0:8001/getPeers

To run more nodes, run docker run --name NAME -p "LOCAL_HOST:DOCKER_HOST" -e node_port=DOCKER_HOST -e miner_address=MINER_ADDRESS -e host=HOST_ADDRESS blockchain4students/blockchain-node:0.1 , replacing the variables. Examples:

docker run --name "blockchain-node-2" -p "5001:5001" -e node_port=5001 -e miner_address="default_address-1" -e host="0.0.0.0" blockchain4students/blockchain-node:0.1

docker run --name "blockchain-node-3" -p "5002:5002" -e node_port=5002 -e miner_address="default_address-2" -e host="0.0.0.0" blockchain4students/blockchain-node:0.1

If you want to add a host, add the option -e host="HOST_NAME".

To debug the containers, run docker ps -a to list your containers. Copy the ID of your container and run docker logs CONTAINER_ID

Via Venv

First, define env variables: duplicate the file .env-example, and rename it to .env. Change the variables value accordingly

Run ./setup-venv

You are now in a virtual env After the initial setup, you can run python3 node.py to run the default node.

To run other nodes: python3 app.py -p ${node_port} -a ${miner_address} -ho ${host}

Teardown

To delete B4S-related containers, as well as generated private keys, run ./cleanup.sh

blockchain_test's People

Contributors

catarinapedreira avatar jrafaelsoares avatar rafaelapb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.