# Plot Algorithm

The Plot algorithm is an inevitable step for miners to create effective capacity to participate in mining. When a miner first joins the MASS network and wants to contribute N bits of space to the mining effort, it samples a public/secret key pair (pk,sk) and runs Plot algorithm with pk. This process mainly involves generating two hashmap tables and the second hashmap table is finally stored in the hard disk as effective capacity. The specific implementation steps are as follows:

Step 1: The miner generates a public-private key pair (pk,sk) through the elliptic curve secp256k1 algorithm.

Step 2: The miner performs double sha256 hashing on the public key to generate a unique ID=doublesha256(pk) of the capacity space.

Step 3: The miner sets the size parameter BL of the initialization capacity space. This parameter indicates that the second hashmap table stores 2^BL pieces of data, and the actual storage space occupation is as follows:

BL 24 26 28 30 32 34 36 38 40
Capacity 96Mb 512Mb 2Gb 8Gb 32Gb 160Gb 640Gb 2.5Tb 10Tb

Step 4: The miner calculates $y=sha256\left(string\left('MASS'\right)||doublesha256\left(pk\right)||x\right)$, and $x\epsilon[0,2^{BL}-1]$. Then, the miner creates the hashmap table A with y as the index and x as the value.

Step 5: The miner inverts the value of $y$ in the hashmap table A to get $y'$, and use $y'$ as the index to find the corresponding $x$ in the hashmap table A, and the corresponding value as $x'$.

Step 6: The miner calculates $z=sha256\left(string\left('MASS'\right)||doublesha256\left(pk\right)||x||x'\right)$. Then, with $z$ as the index and $\left(x,x'\right)$ as the value, build the hashmap table B.