chia-blockchain/README.md

68 lines
1.9 KiB
Markdown
Raw Normal View History

# chia-blockchain
2019-11-03 19:24:49 +03:00
Python 3.7 is used for this project. Make sure your python version is >=3.7 by typing python3.
### Install
```bash
# for Debian-based distros
2019-11-03 19:24:49 +03:00
sudo apt-get install build-essential cmake python3-dev python3-venv --no-install-recommends
git submodule update --init --recursive
python3 -m venv .venv
. .venv/bin/activate
2019-11-03 19:24:49 +03:00
pip install wheel # For building blspy
2019-10-31 01:25:19 +03:00
pip install -e .
pip install -r requirements.txt
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-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
python -m src.server.start_full_node "127.0.0.1" 8002 -f
2019-11-02 00:53:48 +03:00
python -m src.server.start_full_node "127.0.0.1" 8004 -t -u 8222
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-10-31 00:38:16 +03:00
You can also ssh into the UI for the full node:
```bash
ssh -p 8222 localhost
```
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
2019-10-25 13:25:26 +03:00
proofs 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
2019-10-23 07:23:32 +03:00
mypy src tests
2019-08-05 09:16:08 +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