Let’s try to understand what happened during Chia Network Plotting and the way to optimize it
Earlier this week Elon Musk said that Tesla no longer accepts Bitcoin as the form of payment for Tesla vehicles. In a tweet, Tesla said that the company has suspended the use of bitcoin to purchase its vehicles because of climate concerns.
An estimate by the University of Cambridge suggests that Bitcoin mining consumes more than 120 Terawatt Hours (Twh) per year, with using more electricity annually than the countries like Malaysia, Sweden, or Argentina. The report also stated that bitcoin could rank in the top 30 energy consumers if it were a country. 
Established in August of the year 2017 by Bram Cohen, the best network protocol engineer alive and the inventor of BitTorrent. Chia aimed to solve these energy issues which raised the concern of the public. Chia has a new innovative Nakamoto consensus algorithm that removes the energy demands of Proof of Work from the system. This algorithm is called Proof of Space and Time, also commonly known as hard disc mining by blockchain miners.
What is Proof of Space and Time?
In short, Proof of space is a mechanism where the Chia blockchain user will “seed” unused space on their hard disc with a collection of cryptographic numbers called “plots”. These users will then use the “plots” to farm for the Chia token. Whereas for Proof of time, it is the mechanism of the servers to complete a block and move the chain forward.
What is Plotting in Chia?
Proof of space is composed of three algorithms: plotting, proving, and verification, for more information, kindly visit the official documentation. This article will only focus on plotting optimization.
Plotting in chia’s term for the method of writing data to disk such that the blockchain can quickly retrieve 1 or more proofs (if they exist) for a given challenge from the plots.
The plot refers to the contents of the disk. The plotting process can take time and it is done only once by the prover. In the Chia Blockchain, these provers are referred to as farmers, since they create and maintain the plots. That is, a farmer creates and efficiently stores data on a disk.
What Happened During Plotting?
The ultimate purpose of chia’s plotting is to create a plot that contains hashed content (the proof) that store in 7 tables ($f_7$). The process contains 5 phase which mainly summarized below:
Phase 1: Forward propagation
To compute all tables where the matching conditions are met, and to compute all final outputs $f_7$. Note that after phase 1, the temporary file is sufficient to create proofs of space. $f_7$ can be looked up, and the tables can be followed backward until the $x$ values in $Table_1$ are reached. However, this is not space-efficient.
Phase 2: Backpropagation
The purpose of the backpropagation step is to remove data that is not useful for finding proofs. During this phase, all entries which do not form part of the matching condition in the next table, are dropped. Positions in the next table are adjusted to account for the dropped entries.
Phase 3: Compression
The purpose of phase 3 is to convert from the (pos, offset) format, which requires tables to be sorted according to their bucket ids for retrieval, to a double pointer format, which allows storing entries in a more compressed way, and sorts by line point.
In the pos offset format around k bits are required for the pos and 8 bits for the offset, for a total of around k+8 bits per entry, whereas in double-pointer format, we can average around 2 bits per entry overhead.
Phase 4: Checkpoints
Phase 4 involved iterating through $T.Table_7$, writing $F.Table_7$, and compressing the tables into the checkpoint tables.
Phase 5 (unofficial) : Migration
Moving your plot out of your temporary directory to the final directory.
Plot optimization in Chia’s plotting consists of multiple plots (Software-driven optimization) and single plot optimization (Hardware-driven optimization). Multiple plot optimization aimed to have optimized the number of plots concurrently and single plot optimization is to optimize the speed of plotting.
The graph above consists of the changes in chia temporary plot size according to the time of the plot in my PC (NVME — PNY XLR8 CS3030 1GB, RAM: 8 GB, CPU- I0500). It took me an average of 7 hours to finish a plot. The plot size peaked at 245 GB during phase 2 and the rest of the time it fluctuates around 150–200 GB for the other phases.
The idea of concurrent plotting optimization is to avoid multiple plots during phase 2 as it will use an extra 50GB in your plotter. In my case, for example, I’m using 1 TB NVME, the space available is only 931 GB, I will be able to plot only 3 plots if each plot enters phase 2 concurrently. I have to separate the time of plotting in order to maximize my yield at the end of the day.
Ram and Thread
As per chia’s setting, we can modify the ram and you need a minimum of 2 threads and 4GB of RAM to create a single plot. Only phase 1 will need more than 1 thread. So optimize your plot and limit the concurrent phase 1 running according to your computer setting. Whereas for the RAM, a range between 6GB–8GB is sufficient, further increase doesn’t increase more performances.
Lastly, for tools recommendation, it is highly recommended to use a plot manager such as SWAR’s Plot Manager (Window user) or Plotman for chia plotting. These tools will help you optimize the plotting process according to your settings, and of cause, you will only be able to set it after you understand the process of chia plotting.
You can read my article on maximizing the plot with SWAR as below:
Maximize Plots with Swar Chia Plot Manager
Ultimate guide on Swar Chia Plot Manager for window users
Chia’s blockchain is interesting and the technology behind is solid, it is rather addictive and fun to study this technology in depth. I hope this article can help you further optimize your chia plotting process. Our team does offer plotting services for residents reside in Malaysia, do email us if you are interested in our plotting service.
Lastly, thank you for your time in reading.