Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Go to file
2019-11-02 21:02:01 -07:00
lib use preincrement instead of postincrement. fixed issue with float precision by using akashnil equation 2019-11-02 12:39:47 -07:00
src Get rid of "bits" class variable. 2019-11-01 15:34:16 -07:00
tests __bytes__, cbor, etc 2019-11-01 14:53:48 -07:00
.flake8 New blockchain class implementation 2019-09-24 15:01:32 +09:00
.gitignore .gitignore changes 2019-10-10 13:10:18 +09:00
.gitmodules Start on prompt 2019-10-29 09:39:02 +09:00
LICENSE Initial commit 2019-07-16 17:32:40 +09:00
mypy.ini Changed to mypy from pyright, fix tests (full node still broken) 2019-10-22 16:44:01 +09:00
README.md __bytes__, cbor, etc 2019-11-01 14:53:48 -07:00
requirements.txt __bytes__, cbor, etc 2019-11-01 14:53:48 -07:00
setup.py Remove CBOR tags 2019-10-31 18:33:03 -07:00

chia-blockchain

Python 3.7 is used for this project.

Install

# for Debian-based distros
sudo apt-get install build-essential cmake python3-dev --no-install-recommends

git submodule update --init --recursive
python3 -m venv .venv
. .venv/bin/activate
pip install -e .
pip install -r requirements.txt

cd lib/chiavdf/fast_vdf
# Install libgmp, libboost, and libflint, and then run the following
sh install.sh

Run servers

When running the servers on Mac OS, allow the application to accept incoming connections. Run the servers in the following order (you can also use ipython):

python -m src.server.start_plotter
python -m src.server.start_timelord
python -m src.server.start_farmer
python -m src.server.start_full_node "127.0.0.1" 8002 -f
python -m src.server.start_full_node "127.0.0.1" 8004 -t -u 8222
python -m src.server.start_full_node "127.0.0.1" 8005

Try running one of the full nodes a few minutes after the other ones, to test initial sync. Configuration of peers can be changed in src/config. You can also run the simulation, which runs all servers at once.

./src/simulation/simulate_network.sh

You can also ssh into the UI for the full node:

ssh -p 8222 localhost

Run tests

The first time the tests are run, BlockTools will create and persist many plots. These are used for creating proofs of space during testing. The next time tests are run, this won't be necessary.

py.test tests -s -v

Run linting

flake8 src
mypy src tests

Configure VS code

  1. Install Python extension
  2. Set the environment to ./.venv/bin/python
  3. Install mypy plugin
  4. Preferences > Settings > Python > Linting > flake8 enabled
  5. Preferences > Settings > Python > Linting > mypy enabled
  6. Preferences > Settings > mypy > Targets: set to ./src and ./tests