FAQ's Guide to mining on Phala Testnet

FAQ’s Guide to mining on Phala Testnet - #Expectchaos

Dear Phamily,

Having read the announcement that Para-1 testnet was live I jumped at the chance to mine on the Khala Testnet. This post is here to clarify the mining process for the community by highlighting the issues I came across, and in the second part will constitute a list of issues and fixes the Phala community has come across. These have been pulled from multiple social media channels and Phala forums. We hope this becomes an active database of issues and fixes sourced from every corner of the Phala community!

The explanation of the issues is organized in a way that makes your current mining errors more easily searchable. You can simply search for the specific issue and go straight to the section which discusses it. The Error Type and Answered Using parts will be clearly labelled as seen here. The first part of the guide can be followed side-by-side with the Para-1 Testnet mining guide or be pulled up when you encounter a problem and do a quick search.

Inevitably there will be some errors and problems you will come across which won’t be covered here. If this is the case, please leave a comment and we will look to answer and include your new issue. We understand setting up the mining process can be challenging to newcomers given Phala’s TEE hardware configuration requests. However, by sharing and guiding each other through the processes and with mainnet almost here, there has never been a better time to jump into the mining process.

Para-1 Testnet Goal

The main aim for the current testnet is to test the new economic model and TEE mining function compatibility before mainnet launch later this year. What’s New?

  • New Token Economics model weighs incentives on hardware confidence scores

  • PHA StakePool enabled TEE mining

  • A funky console and data display for miners

Important statements about mining setup:

  • That is currently NO REWARD in tokens for staking or mining on Testnet Phala.
  • The block explorer has been updated to para1
  • Watch out with memory modules from Corsair, even though they are listed in compatibility charts they are not compatible anymore.
  • Currently you cannot mine with AMD hardware, despite some having their own version of SGX.

1. Hardware & Software configuration

Firstly, you will need to get into the configuration of the computer hardware to check and then activate the SGX function of your miner. The BIOS setup plays an important role in the confidence score Phala blockchain grants you when syncing – the higher the confidence, the more mining responsibilities & rewards your miner gets. Finally, make sure you have the correct Ubuntu software and get the Polkadot. js browser extension.

1

The Ideal Khala requirements are above, but you are advised to have upto 500GB of space. Now this can be on the same disk of course, but you could also set up a soft/symbolic link to a folder on a different drive. If you are worried about having enough space, you could set up this soft link to funnel mining data to your HDD drive, while running on SSD.

This could make sense with the size differences between SSD and HDD drives. To do it this way, after syncing with the testnet, check where the phala folders are placed and fill up with data. They can then be moved to a separate (mounted) drive, and replaced in the /var folder with a soft link of the same name.

2
Source: https://tecnstuff.net/how-to-create-symbolic-links-in-linux-using-the-ln-command/

2. Issues with processor requirements & SGX capability (for TEE computations)

The wiki guide section about the hardware requirements shows in a step-by-step guide what processes are needed to check and enable SGX (Software Guard Extension) capacity on your computer. This is clear and seems straight forward, but there are some deep pitfalls to be sure to avoid.

Firstly, if you haven’t checked if your processor has this feature click here to go directly to Intel’s site and see whether this can be done – just scroll down the page a lot
To find your processor details in Ubuntu - go to ‘Settings’ – > ‘Details’

3

Now, in the knowledge that your processor can have SGX enabled you need to restart the computer in BIOS setup (F10) to …

Disable Secure Boot. Go to Security → Secure Boot, set it to Disabled.

Use UEFI Boot. Go to Boot (options) → Boot Mode (network boot), set to UEFI.

Enable SGX Extensions. Go to Security → SGX (The exact name may vary by manufacturer), set it to Enabled. Things should look similar to this…

4

One major mistake I made was not swapping the Operating System hierarchy (with dual Windows and Ubuntu boot). This sent me into a Windows boot loop and a LOT annoyance. This may seem obvious to many, but it caught me out.

5

This was the painful Grub loop I found myself in after not putting Ubuntu top of that OS boot…

6

Driver Installation: → Should you go about installing drivers from within Ubuntu please

click here for more.

3. BIOS configurations and miner ‘confidence score’

