Let’s face it, mining algorithms can be very difficult to understand, especially if you are not technically sound! Furthermore, the LXR Hash algorithm is probably one of the most difficult to fully comprehend! However, you need not worry as I will do my best to explain this below in a fashion that is easy to grasp.
Introducing the LXR Hash Algorithm.
The LXR Hash algorithm allows for CPU mining whilst avoiding centralization from ASIC and GPU operators. Centralization is a big problem in mining circles as the distribution of token economics is spoiled if they end up in the hands of a few entities.
The algorithm avoids centralization from ASICs and GPUs by using a new mining algorithm that targets a bottleneck in memory rather than the computation of a simple hash execution. The entire ethos behind LXR is to overload the CPU caches by keeping a large table in memory which is non-cacheable. This leads to the fact that the algorithm is very RAM intensive, which would require all machines to host at least enough RAM to access the one-gigabyte memory table - something which proves difficult for specialized mining machines such as ASICs.
To understand the LXR Hash algorithm a little more I feel it will be easier to explain the algorithm in a project that actively uses the algorithm. The project we will discuss is known as PegNet.
PegNet - Peg Your Assets On The Blockchain
PegNet is short for Pegged Network and the project entails the creation of a set of tokens pegged to existing currencies. Built on the Factom Asset Token (FAT) standard on top of Factom Protocol, the PegNet platform allows you to store your assets as the equivalent price of well-known assets such as the USD, Euro, Gold or BTC. It is designed to allow users to frictionlessly convert between each asset without the hassle of handling the actual asset itself.
The exchange rates for each of the assets on PegNet are determined through a proof-of-work mining process in which the miners act as oracles and are rewarded in PEG.
As PegNet runs on the Factom blockchain, it requires Factom’s Entry Credits to perform the mining action as well as to access to APIs for the request of real-time exchange rate data. The prices for the PegNet asset prices are reported by the miners for PegNet and are sorted through a grading algorithm to ensure accuracy.
So, How Does It All Work?
The miners on PegNet act as oracles for the pricing of the assets in PegNet. These miners will utilize the APIs to request for the latest pricing data and then will report these prices to the Factom Blockchain in a specific oracle chain. After each block, the entries are analyzed by the system and the reward goes to the miners that give the highest authority answers.
The authority comes from two parameters;
The first is that the answer must have sufficient cryptographic hashing power to be within the top 50 responses.
Secondly, after all of the answers have been submitted, an algorithm will locate the prices that are closest to the median price. Outliers are removed until there are only 10 answers which will then become the recipients of the block reward.
Each entry that is published must contain an Oracle Price Record (OPR) that allows miners to give the PegNet network real-time price info. The OPR includes all the assets on PegNet along with their current prices in PEG.
The mining reward, set at 5000 PEG, is distributed to the top 10 graded OPRs.
Let Us Go Deeper!
The entire mining process for PegNet all relates to accurate Oracle data for PegNet assets. The oracle helps to determine the exchange rate in a particular block for each individual PegNet asset. Miners submit their OPR and these are graded with the top 10 receiving the PEG reward and the winner setting the value. This is a continuous cycle that occurs every ten minutes according to the block time.
Stage 1 - GRADE
This stage involves finding the best 10 OPRs that are closest to the real exchange rate. The entire system relies on the assumption that the majoirty of miners should process honest data so there should not be too much discrepancy amongst the data. Typically, ff there are less than 10 OPRs that have been submitted then nobody wins and all transactions are not processed until the next block.
The grading system works by firstly removing all the invalid formatted OPRs. The OPRs are then sorted by difficulty and everybody not in the top 50 is removed. The remaining OPRS are graded according to the average submitted price data and outliers are removed until only 10 remains. The last 10 are graded and sorted from lowest to highest.
Stage 2 - Create
The second step of the process is the create the OPR to be submitted to the blockchain for review.
For this, we need the 10 winners in the previous block, the asset exchange rates, and the miner’s payout information. This is all compiled into JSON format ready to be LXR-hashed in the next stage.
Stage 3 - Mine
The third step is the mining stage. The LXR Hash targets random byte access over a large 1GB of random data in the lookup table.
Using a 1GB lookup table results in an algorithm that spends over 90% in execution time waiting on RAM rather than actually computing the hash. This results in less power consumption and ASIC resistance.
Furthermore, as all the parameters are specified (such as the size of the lookup table) this can be easily changed as computers get faster with larger memory caches. The lookup table can be set to 2GB or even 16GB or more. This process of making memory a bottleneck to computation makes it easier to manage than trying to find algorithms that will continuously block specific ASIC hardware.
The entire point of this stage is to find a Nonce for the OPR that has a high difficulty. The calculation of the OPR Hash itself will result in a 32-byte hash. This 32-byte hash is then added to a selected size of Nonce bytes to calculate the difficulty. Any Nonce size can be chosen, but for performance reasons, it should be kept as short as possible as a longer input will take longer to hash.
Stage 4 - Write
The final stage in the process is the writing stage in which the winning OPR sets the exchange rate and the winning miners receive their rewards.
Miners are paid if an OPR that they submit makes it to the top 10 with the first place getting 800 PEG, second place gets 600 PEG and the rest all receive 450 PEG. This equates to the fixed 5000 PEG mining reward that is set.
So, the LXR Hash algorithm is a proof-of-work algorithm that is specifically designed to create a bottleneck in memory rather than the actual computation itself. This process helps to keep the mining from becoming centralized amongst a small few hands of ASIC and GPU operators.
The fact that LXR Hash bottlenecks RAM also makes it easier to prevent ASICs further down the line as the size of the lookup table can easily be increased which will require higher memory for each mining machine.
LXR Hash truly is a wonderful algorithm that can help investors gain confidence in projects that utilize it as they can be sure that there will be no mining centralization further down the line.