Skip to content

Fraunhofer-FIT-COOP/LabChain

Repository files navigation

LabChain

In our BitLab Blockchain Course we develop our own blockchain platform.

Objectives for the Platform are:

  • Exchangeable components
  • Strong documentation
  • Excellent test coverage
  • Well established software engineering processes
  • Good maintainability and extendability after project - conclusion

Project Prerequisites

Please use git precommit hooks to style check before commiting. We created a global pre-commit hook which you have to install by calling ./scripts/install-hooks.bash.

For the Hook to work, you'll need to install pycodestyle: pip install pycodestyle

This script creats a symlink from .git//hooks/pre-commit to scripts/pre-commit.bash. It is based on a script of sigmoidal.io (https://sigmoidal.io/automatic-code-quality-checks-with-git-hooks/) and the pep8-git-hook by cbrueffer (https://github.com/cbrueffer/pep8-git-hook).

Setup

This software is tested with Python 3.5+

Run the following to install all dependencies:

pip3 install -r requirements.txt

Run the Node

python3 node.py --port 8080 --peers <ip1>:<port1> <ip2>:<port2> ...

-v and -vv set the log level to INFO or DEBUG. -p or --plot enables frequent plotting of the blockchain into ~/.labchain/plot --plot-dir <directory> lets you choose a different directory for plot output --plot-auto-open enables opening the plot in your browser whenever it is created (may become annoying)

Run the Client

python3 client.py <blockchain-node-ip> <blockchain-node-port>

-v and -vv set the log level to INFO or DEBUG.

Run the Web Client

Run python3 client_api.py.

Make a copy of the directory ~/web-client and move the copy outside the project directory, so that you won't push the Node packages to repository.

Install Node.js: https://nodejs.org/en/

After installing Node, run the command npm install inside the copy of web-client directory to install the necessary Node packages.

After installing the necessary packages, run npm run build. You will see a directory named 'dist' afterward.

Run npm install -g serve to install Serve, a static file server to host the web client in local network.

After installing Serve, run the command serve inside the dist directory to host our web client. You can test the web client in http://localhost:5000

Run the unit tests

Executing a single test:

python3 -m unittest test.<test_name>

Notice that you must not add a .py to the name of the test.

For running all the unit tests execute:

python3 -m unittest discover

TODO

  • Check if README is still correct
  • Changed directory structure
  • Remove presentations
  • Refactor names
  • Remove Node red stuff and MQTT
  • Remove visualizer
  • Clean up existing branches
  • Remove nogas and check PEP8 Styleguide
  • Check unit tests
  • Add an example (quick start/ getting started) to the README
  • Remove mocks
  • Introduce version number
  • Remove constraint to store only a certain number of preceding blocks
  • Check difficulty calculation
  • Check block timestamp
  • Put every class into a file
  • Update versions in PIP requirements file
  • Remove 10 seconds delay to wait for incoming transactions
  • Currently the blocksynchronisation seems not to work ( > 2 peers) -> fix it
  • Remove auto discovery mechanism
  • The test_account.py uses the MockCryptoHelper but should use the real CryptoHelper
  • Check the calls of the crypto helper methods (First json.dumps(...) then in the crypto helper json.loads(...). There must be a better way.)
  • Add Status Information when starting the node (without verbose mode)
  • Clean up logging (better differentiation between log levels)

Nice to have

  • Use JSON for configuration
  • Remove SQLite file from ressource directory
  • Rename configuration in default_configuration and copy it in case there is no configuration provided
  • Check and refactor block explorer
  • Blockchain instance as singleton
  • Check networking class (max number of connections,...)
  • Remove large number of parameters in functions
  • Create a setup.py
  • Create a docker file (data directory must be mountable and the node must be configurable)
  • move to gitlab
  • mirror to github repository (https://github.com/Fraunhofer-FIT-COOP/LabChain)

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published