Chia Coin日, 02/05/2021 - 21:30 的修訂版本


最後更新: 2021-05-02



  • 區塊時間: 每 5 分鐘 16 個區塊通證
  • XCH區塊獎勵(reward): 每區塊獎勵 2 XCH, 每 3 年減半
  • 共識算法類型: Proof of Space and Time
  • 共識算法: Nakamoto
  • Program: Python 3.7 and above

Chia(XCH) vs Filecoil(FIL)

1. Chia 硬盤中存儲的數據是完全無意義的
2. Filecoin有很高的挖礦門檻(抵押, Ram)
3. Filecoin需要大量的帶寬資源

Size of the plots (V1.04)

  • K32: 102G     # Tmp: 332G, HDD@20hrs
  • K33: 208G     # Tmp: 589G, ?
  • ...


  • Ubuntu 18.04/ Debian 10 LTS non-root Installation
  • Link
  • Plot
  • 多收割機(harvester)
  • Chia Keys Architecture
  • 術語


Ubuntu 18.04/ Debian 10 LTS non-root Installation


apt-get install python3.7-venv python3.7-distutils python3.7-dev -y

useradd -s /bin/bash chia -m

su chia;

cd ~

python3.7 -m venv chia-venv

source chia-venv/bin/activate

pip install --upgrade pip

# Install binary wheels

pip install chia-blockchain==1.1.2

# Usage

source chia-venv/bin/activate

chia -h

# Upgrade from previous version

cd chia-blockchain

chia stop -d all






# Migrate or set up configuration files

# /home/chia/.chia

chia init

# Generate keys

chia keys generate

# -n 2 will create two plots of type k=32

mkdir plots; cd plots

chia plots create -k 32 -n 2

# disable upnp (Restart to take effect)

chia configure -upnp false

# peer DB which is located at




# Run a full_node + farmer + harvester + wallet

chia start {service}

  • "farmer"     start the farmer, harvester, a full node, and the wallet.
  • "farmer-no-wallet"
  • "node"       start only the full node


-r, --restart: Restart of running processes


chia start farmer

Daemon not started yet
Starting daemon
chia_harvester: started
chia_farmer: started
chia_full_node: started
chia_wallet: started

Solo Farm

= farmer + harvester + full_node on the same machine.

Full nodes

Full nodes are always connected to another random set of full nodes in the network.

(Peer Protocol)


Chia's farmers are analogous to Bitcoin's miners.

They earn block rewards and fees by trying to create valid blocks before anyone else.

Farmers don't maintain a copy of the blockchain, but they trust a full node to provide updates.

Farmers communicate with harvesters (individual machines that actually store the plots) through the harvester protocol.


control the actual plot files by retrieving qualities or proofs from disk.
maintain a private key for each plot.







Phase 1 generates all of your proofs of space by creating seven tables of cryptographic hashes and saving them to your temporary directory.

Phase 2 back-propagates through the hashes,

Phase 3 sorts and algorithmically compress these hashes in the temporary directory while starting to build the final file

Phase 4 completes the file and moves it into your final plot file.

"-2" is in use during phase 3 and 4
When phase 4 is done, if -2 = -d, it will simply rename the .plot.2.tmp to .plot

Plotting can be done entirely offline and needs nothing from the blockchain to complete.

How do I know if my plots are OK?

return a number around 100, which means it found around 100% of the attempted proofs of space.

HDD ~ 32k(109G)

-t           # temp

-d          # destination

-n n        # The number of plots that will be made, in sequence.

-f [farmer pk]: This is your "Farmer Public Key". Utilise this when you want to create plots on other machines for which you do not want to give full chia account access. To find your Chia Farmer Public Key use the following command: chia keys show

-p [pool pk]: This is your "Pool Public Key". Utilise this when you want to create plots on other machines for which you do not want to give full chia account access. To find your Chia Pool Public Key use the following command: chia keys show

-b [memory buffer size MiB]: Define memory/RAM usage. Default is 4608 (4.6 GiB)

More RAM will marginally increase speed of plot creation.
Please bear in mind that this is what is allocated to the plotting algorithm alone.
Code, container, libraries etc. will require additional RAM from your system.

-r, --num_threads INTEGER       Number of threads to use  [default: 2]

# chia init
chia plots create -k 32 -n 2 -b 9000 -f ? -p ?

plotting strategy

plot on say your gaming machine(farmer) and then move your plots to a Raspberry Pi 4(remote harvester) with a lot of USB ports.




# 查看 plot 放在那裡

chia plots show


# Verify plot 的有效性

# Try 100 sample challenges for each plot.

chia plots check -n 100

 : INFO     Searching directories ['/home/chia/plots']
 : INFO     Found plot /home/chia/plots/plot-k32-2021-04-25-20-48-?.plot of size 32
 : INFO     Loaded a total of 1 plots of size 0.09899909545038099 TiB, in 0.15807771682739258 seconds
 : INFO        Proofs 91 / 100, 0.91

Plot Format

  • plot id             # (32 byte) plot id = sha256 (pool pk, plot pk)
  • kn                   # i.e. 32
  • memo             # pool pk, farmer pk, local sk (這個隨機主私鑰是P盤時隨機生成的)
  • plot data         # ie. 101G

