How to initialize hard disk space

There are two ways to initialize your hard disk space: modifying config file or calling APIs.

Modifying config file

Step 1: Modify config.json as the table shown below.

Name Type Usage Must Modify
miner.mining_addr []string a alice of mining payout addresses Yes
miner.generate bool execute plotting and mining Yes
miner.proof_dir []string directories for storing MassDBs Yes
miner.proof_list string numbers of MassDBs with corresponding BitLength Yes
  • get mining payout addresses by Creating MassNet Wallet.

  • miner would index MassDBs in directories of proof_dir, and plot new MassDBs in the first directory.

  • proof_list unmarshal string as the format "<BL>:<Count>,<BL>:<Count>". For example, if you want 3 spaces of BitLength = 24, 4 spaces of BitLength= 26, and 5 spaces of BitLength = 28, then you should write "24:3, 26:4, 28:5". Besides, duplicate BitLength would be added together, which means "24:1, 24:2, 26:5" is equal to "24:3, 26:5".

Step 2: Run Miner Full Node in command line.

  • Windows

  • Open cmd, run cd C:\massminer to enter program directory.

  • Run massminerd.exe -P <private-password>, private password is the same as miner.priavte_password in config file.

  • Linux/macOS

  • Open cmd, run cd ~/massminer to enter program directory.
  • Run ./massminerd -P <private-password>, private password is the same as miner.priavte_password in config file.

Calling APIs

Step 1: Run Miner Full Node in command line.

  • Windows

    • Open cmd, run cd C:\massminer to enter program directory.
    • Run massminerd.exe -P <private-password>, private password is the same as miner.priavte_password in config file.
  • Linux/macOS

    • Open cmd, run cd ~/massminer to enter program directory.
    • Run ./massminerd -P <private-password>, private password is the same as miner.priavte_password in config file.

Step 2: Call HTTP API to initialize hard disk by disk size.

Send POST request to localhost:9686/v1/spaces with JSON body:

Parameter Type Attribute Usage Note
capacity int required overall mining disk size represented by MiB
payout_addresses []string required array of payout addresses None
passphrase string required passphrase to unlock wallet same as what -P argument set
  • capacity is the total hard disk size to initialize, represented in MiB.

  • get payout_addresses by Creating MassNet Wallet.

  • passphrase is the same as miner.private_password in config file.

An example JSON looks like this:

{
  "capacity": 400,
  "payout_addresses": [
    "ms1qq7xrd32awhvaj9lkgn6tzm2n76gcu5zglxguzyu3kxrs9pz7tk32qvw70ky"
  ],
  "passphrase": "123456"
}

Check the result of initialization

Call HTTP API to ensure that hard disk has been successfully initialized. Send GET request to localhost:9686/v1/spaces, you may see response like this.

{
  "space_count": 2,
  "spaces": [
    {
      "ordinal": "0",
      "public_key": "02905d92f83d1519fa4f9b9e8bf2b91361438eeb7d74223c3f0371460e62cfa441",
      "address": "165xgckgUQym6wvmtn8adXnpsQcZhPJ2pV",
      "bit_length": 24,
      "state": "registered",
      "progress": 0
    },
    {
      "ordinal": "1",
      "public_key": "0325f91597e68f0427300ad35b40dc91373b9c3264a745f25908cb5ceb12a96be4",
      "address": "1EjyGZLJnrHDkDT6A54XzsQNRoXsMLVSiM",
      "bit_length": 24,
      "state": "registered",
      "progress": 0
    }
  ],
  "error_code": 200,
  "error_message": ""
}

If space_count is not the total number of spaces you expected, or you can not get response like this, then you may have something wrong.

To Learn more detailed explanation of this API, see ConfigureCapacity.

In general, modifying config file offers you more customization options, and Calling APIs saves your time by calculating solutions automatically.