Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Go to file
2020-04-21 23:31:20 -07:00
.github/workflows Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00
electron-ui Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00
electron-wix Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00
scripts More accurate space estimation, and tests 2020-04-21 23:12:13 -07:00
src Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00
tests Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00
.flake8 Merge branch 'integration' of github.com:Chia-Network/chia-blockchain into integration 2020-02-27 11:23:03 +09:00
.gitignore Correctly detect brew/boost and add vdf_bench to .gitignore 2020-04-21 22:38:51 -07:00
CONTRIBUTING.md Allow replacement of key, 2020-04-08 23:19:06 +09:00
install-timelord.sh Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00
INSTALL.md Add chia start, and remove a bunch of shell scripts. 2020-04-21 23:11:53 -07:00
install.sh Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00
LICENSE Initial commit 2019-07-16 17:32:40 +09:00
LINUX_TIMELORD.md doc and documentation improvements 2020-04-06 01:19:25 -07:00
mypy.ini Changed to mypy from pyright, fix tests (full node still broken) 2019-10-22 16:44:01 +09:00
pyproject.toml Reduce stuff installed for non-developers. 2020-03-27 16:52:49 -07:00
README.md Add chia start, and remove a bunch of shell scripts. 2020-04-21 23:11:53 -07:00
requirements-dev.txt find all cbor2 and miniupnpc references and up them. Warn on k=29 2020-04-21 22:38:51 -07:00
run-py-tests.sh Rename .venv to venv, and create "activate" soft link to venv activate. 2020-03-27 15:41:17 -07:00
setup.py Squashed commit of merge conflicts. 2020-04-21 23:31:20 -07:00

chia-blockchain

Please check out the wiki and FAQ for information on this project.

Python 3.7+ is required. Make sure your default python version is >=3.7 by typing python3.

If you are behind a NAT, it can be difficult for peers outside your subnet to reach you. You can enable UPnP on your router or add a NAT (for IPv4 but not IPv6) and firewall rules to allow TCP port 8444 access to your peer. These methods tend to be router make/model specific.

For testnet most should only install harvesters, farmers, plotter, full nodes, and wallets. Building timelords and VDFs is for sophisticated users in most environments. Chia Network and additional volunteers are running sufficient time lords for testnet consensus.

All configuration and plot data is stored in a directory structure at the $CHIA_ROOT environment variable or at ~/.chia/VERSION-DIR/ if that variable is not set. You can find databases, keys, plots, and logs there. You can set $CHIA_ROOT to the .chia directory in your home directory with export CHIA_ROOT=~/.chia and if you add it to your .bashrc or .zshrc to it will remain set across logouts and reboots.

Install the code

To install chia-blockchain, follow these install instructions according to your operating system. This project only supports 64 bit operating systems.

Remember that once you complete your install you must be in the Python virtual environment which you access from the chia-blockchain directory (or your home directory if you opted for a binary install) with the command . ./activate. Both dots are critical and once executed correctly your cli prompt will look something like (venv) username@machine:~$ with (venv) prepended. Use deactivate should you want to exit the venv.

Migrate or set up configuration files

chia init

Generate keys

First, create some keys by running the following script if you don't already have keys:

chia generate keys

Run a full node + wallet

To run a full node on port 8444, and connect to the testnet, run the following command. Logs are usually at ~/.chia/VERSION/logs/debug.log.

chia start node &
chia start wallet-gui &

If you're using Windows/WSL 2, you should instead run:

chia start node &
chia start wallet-server &

And then run Chia from the Chia Wallet Installer in Windows (not in Ubuntu/WSL 2.)

Run a farmer + full node + wallet

In addition to running a full node, as explained above, you can also run a farmer. Farmers are entities in the network who use their drive space to try to create blocks (like Bitcoin's miners), and earn block rewards. First, you must generate some drive plots, which can take a long time depending on the size of the plots (the k variable). To be competitive on the current network you will probably have to have a few k=29 or larger plots but a k=29 plot currently takes about 4.5 hours to plot on an M.2 PCIe NVMe SSD. Once you have a few plots, run the farmer + full node with the following commands. A full node is also started when you start the farmer.

You can change the working directory and output directory for plotting, with the "-t" (temp) and "-d" (destination) arguments to the chia-create-plots command.

chia-create-plots -k 29 -n 2
chia start farmer &
chia start wallet-gui &

If you're using Windows/WSL 2, you should instead run:

chia-create-plots -k 29 -n 2
chia start farmer &
chia start wallet-server &

Then run Chia from the Chia Windows Wallet installer in Windows (not in Ubuntu/WSL 2.)

Run a timelord + full node + wallet

Note If you want to run a timelord on Linux, see LINUX_TIMELORD.md.

Timelords execute sequential verifiable delay functions (proofs of time or VDFs), that get added to blocks to make them valid. This requires fast CPUs and a few cores per VDF as well as completing the install steps above and running the following from the chia-blockchain directory:

. ./activate
sh install-timelord.sh
chia start timelord &

Tips

Ubuntu 18.04 LTS, 19.xx, Amazon Linux 2, and CentOS 7.7 or newer are the easiest linux install environments.

Windows users (and others) can download Virtualbox and install Ubuntu Desktop 18.04 LTS in a virtual machine. This will allow you to run all of the chia tools and use the Wallet GUI. There are lots of good howtos on the web including this one on installing Ubuntu 19.10 Desktop.

UPnP is enabled by default, to open port 8444 for incoming connections. If this causes issues, you can disable it in the configuration. Some routers may require port forwarding, or enabling UPnP in the router configuration.

Due to the nature of proof of space lookups by the harvester in the current release you should limit the number of plots on a physical drive to 50 or less. This limit will significantly increase soon.

You can also run the simulation, which runs all servers and multiple full nodes, locally. Note the the simulation is local only and requires installation of timelords and VDFs. The introducer will only know the local ips of the full nodes, so it cannot broadcast the correct ips to external peers.

chia-start-sim

uvloop

For potentially increased networking performance, install uvloop:

pip install -e ".[uvloop]"

You can also use the HTTP RPC api to access information and control the full node:

curl -X POST http://localhost:8555/get_blockchain_state
curl -d '{"header_hash":"afe223d75d40dd7bd19bf35846d0c9dce608bfc77ee5baa9f9cd6b98436e428b"}' -H "Content-Type: application/json" -X POST http://localhost:8555/get_header