2019-07-19 06:30:31 +03:00
|
|
|
# chia-blockchain
|
2019-08-05 09:16:08 +03:00
|
|
|
Python 3.7 is used for this project.
|
2019-07-19 06:30:31 +03:00
|
|
|
|
|
|
|
### Install
|
|
|
|
|
|
|
|
```bash
|
2019-09-19 10:38:54 +03:00
|
|
|
# for Debian-based distros
|
|
|
|
sudo apt-get install build-essential cmake python3-dev --no-install-recommends
|
|
|
|
|
2019-07-19 06:30:31 +03:00
|
|
|
git submodule update --init --recursive
|
|
|
|
python3 -m venv .venv
|
|
|
|
. .venv/bin/activate
|
2019-09-19 10:38:54 +03:00
|
|
|
pip install wheel
|
2019-07-23 17:11:07 +03:00
|
|
|
pip install .
|
2019-07-19 06:30:31 +03:00
|
|
|
pip install lib/chiapos
|
2019-10-16 11:38:49 +03:00
|
|
|
|
|
|
|
cd lib/chiavdf/fast_vdf
|
|
|
|
# Install libgmp, libboost, and libflint, and then run the following
|
|
|
|
sh install.sh
|
2019-07-19 06:30:31 +03:00
|
|
|
```
|
2019-07-30 09:54:26 +03:00
|
|
|
|
|
|
|
### Run servers
|
2019-10-16 11:38:49 +03:00
|
|
|
When running the servers on Mac OS, allow the application to accept incoming connections.
|
2019-08-14 22:02:15 +03:00
|
|
|
Run the servers in the following order (you can also use ipython):
|
2019-07-30 09:54:26 +03:00
|
|
|
```bash
|
2019-10-21 16:48:27 +03:00
|
|
|
./lib/chiavdf/fast_vdf/server 8889
|
|
|
|
./lib/chiavdf/fast_vdf/server 8890
|
2019-08-14 22:02:15 +03:00
|
|
|
python -m src.server.start_plotter
|
|
|
|
python -m src.server.start_timelord
|
|
|
|
python -m src.server.start_farmer
|
2019-10-21 16:48:27 +03:00
|
|
|
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"
|
2019-09-30 16:15:32 +03:00
|
|
|
python -m src.server.start_full_node "127.0.0.1" 8005
|
2019-09-20 07:57:22 +03:00
|
|
|
|
2019-08-05 09:16:08 +03:00
|
|
|
```
|
2019-10-21 16:48:27 +03:00
|
|
|
Try running one of the full nodes a few minutes after the other ones, to test initial sync.
|
2019-10-09 10:36:58 +03:00
|
|
|
Configuration of peers can be changed in src/config.
|
2019-09-20 07:57:22 +03:00
|
|
|
You can also run the simulation, which runs all servers at once.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
./src/simulation/simulate_network.sh
|
|
|
|
```
|
|
|
|
|
2019-08-05 09:16:08 +03:00
|
|
|
|
|
|
|
### Run tests
|
2019-10-09 10:36:58 +03:00
|
|
|
The first time the tests are run, BlockTools will create and persist many plots. These are used for creating
|
|
|
|
proof of space during testing. The next time tests are run, this won't be necessary.
|
2019-08-05 09:16:08 +03:00
|
|
|
```bash
|
|
|
|
py.test tests -s -v
|
|
|
|
```
|
|
|
|
|
|
|
|
### Run linting
|
|
|
|
```bash
|
|
|
|
flake8 src
|
|
|
|
pyright
|
|
|
|
```
|
2019-10-22 10:44:01 +03:00
|
|
|
|
|
|
|
### 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
|