• Stars
    star
    213
  • Rank 184,331 (Top 4 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated 8 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official Chia Docker Container

Quick Start

These examples shows valid setups using Chia for both docker run and docker-compose. Note that you should read some documentation at some point, but this is a good place to start.

Docker run

Simple example:

docker run --name chia --expose=8444 -v /path/to/plots:/plots -d ghcr.io/chia-network/chia:latest

Syntax

docker run [--name <container-name>] [--expose=<port>] [-v </path/to/plots:/plots>] -d ghcr.io/chia-network/chia:latest

Optional Docker parameters:

  • Give the container a name: --name=chia
  • Accept incoming connections: --expose=8444
  • Volume mount plots: -v /path/to/plots:/plots

Docker compose

version: "3.6"
services:
  chia:
    container_name: chia
    restart: unless-stopped
    image: ghcr.io/chia-network/chia:latest
    ports:
      - 8444:8444
    volumes:
      - /path/to/plots:/plots

Configuration

You can modify the behavior of your Chia container by setting specific environment variables.

Timezone

Set the timezone for the container (optional, defaults to UTC). Timezones can be configured using the TZ env variable. A list of supported time zones can be found here

-e TZ="America/Chicago"

Add your custom keys

To use your own keys pass a file with your mnemonic as arguments on startup

-v /path/to/key/file:/path/in/container -e keys="/path/in/container"

or pass keys into the running container with your mnemonic

docker exec -it <container-name> venv/bin/chia keys add

alternatively you can pass in your local keychain, if you have previously deployed chia with these keys on the host machine

-v ~/.local/share/python_keyring/:/root/.local/share/python_keyring/

or if you would like to persist the entire mainnet subdirectory and not touch the key directories at all

-v ~/.chia/mainnet:/root/.chia/mainnet -e keys="persistent"

Persist configuration, db, and keyring

You can persist whole db and configuration, simply mount it to Host.

-v ~/.chia:/root/.chia \
-v ~/.chia_keys:/root/.chia_keys

Farmer only

To start a farmer only node pass

-e service="farmer-only"

Harvester only

To start a harvester only node pass

-e service="harvester" -e farmer_address="addres.of.farmer" -e farmer_port="portnumber" -v /path/to/ssl/ca:/path/in/container -e ca="/path/in/container" -e keys="none"

Configure full_node peer

To set the full_node peer's hostname and port, set the "full_node_peer" environment variable with the format hostname:port

-e full_node_peer="node:8444"

This will configure the full_node peer hostname and port for the wallet, farmer, and timelord sections of the config.yaml file.

Plots

The plots_dir environment variable can be used to specify the directory containing the plots, it supports PATH-style colon-separated directories.

Or, you can simply mount /plots path to your host machine.

Set the environment variable recursive_plot_scan to true to enable the recursive plot scan configuration option.

Compressed Plots

There are a few environment variables that control compressed plot settings for Harvesters ran with chia-docker. The default settings leave compressed plot harvesting disabled, but it can be enabled.

See the official documentation for a description on what each of these settings do.

Compressed plot farming can be enabled by setting the following:

-e parallel_decompressor_count=1
-e decompressor_thread_count=1

And to use an nvidia GPU for plot decompression, set:

-e use_gpu_harvesting="true"

Log level

To set the log level to one of CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET

-e log_level="DEBUG"

Peer Count

To set the peer_count and outbound_peer_count

for example to set both to 20 use

-e peer_count="20"
-e outbound_peer_count="20"

UPnP

To disable UPnP support (enabled by default)

-e upnp="false"

Log to file

Log file can be used by external tools like chiadog, etc. Enabled by default.

To disable log file generation, use

-e log_to_file="false"

Docker Compose

version: "3.6"
services:
  chia:
    container_name: chia
    restart: unless-stopped
    image: ghcr.io/chia-network/chia:latest
    ports:
      - 8444:8444
    environment:
      # Farmer Only
#     service: farmer-only
      # Harvester Only
#     service: harvester
#     farmer_address: 192.168.0.10
#     farmer_port: 8447
#     ca: /path/in/container
#     keys: generate
      # Harvester Only END
      # If you would like to add keys manually via mnemonic file
#     keys: /path/in/container
      # OR
      # Disable key generation on start
#     keys: 
      TZ: ${TZ}
      # Enable UPnP
#     upnp: true
      # Enable log file generation
#     log_to_file: true
    volumes:
      - /path/to/plots:/plots
      - /home/user/.chia:/root/.chia
#     - /home/user/mnemonic:/path/in/container

CLI

You can run commands externally with venv (this works for most chia CLI commands)

docker exec -it chia venv/bin/chia plots add -d /plots

Is it working?

You can see status from outside the container

docker exec -it chia venv/bin/chia show -s -c

or

docker exec -it chia venv/bin/chia farm summary

Connect to testnet?

docker run -d --expose=58444 -e testnet=true --name chia ghcr.io/chia-network/chia:latest

Connect remotely

Sometimes you may want to access Chia RPCs from outside of the container, or connect a GUI to a remote Chia farm. In those instances, you may need to configure the self_hostname key in the Chia config file.

By default this is set to 127.0.0.1 in chia-docker, but can be configured using the self_hostname environment variable, like so:

docker run -d -e self_hostname="0.0.0.0" --name chia ghcr.io/chia-network/chia:latest

This sets self_hostname in the config to 0.0.0.0, which will allow you to access the Chia RPC from outside of the container (you will still need a copy of the private cert/key for the component you're attempting to access.)

Need a wallet?

To get new wallet, execute command and follow the prompts:

docker exec -it chia-farmer1 venv/bin/chia wallet show

Building

docker build -t chia --build-arg BRANCH=latest .

Healthchecks

The Dockerfile includes a HEALTHCHECK instruction that runs one or more curl commands against the Chia RPC API. In Docker, this can be disabled using an environment variable -e healthcheck=false as part of the docker run command. Or in docker-compose you can add it to your Chia service, like so:

version: "3.6"
services:
  chia:
    ...
    environment:
      healthcheck: "false"

In Kubernetes, Docker healthchecks are disabled by default. Instead, readiness and liveness probes should be used, which can be configured in a Pod or Deployment manifest file like the following:

livenessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - '/usr/local/bin/docker-healthcheck.sh || exit 1'
  initialDelaySeconds: 60
readinessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - '/usr/local/bin/docker-healthcheck.sh || exit 1'
  initialDelaySeconds: 60

See Configure Probes for more information about configuring readiness and liveness probes for Kubernetes clusters. The initialDelaySeconds parameter may need to be adjusted higher or lower depending on the speed to start up on the host the container is running on.

More Repositories

1

chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Python
10,831
star
2

pool-reference

Reference python implementation of Chia pool operations for pool operators
Python
439
star
3

bladebit

A high-performance k32-only, Chia (XCH) plotter supporting in-RAM and disk-based plotting
C
336
star
4

chia-blockchain-gui

Chia blockchain GUI in electron/react
TypeScript
332
star
5

bls-signatures

BLS signatures in C++, using the blst library for BLS12-381
C++
295
star
6

chiapos

Chia Proof of Space library
HTML
267
star
7

website

Old Corporate web site
HTML
153
star
8

clvm

[Contract Language|Chia Lisp] Virtual Machine
Python
86
star
9

oldvdf-competition

VDF competition instructions, and simple implementation
Python
86
star
10

chia-network.github.io

The Current Chia Network website
HTML
75
star
11

clvm_rs

Rust implementation of clvm
Rust
67
star
12

chialisp-web

A docusaurus Chialisp website
JavaScript
67
star
13

drplotter

63
star
14

chiavdf

Chia VDF utilities
C++
60
star
15

clvm_tools

Tools for clvm development
Python
51
star
16

chia-dev-tools

A utility for developing in the Chia ecosystem: Chialisp functions, object inspection, RPC client and more.
Python
45
star
17

chips

JavaScript
45
star
18

chia-exporter

RPC/Websocket based metrics exporter for Chia
Go
39
star
19

cadt

Climate Action Data Trust
JavaScript
35
star
20

chia-gaming

OCaml
29
star
21

vdf-competition

Python
25
star
22

chia-docs

Chia Docs - documentation on the Chia blockchain, protocol and client
JavaScript
20
star
23

chia_rs

Rust crate & wheel with consensus code
Rust
19
star
24

CAT-admin-tool

Admin tool for issuing CATs
Python
18
star
25

proofofspace

HTML
15
star
26

go-chia-libs

Go
15
star
27

cadt-ui

Climate Action Data Trust User Interface
TypeScript
15
star
28

keybase-live-feed

JavaScript
14
star
29

post-mortem

This repo holds chia public post mortem records.
12
star
30

internal-custody

Smart coins to secure funds with M of N signature thresholds, re-keying, clawbacks, and timelock spends
Python
12
star
31

node-clvm-lib

A browser friendly implementation of clvm in TypeScript.
TypeScript
12
star
32

chia-dev-guides

Chia Dev Guides - tutorials for developers building on the Chia blockchain
JavaScript
12
star
33

clvm_tools_rs

clvm_tools ported to rust based on https://github.com/Chia-Mine/clvm_tools-js/, and chialisp-21 dialect with a new compiler.
Rust
11
star
34

chia-nft-minting-tool

Bulk Minting tool for NFTs
Python
9
star
35

hsms

HSMS: hardware security module software/simulator
Python
8
star
36

offline-signing-demo

Python
8
star
37

vdftrack1results

Track 1 results for Chia's VDF competition
C
8
star
38

node-chia-bls

A browser friendly implementation of bls-signatures in TypeScript.
TypeScript
8
star
39

vscode-chialisp-lsp

A Chialisp LSP client for Visual Studio Code
Rust
7
star
40

carbon-asset-token

carbon asset token project
JavaScript
7
star
41

mozilla-ca

6
star
42

chialinks

HTML
6
star
43

chia-wallet-connect-dapp-test

dApplication for wallet connect testing
TypeScript
6
star
44

node-chia-wallet-lib

Unofficial implementations for standard puzzles and the wallet for Chia
TypeScript
4
star
45

walletconnect-rpcs-dapp

An example dApp for testing Chia WalletConnect commands.
TypeScript
3
star
46

ledger_sim

Python
3
star
47

node-chia-rpc

An implementation of Chia RPC calls in TypeScript.
TypeScript
3
star
48

vdftrack2results

Track 2 results for Chia's VDF competition
C++
3
star
49

chia-simulator-docker

Docker Containers for a One-click Chiaβ„’ Simulator Setup.
Dockerfile
3
star
50

pub-metrics-grafana

Jinja
3
star
51

build-images

Docker images used for the release pipelines
Dockerfile
2
star
52

chia-operator

A Kubernetes operator for Chia
Go
2
star
53

helm-charts

Smarty
2
star
54

dev-community-meetings

2
star
55

actions

TypeScript
2
star
56

terraform-modules

common modules for chia terraform these modules are intended to be inherited by downstream projects
HCL
2
star
57

Climate-Tokenization-Engine

JavaScript
2
star
58

ansible-roles

Jinja
2
star
59

chia-toolbox

Tools
Python
2
star
60

Climate-Wallet

Climate Wallet that integrates with the Chia Wallet
JavaScript
2
star
61

chia-clawback-primitive

A developer primitive for clawbacks on the Chia Blockchain
Python
2
star
62

chiabip158

Chia's implementation of BIP 158 - https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
C++
2
star
63

chialisp-crash-course

TypeScript
2
star
64

proofofspaceresults

C++
1
star
65

ecosystem-activity

Go
1
star
66

core-registry-ui

Unified user interface for the carbon Core Registry suite
JavaScript
1
star
67

vdfcontest2results

C++
1
star
68

go-modules

Go
1
star
69

climate-explorer-ui

User Interface for Climate Explorer
JavaScript
1
star
70

public_bluebox_image

Generate an AWS AMI for public use
HCL
1
star
71

climate-token-driver

Provides three types of functionality for carbon tokenization
Python
1
star
72

chia-healthcheck

A simple healthcheck for Chia components - support being added to new Chia components over time
Go
1
star
73

CAT-addresses

Tool that discovers all CAT addresses
Python
1
star
74

coin-tracing-scripts

Python
1
star
75

Climate-Tokenization-Engine-UI

Create tokenized carbon units on the blockchain
JavaScript
1
star
76

mysqlpunch

A small CLI tool for slamming a table in mysql with records to see how it reacts to load
Go
1
star
77

MonsterSprouts

TypeScript
1
star