Plot public key

which is generated by combining the farmer public key with the local public key.

The local public key is a totally random key that is created for each plot, and put into the plot.

Moving plots

A) within the same machine

1. Move the plot file
    rename a plot file from *.plot to *.plot-mv, copy/move it, and rename it back.

2. Add the new plot directory

chia plots add -d '/Users/example/folder'

B) to a different machine

1. Install chia on the new machine

2. Find your private keys using chia keys show on the old machine,

3. Copy the 24 mnemonic words (this is your private key) and
    add them to the new machine using

chia keys add

4. As A


查看 farm 的情況


chia show -s -c

-s, --state                     Show the current state of the blockchain

Current Blockchain Status: Full Node Synced

Peak: Hash: 26d4d388659a27fa66ff2dfdf8622d7ca9b9bda00601ae109b3047289d0cfc27
      Time: Sun May 02 2021 20:53:12 HKT                  Height:     219704

-c, --connections               List nodes connected to this Full Node

Type      IP               Ports       NodeID      Last Connect      MiB Up|Dwn
FARMER        59884/8447  cc638a7d... Apr 27 21:24:29      5.3|0.0
FULL_NODE ?.?.?.?          2070/8444  b9a54f17... May 02 20:55:28     87.7|63.2
                           -SB Height:   219710    -Hash: a018f689...

-a, --add-connection TEXT        Connect to another Full Node by ip:port
-r, --remove-connection TEXT    Remove a Node by the first 8 characters of NodeID

chia farm summary

Farming status: Farming
Total chia farmed: 0.0
User transaction fees: 0.0
Block rewards: 0.0
Last height farmed: 0
Plot count: 1
Total size of plots: 101.375 GiB
Estimated network space: 811.762 PiB
Expected time to win: 4 years and 5 months
Note: log into your key using 'chia wallet show' to see rewards for each key

Searching for an initial chain

You may be able to expedite with 'chia show -a host:port' using a known node.

chia show -a




chia wallet show

Wallet height: 1498
Balances, fingerprint: ?
   -Confirmed: 0 mojo (0.0 xch)
   -Unconfirmed: 0 mojo (0.0 xch)
   -Spendable: 0 mojo (0.0 xch)
   -Pending change: 0 mojo (0.0 xch)

How many confirmations do I need to trust a chia transaction is final?

The 32 blocks (approx. 10 minutes) suggested in the current




Set the instance log level


chia configure -log-level INFO

tail -f /home/chia/.chia/mainnet/log/debug.log




# On Main machine

假設 All-In-One 機(main machine) 已經上線

1) Copy CA 出 All harvester

cd ~/.chia/mainnet/config/ssl

tar -zcf ca.tgz ca

Copy ca.tgz to All harvester

2) set NAT on main machine


P.S. 測試

tcpdump -n -i br0 port 8447

# On all harvester

1. 建立初始設定

chia init

2. 建立 plots 檔

chia plots create -f farmer_key -p pool_key

3. Creates a new certificate signed by your main machine's CA.

chia init -c [CA_directory]

Copying your CA from chia-ca/ca to /root/.chia/mainnet/config/ssl/ca
Found private CA in /root/.chia/mainnet, using it to generate TLS certificates

4. Config harvester

chia configure -log-level INFO

chia configure -upnp false

5. 修改 config.yaml

vim ~/.chia/mainnet/config/config.yaml

    crt: config/ssl/ca/chia_ca.crt
    key: config/ssl/ca/chia_ca.key
    host: Main.Machine.IP
    port: 8447

6. Launch the harvester by running CLI

chia start harvester -r

7. 觀測

ps aux | grep chia

root      3895  3.3  0.2 192432 44528 pts/8    Sl   15:32   0:00 chia_daemon
root      3900  6.5  0.3 711200 51312 pts/8    Sl   15:32   0:00 chia_harvester

On harvester log

[time stamp] harvester chia.harvester.harvester: INFO
     0 plots were eligible for farming 1516e1d11a... Found 0 proofs. 
     Time: 0.00050 s. Total 6 plots
[time stamp] harvester harvester_server        : INFO
     -> farming_info to peer [harvester IP address] [peer id - 64 char hexadecimal]

On Main machine log

# 觀測 "eligible for farming 1516e1d11a..."

chia farm challenges


Chia Keys Architecture


  • Chia 是 BLS-12-381 私鑰(32 bytes)
  • Private keys可以通過使用24個助記詞生成
  • Public keys 為 48 bytes
  • 密鑰派生的規範: EIP-2333 及 BIP 44

Master key

 - Farmer key
 - Pool key
 - wallet key

HD(Hierarchical Deterministi)c keys are a type of public key/private key scheme

where one private key can have a nearly infinite number of different public keys





Cumulative difficulty since genesis.


Difficulty is a constant factor that can increase or decrease the number of iterations required for the proof of time.

If blocks are faster or slower than expected in the previous epoch

the difficulty is adjusted based on the formula in the Chia greenpaper.

This is used in order to target 32 blocks created every 10 minutes.