Comprehensive Guide to install Single Filecoin Mining Rig
In this tutorial, I will go through step by step how to install Filecoin Mining Rig using the latest Filecoin Lotus build. This is because in my experience, I found the official guide lacks information and for people with little technical knowledge, it can be a challenge. I used following hardware configuration for the mining rig:
The system runs on Ubuntu 18.04.4 Server which can be download from https://ubuntu.com/download/alternative-downloads
I assume you already have the Operating system installed, if you don’t know how to install Ubuntu OS, contact me on Telegram: https://t.me/filecoinminers
Step 1: Set Swap to 250GB on nvme.
This is because Filecoin mining Rig is memory consumed and Swap on NVMe will make sure you are not running out of memory.
Use this command to view your system Swap:
sudo swapon -show
Follow this instructions for details of Step 1
https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/
Step 2: Mount SATA drive to your OS
This harddrive will be used for Filecoin Storage. Add SATA disk to /hdd/disk1
Follow this instructions for details of Step 2:
https://medium.com/@sh.tsang/partitioning-formatting-and-mounting-a-hard-drive-in-linux-ubuntu-18-04-324b7634d1e0
Step 3: Set fix IP address in LAN
https://linuxize.com/post/how-to-configure-static-ip-address-on-ubuntu-18-04/
Step 4: Change files limit
$ ulimit -n 10000
https://askubuntu.com/questions/606970/permanently-raising-nofile-limits-in-ubuntu-14-04-lts
Step 5: Setup Firewall to let your system accessible via Filecoin default ports
sudo ufw allow 1347/tcp
sudo ufw allow 2345/tcp
sudo ufw allow 1234/tcp
Step 6: Install Nvidia driver for your Graphic Card
To be used in Filecoin Sealing process
apt search nvidia-driver
sudo apt install nvidia-driver-440
Step 7: Install all libraries and Lotus
sudo apt update
sudo apt install mesa-opencl-icd ocl-icd-opencl-dev gcc git bzr jq pkg-config curl
sudo apt upgrade
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-go gcc git bzr jq pkg-config mesa-opencl-icd ocl-icd-opencl-dev
git clone https://github.com/filecoin-project/lotus.git
cd lotus/
env RUSTFLAGS=”-C target-cpu=native -g” FFI_BUILD_FROM_SOURCE=1 make clean && make all
sudo make install
Step 8: Start Daemon and create wallet
Run the daemon:
sudo lotus daemon
Check the chain current position, you will need to sync to the latest chain head and this takes a long time.
sudo lotus sync status
sudo lotus sync wait
To make it faster you can use this command to import the chain:
lotus daemon — import-chain xxx.car
For Testnet: https://filecoin-chain-snapshot.s3.us-east-2.amazonaws.com/chain.car
Once done syncing, you can create your wallet. Make sure you have both a normal wallet start with t1… and a miner wallet start with t3…
lotus wallet list
lotus wallet new
lotus wallet new bls
lotus wallet balance <YOUR_NEW_ADDRESS>
https://faucet.testnet.filecoin.io/ ->create new miner and add some FIL to your wallet
Step 9: Initialize and start Lotus Storage Miner:
After visiting the faucet website above and created a miner, you will receive something like this:
lotus-storage-miner init — actor=ACTOR_VALUE_RECEIVED — owner=OWNER_VALUE_RECEIVED
Ex:
lotus-storage-miner init — actor=t0118947 — owner=t3wfhknty2ixysfoiv6o6otohprcauwhpuabdltgkulksf7lnzekppr3ghxo4b6jqsndyfy3n52zelwm6ya3aa
Just leave it runs, it will download about 100GB of parameters files.
Step 10: Set Environment Variables
Filecoin miner and seal workers need this to run faster, so make sure you have it done.
go to /etc/profile
sudo nano /etc/profile
And add:
export FIL_PROOFS_MAXIMIZE_CACHING=1
export FIL_PROOFS_USE_GPU_COLUMN_BUILDER=1
export RUST_LOG=info
export BELLMAN_CUSTOM_GPU=”GeForce GTX 1660:1408"
The last one is only for my case, if you use GTX 1080 or 2080, dont need because they are supported by Lotus by default
Step 11: Configure the Miner
Go to ~/.lotusstorage and open config.toml
cd ~/.lotusstorage
sudo nano config.toml
Change those to:
[Storage]
AllowPreCommit1 = false
AllowPreCommit2 = false
AllowCommit = false
AllowUnseal = false
I set this because I want all the sealing will run by lotus-seal-worker for better management. The workers can be local or remote.
Now open sectorstore.json on the same folder
sudo nano sectorstore.json
And update as follow:
{
“ID”: “b59d069b-b0ee-4115-bc6f-7b98205f8783”,
“Weight”: 10,
“CanSeal”: true,
“CanStore”: false}
This mean I dont want my Miner which is installed on NVMe store any sector. I only want the sector stored on my SATA 8TB drive, which we will config in the steps below.
Step 12: Run lotus-storage-miner and add new storage
Run below command on 1 terminal or if you want it run on background use the other one
lotus-storage-miner run
nohup sudo lotus-storage-miner run 2>&1 > lotus-miner-log &
Note: you can use screen or similar
Attach hdd only store no seal:
sudo lotus-storage-miner storage attach — init — store /disks/disk1
In step 2, I mounted the 8TB drive to /disks/disk1, now I register it with lotus-storage-miner and set it to store only. Because I dont want any sealing data stored on this drive. Sealing data is better on NVMe drive for faster read/write speed.
Step 13: Run Seal Worker and start sealing process:
sudo lotus-seal-worker — workerrepo=/any nvme location/ run — address=127.0.0.1:3456
Run above command to start new seal worker on the same machine, you can start multiple seal workers. Note: its better to set — wokerrepo to different nvme to boost sealing speed.
After that trigger sectors pledge:
sudo lotus-storage-miner sectors pledge
This is start sealing process. My machine can run up to 3 in parallels.
Step 14: Other commands
Try to play with those commands:
sudo lotus-storage-miner storage list
sudo lotus-storage-miner sectors list
sudo lotus-storage-miner info
sudo lotus-storage-miner workers list
sudo lotus-storage-miner sectors status -log <sector id>
Join our Filecoin Miner community at https://t.me/filecoinminers
If you need anything else about setup Filecoin Mining Rigs, Advices, Large Scale Mining, contact me at https://filecoin-vietnam.com