Chia Coin

最後更新: 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
  • HDD 與 SSD 的分別
  • 術語
  • Plot Speed Test
  • Join Pool
  • chia-plotter


Firewall Setting


8444/TCP # chia_full_node

8447/TCP # chia_farmer


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, chia_full_node, and the wallet
  • "farmer-no-wallet"
  • "node"         # start only the chia_full_node


-r, --restart: Restart of running processes


chia start farmer                           # Solo Farm

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.


# -d, --daemon  Stop daemon

chia stop all -d






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

 * 不同礦工間的Plot無法互換或者共享

Plotting 一共有 4 個 Phase

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.


-t           # temp

-d          # destination

-2           # Phase 3 的結果放在那裡

# -2 與 -d 相同

Renamed final file from "/home/chia/plots/plot-k32-?.plot.2.tmp" to "/home/chia/plots/plot9/plot-k32-?e.plot"

# -2 與 -t 相同

Copied final file from "/home/chia/ssd1/plot-k32-?.tmp" to "/home/chia/plots/plot-k32-?.plot.2.tmp"

-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 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.





#### Code
source /root/chia-venv/bin/activate
rm -f $log
chia plots create -b 4500 -k 32 -r 2 -n 8 \
  -t $tmp -2 $dst -d $dst \
  -p $pk -f $fk >> $log


Check status by log

grep -e 'Time for phase' -e 'Total time' -e 'Summary' plots/plot2/log.txt




# 查看 plot 放在那裡

chia plots show


# Verify plot 的有效性

# Try 100 sample challenges for each plot.

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

chia plots check -n 100

 : INFO     Searching directories ['/home/chia/plots']
 : INFO     Found plot /home/chia/plots/plot-k32-?.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)

P.S. 啟動錢包

chia start wallet-only

chia stop wallet-only

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

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

查看 Transaction

chia wallet get_transactions

Status: Confirmed
Amount: 1E-10 xch
To address: xch...
Created at: 2021-07-11 01:44:32





Set ALL instance log level


chia configure -log-level INFO

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

restart daemon

chia start -r farmer

log 的位置


Per daemon log


  logging: &id001
    log_filename: log/farmer.log
    log_level: INFO
    log_maxfilesrotation: 7
    log_stdout: false
    log_filename: log/harvester.log
    log_level: INFO
    log_stdout: false
  logging: *id002






# 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

harvester log

2021-05-10T06:45:14.779 harvester chia.harvester.harvester: WARNING  Looking up qualities on 
 took: 22.325554847717285. This should be below 5 seconds to minimize risk of losing rewards.


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


HDD 與 SSD 的分別


# WD HC550 18T


# Samsung SSD 980 PRO 1TB




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.


chia wallet show

The proof of space is used to create an "unfinished" block which is propagated on the Chia network™.

The block will remain unfinished until it obtains a proof of time - this is where timelords come into play.


Timelords are notified when unfinished blocks are submitted to the network and

are able to then start working on a "proof of time".

This proof is achieved using something called a VDF (verifiable delay function)

which is a way of proving that an amount of time has been spent performing some work.


Cumulative difficulty since genesis.

The weight of a block is the sum of the difficulty of all blocks below it, including itself.

Difficulty & Weight

The number of VDF iterations that timelords must perform is influenced by a number known as "difficulty".

The purpose of this parameter is to maintain a consistent time between blocks.


Pools allow farmers to smooth out their rewards by earning based on proof of space partials, as opposed to winning blocks.

Pool public keys must be embedded into the plots themselves, so a pool cannot be changed unless the entire plot is recreated.

Farmers periodically send partials, which contain a proof of space and a signature, to pools.




Chia Network Token的最小單位 (XCH 的萬億分之一)


All coins are generated as the output of a transaction or a coinbase reward or fee target.

A coin is spent exactly once, and is then permanently destroyed.

Each unspent coin is locked with a ChiaLisp program which is that coin 's puzzle.


~ public key

A ChiaLisp program which specifies the behaviour of a coin when it is spent.


Plot Speed Test


# On SSD: r=2 ~ 6.5 hrs

Time for phase 1 = 9473.973 seconds. CPU (147.420%) Sat May 15 21:07:29 2021
Time for phase 2 = 3856.080 seconds. CPU (98.250%) Sat May 15 22:11:45 2021
Time for phase 3 = 7362.852 seconds. CPU (96.850%) Sun May 16 00:14:28 2021
Time for phase 4 = 462.409 seconds. CPU (98.370%) Sun May 16 00:22:10 2021
Total time = 21155.315 seconds. CPU (119.780%) Sun May 16 00:22:10 2021

# On SSD 1 process: r=4 ~ 5.2 hrs