The story with the BIOS settings doesn’t end here. Because it helps establish your miner’s ‘confidence score’. This score measures many factors, amongst which - how secure the SGX Enclave execution environment is. The higher the security level the higher the confidence score which makes you more likely to be chosen to process the more sensitive data on the blockchain.

Let’s look at what the documentation says… from here…1.3 Check the SGX Capability and Confidence Level | Phala Network Wiki

7

8

:interrobang:Error Issue:

GROUP_OUT_OF_DATE

CONFIGURATION_NEEDED

CONFIGURATION_AND_SW_HARDENING_NEEDED

:speech_balloon:Answered Using:

9

10
From source: https://wiki.phala.network/en-us/docs/khala-mining/1-3-confidential-level-evaluation/

Quoting heavily from the Phala Wiki we see that it is advised that you contact the vendor directly to inquire, and obtain, the BIOS upgrade for your BIOS version. To check those details type one of the two commands that worked…

    sudo phala sgx-test -  
    sudo dmidecode | less – This you will get the full list of specs
    sudo dmidecode -s bios-version – This will get the version only.

With the first prompt I got this;

11

Once you have this information, contact the vendor for an update with your version type. Although you can carry on the mining process before they respond, they should do so quickly.

:interrobang: For issues regarding:

"configuration_and_sw_hardening_needed"

"configuration_needed"

:speech_balloon: → These can be fixed with BIOS configuration, (See the FAQ page above) - eg. - Disable HT, disable low power mode, disable internal graphics…

When/if you reconfigure type BIOS such as above, it can reset the BIOS settings when you boot back to default - So it is important to go back to (part 1) and make sure the settings are SGX ready to mine Phala.

FYI - Confidence and overall numbers for processors in google sheets:

IMPORTANT BIOS MANUAL SETUP

There is an Unofficial BIOS re-configuration guide on the wiki, however this guide, if followed incorrectly, could lead you to ‘brick your computer’. Please take this seriously, as you will see the guide also warns you. But that said, this is a sophisticated guide to understanding the context and procedure when updating your motherboards, contacting vendors and updating those BIOS options.

12
Source: https://forum.phala.network/t/topic/2565 from active community member

Take a moment to explore some of the options here:

Details from Intel

Here we have a video from a respected community member looking at the BIOS issues. Please do note this is sensitive territory for your computer and that you should proceed with extreme caution here.

4. Phala Syncing Errors

For this section please in Ubuntu terminal have Sudo phala help open to help guide you through the process with the list of available commands. (This was very helpful to me as a noob)

13

:interrobang: Error type: phala-node error / Docker error

Cannot start service phala-node: error while creating mount source path ‘/var/phala-node-daa’: mkdir /var/phala-node-data:file exists

Docker: Error response from daemon: error while creating mount source path ‘/var/khala-dev-node’: mkdir /var/khla-dev-node: file exists.

14

I found that in /var both the khala-dev-node & the phala-node-data were broken. (Red with black backgrounds)

15

:speech_balloon:Answered using:

Sudo phala stop
Sudo phala update clean
Sudo phala start

:interrobang: Error type: The Compose file ‘./docker-compose.yml’

Error The Compose file ‘./docker-compose.yml’ is invalid because:

services.phala_pruntime.devices contains an invalid type, it should be an array

This error pop’s up when trying to run “sudo phala update”

16

Here you need clean data and update scripts -

:speech_balloon: Answered using:

sudo phala update script
sudo phala install dcap
sudo phala install isgx

:interrobang: Error type: Worker-public-key 0xnull

This error comes up repeatedly in the chats, and I also had the issue. That being the worker-public-key would never show up once I had my Gas account linked - but mistakenly put the DIP number of that gas account as the pool address. I would only see 0xnull such as below.

17

This PID number was fed into the system as a pool account address…
Use the command to see:

sudo phala status

18

This mistake caused the whole process to stagnate and never really enabled the blockchain to sync. So this caused me to have recurring syncing issues - looking something like this…

19

:speech_balloon: Answer Using:

What is needed is to set up another wallet to be your main account. This will stake and be added to the pool, while your more vulnerable account is the Gas (because you added the mnemonic to the Phala Blockchain) should be credited with a low PHA balance - i.e 10 PHA for gas is enough. - So in short, make sure you have 2 accounts:

20

1- Gas Account - credited with 10 PHA - (insecure because you gave your mnemonic)
2- Main Account - where your PHA is staked and where your mnemonic is still private.

