Phala-Network / solo-mining-scripts

Apache License 2.0
32 stars 26 forks source link

EN | 中文

Phala Network

Phala Mining Script

Navigate

Instructions

Before Getting Started

:point_down: More details about the hardware requirements:

Phala Wiki

Manual Installation

sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
sudo apt install wget unzip
cd ~
wget https://github.com/Phala-Network/solo-mining-scripts/archive/refs/heads/main.zip
unzip main.zip
rm -r main.zip #cleaning up the installation
cd solo-mining-scripts-main/tools/ #note this depends on your current directory
sudo chmod +x sgx_enable
sudo ./sgx_enable

It is now recommended to reboot you machine.

sudo reboot

Install the Phala Scripts

Go to the Phala folder

cd solo-mining-scripts-main/ #note this depends on your current directory
sudo ./phala.sh install
Get Logs
sudo phala logs node
sudo phala logs pruntime
sudo phala logs pherry
Check the Configuration of the Miner
sudo phala config show
Update the Script
sudo phala update script

Script Usage

Installation
sudo phala install init

Enter your information as prompted.

Miner Configuration
sudo phala config set
Start the Miner
sudo phala start
Stop the Miner
sudo phala stop
Check the Miner's Status
sudo phala status

_Head back to top :pointup: to navigate to other sections.

Phala & Docker 🐳

Start Docker Separately
sudo phala start node
sudo phala start pruntime
sudo phala start pherry
Stop Docker Separately
sudo phala stop node
sudo phala stop pruntime
sudo phala stop pherry
Update Phala Docker Containers
Update Phala Dockers Without Clean Data
sudo phala update
Update Phala Docker Images with Clean Data
sudo phala update clean

:raising_hand_woman::raising_hand_man:

Troubleshooting

The community is here to help! Check for existing posts on our forum if you are stuck. In rare circumstances, your issue may be new; feel free to post it then so that we can help. For us to be able to help you, please read the investigating the issue first, so you know how and where to get your logs from prior to posting.

General

Most symptoms are solved by restarting your node. If you experience issues running your node, try stopping the node by:

sudo phala stop

And attempt a restart with

sudo phala start

If you still have issues attempt to update the script.

_Head back to top :pointup: to navigate to other sections.

Investigating the Issue

Get an overview of your miner's status first.

sudo phala status

In case your node is stuck, a typical scenario would look like the following:

Phala Network

(image showing stuck node on the miner)

With the symptom in the scenario above, the right method to solve the issue would be restarting the node container only, with the commands mentioned here, and restarting the containers.

Now check the status of the node again.

If the local node block height is empty first, check if all required containers are running.

sudo docker ps

You should have three containers running as shown in this example:

Phala Network

(image showing the miner node's running docker containers)

To get the most recent logs of each container, you may execute:

docker logs <container_ID/container_name> -n 100 -f

Note that <container_ID/container_name> must be replaced with the container you wish the receive the logs from. In the example above the container_ID is 8dc34f63861e and container_name would be phala-pherry. \ If you attempt to post on the phala forum and do not know where the issue lies, please post the logs of all three docker containers. Copy-paste the container logs from the terminal into the forum post.

If a container is missing, you may attempt to restart it separately with the respective commands below. Use the applicable command for your missing container:

sudo phala start node
sudo phala start pruntime
sudo phala start pherry
Peer Connectivity

Some users running nodes may find their nodes are struggling to connect to peers, which causes nodes to be dropped from the network. You can check your node connections through executing:

sudo docker logs -f phala-node

For an optimal setup, you should have between 40 and 50 peers.

If you have insufficient peers do the following:

Feel free to read NAT for more information if you are curious about the root causes. Also, do not hesitate to look for existing Phala forum posts before posing your issue if you are stuck.

Failed to install the DCAP driver

:information_source: The most common issue is that your mainboard may not support a DCAP driver. In this case, the script cannot automatically install the isgx driver and results in the following error message.

Phala Network

(image of the terminal showing the DCAP driver error message)

In this case, prior to running sudo phala start, you need to manually install the isgx driver:

sudo phala install isgx

Khala Node Stops Synching

If the Khala Chain stops synching and is stuck at a specific block and does not continue to sync, we advise you first to restart your node. Prior to restarting your miner confirm that your node is stuck, through execututing:

docker logs phala-node -n 100 -f

Within the logs if there is an issue in synchronizing a block, it will typically look as follows:

Phala Network

If the synchronization still fails, you may try to delete the khala chain database on your miner's node.
It is located in /var/khala-dev-node/chains/khala.

Phala Network

(image showing the khala blockchain files of the miner node)

It is located in /var/khala-dev-node/chains/khala.

First, stop your node with:

sudo phala stop

To delete the khala blockchain database on your node, execute the following commands:

rm -rf /var/khala-dev-node/chains/khala

To delete the Kusama blockchain , run:

rm -rf /var/khala-dev-node/chains/polkadot

Now restart your node.

_Head back to top :pointup: to navigate to other sections.