More

    What actually happens when you mine in Alien Worlds?

    If you’ve ever mined in Alien Worlds, you’ve probably noticed that your laptop (or mobile phone) gets hotter while mining. You’ve probably also noticed that some mines take longer than others, as if the game is struggling to solve something.

    We’ve seen a lot of questions about the mining process in AW, mostly asking two things: are players actually running the entire mining network and what the hell is Proof of Work stat on Tools for?

    After testing with a couple of mining tools, and accidentally discovering the underlying mining code, we got an answer for you – well actually a couple of them. This article also provides a more in-depth understanding of Alien Worlds POW stat.

    And before you ask, yes, Alien Worlds players are actually mining for the entire system.

    Alien Worlds Mining

    When you press mine in Alien Worlds, the game invokes a background service worker script that actually performs the mining operation. Service workers are a way for browsers to run expensive operations away from the main UI thread, and they are always written in Javascript.

    The Alien Worlds miner does the following:

    1. Takes in your account information, last mined transaction on the chain, proof of work difficulty and a couple of additional data points
    2. Starts generating arrays of 8 random numbers. Every iteration, the mining code uses a cryptographic function to hash the number together with your account information. The newly generated hash also has 8 digits.
    3. The miner checks if your hashed number starts with 4 or 6 zeros (depends on WAM account, more details below). If you have 4/6 zeros at the beginning of your hash, you have a potentially good hash!
    4. After getting a good hash, the game checks if the remaining digits of the hash are smaller than your combined Proof of Work stat (takes into account both Land and Tools used). Keep in mind that the remaining numbers are parsed into an Integer from a Hexadecimal base.
    5. If you got a good number of zeros and you’re under your POW stat, you’re all good and you can continue on to the Claim screen!

    You can see the entire code for the Alien Worlds miner at the following link:

    Why WAM accounts have an easier time mining?

    if (is_wam){
         good = hex_digest.substr(0, 4) === '0000';
     }
     else {
         good = hex_digest.substr(0, 6) === '000000';
     }

    During the first step of the calculation, the game uses your account information to figure out how many starting zeros you have to guess:

    • WAM accounts need to guess 4,
    • non-WAM accounts need to guess 6 zeros.

    Keep in mind that the miner generates 8 random numbers each iteration, which means that farming with WAM accounts is 25% easier. Not bad, but certainly not a game changer.

    How does Proof of Work (POW) influence mining?

    After reading the mining code above, we found out that the Proof of Work stat is quite important for the entire mining process. As me mentioned above, the miner checks the first 4 or 6 numbers of the hash and if they’re zeroes, you have a potentially good hash.

    So what does the miner do with the remaining digits? It checks if their combined value is lower or equal to your PoW stat:

    good &= (last <= difficulty);

    That’s a bitwise operation and it means that the higher POW your stats have, it is easier to complete a mine.

    Conclusion

    First the big one. By discovering the Alien Worlds mining code and comparing it with other miners, we are confident to say that players are indeed doing actual mining for transactions in the Alien Worlds system.

    Secondly, we’re happy to report that POW is not a useless stat at all. While mining, you are actually signing the last known transaction on the network. The miner takes into account both the Land’s POW and the Tools’ POW stats when performing the mine, in addition to whether or not you’re using a WAM account to play.

    Lastly, we must say that the mining code has nothing to do with NFT drops. We don’t know how those are calculated or where, but it is not in the mining code. It’s probably regulated with a different smart contract that gets invoked during the claiming process.

    That’s all folks, happy mining!

    Advertisement

    Essential Alien Worlds Guides

    Advertisement

    Recent Articles

    Related Stories