2019-07-19 06:30:31 +03:00
# chia-blockchain
2020-01-15 07:10:34 +03:00
Please check out the [wiki ](https://github.com/Chia-Network/chia-blockchain/wiki ) and [FAQ ](https://github.com/Chia-Network/chia-blockchain/wiki/FAQ ) for information on this project.
2020-01-13 16:19:53 +03:00
2020-04-02 03:29:48 +03:00
Python 3.7+ is required. Make sure your default python version is >=3.7 by typing `python3` .
2019-12-05 21:43:24 +03:00
2020-03-31 03:46:08 +03:00
If you are behind a NAT, it can be difficult for peers outside your subnet to reach you. You can enable
[UPnP ](https://www.homenethowto.com/ports-and-nat/upnp-automatic-port-forward/ ) 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.
2019-07-19 06:30:31 +03:00
2020-04-02 03:29:48 +03:00
For testnet most should only install harvesters, farmers, plotter and full nodes. Building timelords and VDFs is for sophisticated users in most environments. Chia Network and additional volunteers are running sufficient time lords for testnet consensus.
2019-12-25 22:18:07 +03:00
2020-04-02 03:29:48 +03:00
All data is now stored in the $CHIA_ROOT environment variable. or ~/.chia/VERSION-DIR/ if unset. You can find databases, keys, plots, logs here. You can set $CHIA_ROOT to the .chia directory in your home directory with `export CHIA_ROOT=~/.chia` .
2020-03-30 00:29:39 +03:00
2020-02-07 08:14:54 +03:00
## Step 1: Install the code
2020-04-02 03:57:59 +03:00
To install chia-blockchain, follow [these install ](INSTALL.md ) instructions according to your operating system. This only supports 64 bit operating systems.
2020-03-27 20:33:07 +03:00
2020-04-02 03:29:48 +03:00
Remember that once you complete your install you **must be in the Python virtual environment** which you access from the chia-blockchain directory with the command `. ./activate` . Both dots are critical and once executed correctly your cli prompt will look something like `(venv) username@machine:~$` with the (venv) prepended. Use `deactivate` should you want to exit the venv.
2019-12-25 22:18:07 +03:00
2020-03-09 16:44:01 +03:00
## Step 2: Generate keys
2019-11-09 00:51:01 +03:00
First, create some keys by running the following script:
2019-07-30 09:54:26 +03:00
```bash
2020-03-29 23:28:14 +03:00
chia-generate-keys
2019-11-09 00:51:01 +03:00
```
2019-09-20 07:57:22 +03:00
2020-03-24 16:43:41 +03:00
## Step 3a: Run a full node + wallet
2020-01-12 04:57:51 +03:00
To run a full node on port 8444, and connect to the testnet, run the following command.
2020-03-19 09:28:17 +03:00
If you want to see std::out log output, modify the logging.std_out variable in ./config/config.yaml.
2020-01-31 11:16:40 +03:00
2019-11-09 00:51:01 +03:00
```bash
2020-03-30 22:23:50 +03:00
chia-start-node &
chia-start-wallet-gui &
2019-08-05 09:16:08 +03:00
```
2019-09-20 07:57:22 +03:00
2020-03-24 16:43:41 +03:00
## Step 3b: Run a farmer + full node + wallet
2020-01-13 16:19:53 +03:00
Instead of running only a full node (as in 4a), you can also run a farmer.
2019-11-09 00:51:01 +03:00
Farmers are entities in the network who use their hard drive space to try to create
blocks (like Bitcoin's miners), and earn block rewards. First, you must generate some hard drive plots, which
2020-01-12 04:57:51 +03:00
can take a long time depending on the [size of the plots ](https://github.com/Chia-Network/chia-blockchain/wiki/k-sizes )
2020-03-19 09:28:17 +03:00
(the k variable). Then, run the farmer + full node with the following script. A full node is also started.
You can also change the working directory and
2020-01-31 11:16:40 +03:00
final directory for plotting, with the "-t" and "-d" arguments to the create_plots script.
2019-09-20 07:57:22 +03:00
```bash
2020-03-29 23:28:14 +03:00
chia-create-plots -k 20 -n 10
2020-03-30 22:23:50 +03:00
chia-start-farmer &
chia-start-wallet-gui &
2019-09-20 07:57:22 +03:00
```
2020-01-15 07:07:02 +03:00
2020-03-24 16:43:41 +03:00
## Step 3c: Run a timelord + full node + wallet
2020-03-27 19:36:54 +03:00
*Note*
If you want to run a timelord on Linux, see LINUX_TIMELORD.md.
2020-04-02 03:57:59 +03:00
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
2019-12-25 22:18:07 +03:00
both install steps above.
2019-10-31 00:38:16 +03:00
```bash
2020-03-30 22:23:50 +03:00
chia-start-timelord &
chia-start-wallet-gui &
2019-10-31 00:38:16 +03:00
```
2019-12-25 22:18:07 +03:00
## Tips
2019-11-09 00:51:01 +03:00
When running the servers on Mac OS, allow the application to accept incoming connections.
2019-11-28 09:36:01 +03:00
2020-04-02 03:57:59 +03:00
Ubuntu 18.04 LTS, 19.xx, Amazon Linux 2, and CentOS 7.7 or newer are the easiest linux install environments currently.
2019-12-25 22:18:07 +03:00
2020-01-12 04:57:51 +03:00
UPnP is enabled by default, to open port 8444 for incoming connections. If this causes issues,
2019-12-25 22:18:07 +03:00
you can disable it in the configuration. Some routers may require port forwarding, or enabling
UPnP in the router configuration.
2019-11-28 09:36:01 +03:00
2020-04-02 03:57:59 +03:00
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 should significantly increase before soon.
2019-12-04 03:14:13 +03:00
2019-11-28 09:36:01 +03:00
You can also run the simulation, which runs all servers and multiple full nodes, locally, at once.
2019-12-25 22:18:07 +03:00
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.
2019-11-09 00:51:01 +03:00
```bash
2020-03-30 22:23:50 +03:00
chia-start-sim
2019-11-09 00:51:01 +03:00
```
2020-01-23 08:19:47 +03:00
2020-03-31 03:46:08 +03:00
## uvloop
2020-01-23 08:19:47 +03:00
For increased networking performance, install uvloop:
```bash
pip install -e ".[uvloop]"
```
2020-01-29 06:16:29 +03:00
You can also use the [HTTP RPC ](https://github.com/Chia-Network/chia-blockchain/wiki/Networking-and-Serialization#rpc ) api to access information and control the full node:
2020-01-23 08:19:47 +03:00
2020-01-29 06:16:29 +03:00
```bash
2020-03-10 01:38:30 +03:00
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
2020-02-07 08:14:54 +03:00
```