21

If, after this you are still seeing 0xnull - it should disappear quite soon as the pherry automatically catches up with the blockchain data to input your pool address to the status.

:interrobang: Error following sudo phala score-test

This minor error will indicate not knowing the number of machine core, and will turn up like this:
------The parameter of the number of machine cores is missing------

22

:speech_balloon: Answered Using:

Here you need to write how many cores you intend to use from your machine. You get that request when installing the testnet, but to find out the number of processors again;

#nproc

Whereas in more detail, lscpu gathers CPU architecture information from /proc/cpuinfon…

#lscpu

But if you already know or remember from installation how many cores you have you can directly input that using…

:speech_balloon: Answered Using:

sudo phala config set…
sudo phala config show - you can see what you installed.

5 .Polkadot Js, Wallet and Workers!

There is sufficient material here to follow and setup wallets in both.

Polkadot browser extensions and using the Phala console.

23

Follow the wiki to set up your wallets, and use the Telegram Faucet to credit your accounts with Testnet Phala. Write your telegram username with the command in the chat /drip (your public address) and you should soon be credited with 9000 tPha.

You can create a new wallet or follow the images…

24 25 26 26_b

It is also worth exploring the new Phala console, from which you can stake, add workers and connect to the Phala blockchain. There is also a testnet explorer which you can follow the ongoings of the blockchain in.

Once credited with /drip from the telegram faucet, you can follow the Phala testnet explorer to find and check if the transaction went through. It should look something like this:

27

In the end after following the guides available, using the console to manage your mining serves as a fantastic way of getting comfortable with your wallet and wallet options. Also you have access to the just released Phala DAO through this console. It would look similar to:

28

List of Community Mining Questions

For this section please have a look at Sudo phala help - keep it handy during this process as it helps demark what commands are possible.

13

Question: Will I earn from mining (working) in para-1 testnet?

Answer: Unfortunately not on the testnet, but after the mainnet launch, yes!

Question: Can I stake Phala?

Answer: We are still working on stake PHA, but on Testnet you can stake tPHA.

Question: How easy is it to set up mining with Phala?

Answer: There is a procedure and the start requires checking & setting up your internal hardware, but there is a fantastic guide that Phala has created to guide you.

Question: Does mining only works on ubuntu? is it also works on other distro like manjaro?
Answer: Sorry, our solo mining scripts is ONLY support Ubuntu 18.04&20.04(LTS).

Question: I am installing a new miner here. However I get an error when trying to install the SQX driverwere
Answer: Switch from hardware software controlled to ‘Enable’? (config in BIOS)

Question: How do I get some test tokens to participate?
Answer: Use the Telegram Phala Faucet group and make sure your name is visible — How to Settings – Edit- Username write the command in the chat /drip (your public address) and give it a minute.

Question: Why are parachains not syncing ?
Answer: Use command :phalanetwork/khala-dev-node not phalanetwork/khala-node / could be Sudo Phala Config needs changing.

Question: How are you able to assign a controller to stash account in the Khala testnet? It doesn’t have the phala option here.

Answer: We don’t have a “stash account” nor a “controller account”. Make sure you have read Wiki(wiki.phala.network) before you operate your miner.

Question: Trying to add a worker to the pool for the para-1 testnet. The extrinsic never completes and no worker is added.
Answer: Check the log.

Question: “I’ve setup the three dockers, sync the blocks and 2 dockers (phala-node
and phala-pruntime) are running succesfully my problem is with the phala-phost docker when I start it, after few minutes (long :p) I’ve got this message : block with justification at: 1942900 bridge() exited with result: Err(SubxtRpcError(TypeSizeUnavailable(“CallHash”)))”

Answer: The pherry depends on the node, you should reinstall sgx driver;
sudo phala install dcap
sudo phala install isgx

Question: Has anyone tested prb using the image phalanetwork/prb? I can’t add any worker nor pool. Furthermore the fetch status seems wrong…
30

Answer: First check that your local node is synched with the blockchain, To do that use phalanetwork/khala-dev-node for this test…
Check the environment variable in docker-compose file, should look like:
PHALA_PARENT_CHAIN_ENDPOINT=ws://node:9945
PHALA_CHAIN_ENDPOINT=ws://node:9944

