chia-blockchain/README.md

65 lines
1.8 KiB
Markdown
Raw Normal View History

# chia-blockchain
2019-08-05 09:16:08 +03:00
Python 3.7 is used for this project.
### Install
```bash
# 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 wheel
2019-07-23 17:11:07 +03:00
pip install .
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-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
```
### 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