Time for phase 1 = 7733.071 seconds. CPU (201.280%) Wed May 19 16:59:09 2021
Time for phase 2 = 3947.310 seconds. CPU (99.070%) Wed May 19 18:04:57 2021
Time for phase 3 = 7357.722 seconds. CPU (98.650%) Wed May 19 20:07:34 2021
Time for phase 4 = 552.790 seconds. CPU (98.720%) Wed May 19 20:16:47 2021
Approximate working space used (without final file): 269.433 GiB
Total time = 19590.895 seconds. CPU (139.250%) Wed May 19 20:16:47 2021

# On HDD(HC550 18T) r=2 ~ 8.5 hrs

Time for phase 1 = 12723.803 seconds. CPU (114.640%) Sun May 16 17:11:08 2021
Time for phase 2 = 5844.414 seconds. CPU (74.340%) Sun May 16 18:48:33 2021
Time for phase 3 = 11254.684 seconds. CPU (68.460%) Sun May 16 21:56:07 2021
Time for phase 4 = 635.724 seconds. CPU (80.210%) Sun May 16 22:06:43 2021
Total time = 30458.628 seconds. CPU (89.130%) Sun May 16 22:06:43 2021


Join Pool


0.25 XCH goes directly to the farmer that won that block.
1.75 XCH is divided between the pool members

Each proof found will award you with difficulty points.
Each k32 plot will get on average 10 points per day, independent of what the difficulty is.
the pool to periodically reward you with XCH based on how many points you obtain, and then reset your points back to 0.

You can change pools as many times as you want, and there is no penalty or registration required for doing so.
Be aware that if you change pools, your old pool is not obligated to pay you anymore

Self Pooling

If you are self-pooling, you will additionally need to claim your rewards after winning a block.

1) upgrade chia to version > 1.2

chia stop all -d

pip install --upgrade chia-blockchain

chia version


2) 獲得 100 mojos (0.000000000001 XCH)

Each Pool NFT you create will require a minimum of 1 mojo (1 trillionth of a XCH) + transaction fee.

3) 等 chia_full_node 及 chia_wallet "Full Synced"

chia start farmer

chia show -s

chia wallet show

4) 選一個想 join 的 pool

5) 建立 plot NFT

# Self Pooling

To create a plot NFT in self-farming mode, do

chia plotnft create -s local


You can also change the pool that the Plot NFT is assigned to at any time.

# Join Pool

# -s, --state TEXT                Initial state of Plot NFT: local or pool [required]

chia plotnft create -s pool -u

6) Verify

chia plotnft show

Wallet height: 663915
Sync status: Synced
Wallet id 2:
Current state: FARMING_TO_POOL
Current state from block height: 663725
Launcher ID: ...
Target address (not for plotting): xch...
Number of plots: 21
Owner public key: ...
Pool contract address (use ONLY for plotting - do not send money to this address): xch...
Current pool URL:
Current difficulty: 1
Points balance: 7
Percent Successful Points (24h): 100.00%
Relative lock height: 100 blocks
Payout instructions (pool will pay to this address): ...

7) 建立 plot

# 使用官方 tools

# -c, --pool_contract_address TEXT     # 可用 `chia plotnft show` 查看

# -f, --farmer_public_key TEXT           # 可用 `chia keys show` 查看

chia plots create -c $pc -f $fk -t $tmp -d $dst

8) Other Command

# To switch/join pools, you can use

chia plotnft join -i 2 -u

# To leave a pool (switch to self farming)

# -i, --id INTEGER                ID of the wallet to use  [required]

chia plotnft leave -i 2

Will start self-farming with Plot NFT on wallet id 2 fingerprint NNNN.
Confirm [n]/y: y
Transaction submitted to nodes: [('SSS', 1, None)]

# 查看 join pool 的進度

# -f          Set the fingerprint to specify which wallet to use

# -tx        transaction id to search for. 這裡的不是 "To address"

chia wallet get_transaction -f NNNN -tx 0xSSSS

Transaction SS
Status: In mempool
Amount: 1E-12 xch
To address: xchSSS
Created at: 2021-07-11 19:04:43

# Changing your alias / Get status

chia plotnft get_login_link -l "your launcher id here, with 0x"

switch pool

new plot format allows you to switch between pools and self-pooling with a cooldown of ~30 minutes (100 blocks) between each switch.

Each switch between pools will require a transaction with a smart contract on the blockchain.


singleton points


singleton: a smart coin (contract) that guaranteed to be unique and controlled by the user.

singleton_genesis: unique ID of the singleton.

points: represent the amount of farming that a farmer has done.
        It is calculated by number of proofs submitted, weighted by difficulty.
        One k32 farms 10 points per day.(ie. 10 TiB = 1000 point)





  • 支援 RAM disk, 而且有 75%的寫入是在ram disk 發生 (要有 110G 才可以用 RAM Disk 功能)
  • Ctrl-C for graceful termination or double press Ctrl-C to terminate immediately


Build on Ubuntu 20.04

apt install -y libsodium-dev cmake g++ git build-essential

# Checkout the source and install

git clone

cd chia-plotter

git submodule update --init


./build/chia_plot --help

Update to latest version

cd chia-plotter

git checkout master

git pull

git submodule update --init