31

For more details about the khala docker please check this Github link

Please add comments / Issues /feedback – your input is valuable to the community. :pray:

3 Likes

Very useful, good job!
Thanks

1 Like

FAQ’s for Para-2 Testnet :chains:

Continuing the Q and A tradition I will jump straight into the issues that have come up in the latest testnet version - para-2.

List of Community Mining Questions

Q: How does the payout percentage of a stakepool work?

A: It’s done automatically.

Q: Any indication on the minimum amount of PHA needed to mine yet?

A: You need 1620 PHA per CPU core to mine.

Q: How can I find out what I will earn daily on PHA?

A: This can only be calculated after the pre-mainnet mining stats are out.

Q: Is it possible to do cooperative mining?

A: The mining pool was made to facilitate that, if you add coins to a pools you can benefit from a miner setup. You would receive a % of the profits from your staked PHA in the larger pool.
We are looking at ways to make a “stake pad” to help stakers stake their PHA.

Q: How can you change your wallet from unresponsive - back into an active worker?

A: A well running worker which is online will automatically change status.

Q: Is there a number on how much you mine per core/ hour?

A: We are not sure before premainnet mining starts.

Q: Are there and VPS’s we can use to mine the upcoming Phala Mainnet?

A: Sorry, No VPS available now.

Q: Can you use OpenSGX on AMD CPU’s to mine PHA?

A: OpenSGX doesn’t support AMD

Q: If mining can only happen on Intel SGX machines, doesn’t that hurt decentralization?

A: Yes it does, which is why we have AMD SEV support on our roadmap. However only SEV that is supported by Epyc will work not those supported by Ryzen.

Q: If I run a node with PHA but someone delegates to my node and sends the PHA needed per core does this fulfill the requirement of PHA needed to mine?

A: Yes the delegation of PHA to your node would then fulfill the requirement.

Q: What is expected to happen with a switch from testnet to mainnet?

Q: Should we wait for mainnet launch then start mining or need to start with testnet?

A: What you may just end up doing is uninstalling scripts and clean the data to the reinstall Phala.

Q: Will the hardware specs be different on mainnet?

A: No difference, mining Khala or Phala will be the same.

Q How much space will I need to mine?

A: Larger SSD is preferred because it will download the full Kusama blockchain history. You have a torrent which contains that to speed up your syncing process (350GB extracted) - but ultimately you should allocate 550GB of free disk space

Q: ‘Driver file was not found’

A: This means your BIOS may have some problems or your Kernel needs to update or rowback.

Q:What do these advisoryIDs mean? “INTEL-SA-00289”, "INTEL-SA-00334

A: This is about the confidence level - Please refer to this: 4 Frequently Asked Questions | Phala Network Wiki

Q: Can you run PHA on intel NUC11?

A: Sadly, NUC11 are no goes. Intel provides end-user consumer updates every 2-3 months after patching - but not every patch has updated firmware as they may contain legacy microcode.

Q: How does one become a Gatekeeper?

A: Gatekeepers are elected and elections will be opened a little after mining starts on mainnet - also they operate similar to Moonbeam’s DPoS pallet. We will notify everyone when the Gatekeeper elections happen.

                         General Questions:

Q Is there a way to install intel SGX with Ubuntu?

A: Because SGX is required there isn’t yet a way. However, if you want to run a full node - any platform will do.

Q: What about running Phala mining on Azure Cloud?

A: Two points here, firstly that the point of using SGX is so that it can’t be simulated. Secondly, running a hosted SGX on Azure will cost you 830 euros / month - not economical.

Q: Does gatekeeping require SGX support?

A: Yes it does, although it doesn’t need to occupy 100% of your CPU power.

Q: What is the token allocation for Phala and Khala mining?

A: Khala has 10 Million and Phala 690 Million to mine ---->

photo_2021-09-16_13-23-53

Q: Are the tokens from crowdloan transferable?

A: No, but when Secure worker mining (TEE mining) comes online soon, we will open transfers after.

Q: Can you send PHA to Ledger?

A: You can send them there as they exist in ERC-20 format and KSM Substrate format. This means you can send to Metamask, Polkadot js as KPHA (Kusama net)

Q: What happens after a parachain lease is up?

A: After 48 weeks, we can renew the lease by then based on the situation and context.