Skip to main content

Mining attacks on PoRA (Proof of Random Access)

· 13 min read

This is a crosspost with ethresear.ch/t/mining-attacks-on-pora-proof-of-random-access.

Abstract

This article analyzes the security of Proof of Random Access (PoRA) consensus mechanism against potential mining attacks. The focus is on two main attack vectors: the shrink attack, where an attacker uses cheaper or smaller storage devices with the same throughput to gain an economic advantage, and the Moore attack, where an attacker leverages advancements in technology to increase throughput while maintaining the same cost. The article examines these attacks under both unlimited and limited mining throughput scenarios and provides mathematical analysis to determine the conditions under which the attacks could be economically viable for miners.

Security model

In our security model, we consider an attacker who aims to optimize their mining procedure to gain an economic advantage over honest miners. The attacker can employ various strategies to achieve this goal:

  1. Equipment replacement: The attacker may replace their storage equipment with more efficient or cost-effective alternatives. This strategy allows the attacker to maintain or increase their mining performance while reducing costs.

  2. Partial fraction mining: The attacker can utilize a portion of their storage space and throughput for one client while using the remaining resources for another client. This allows the attacker to optimize their resource allocation and potentially gain an advantage by serving multiple clients simultaneously.

We will analyze two specific attack vectors:

  1. Shrink attack: In this attack, the attacker replaces their storage device with a cheaper one that offers the same performance. For example, an attacker might replace a more expensive 1TiB NVMe drive with a cheaper 1TB drive that has the same throughput. This allows the attacker to reduce their storage costs while maintaining their mining performance. The key idea behind the shrink attack is that the attacker can take advantage of the fact that the consensus mechanism may not distinguish between storage devices of different sizes as long as they offer the same throughput.

  2. Moore attack: This attack involves the attacker replacing their storage equipment with a newer, more advanced version that offers better performance at the same cost. For example, an attacker might replace a gen 4 storage device with a gen 5 device that has twice the throughput at the same cost. This allows the attacker to increase their mining performance without incurring additional expenses.

It is important to note that the Proof of Random Access (PoRA) consensus mechanism is well-scalable, meaning that there is no single machine limitation. This scalability allows for the possibility of using RAM rigs on tiny devices, such as single-board computers or even smartphones, to participate in the mining process. The absence of a single machine limitation opens up new opportunities for attackers to optimize their mining setups and potentially gain an advantage over honest miners.

Furthermore, the ability to perform partial fraction mining, where an attacker can allocate a portion of their storage space and throughput to one client while using the remaining resources for another client, adds another layer of complexity to the security model. This flexibility in resource allocation allows attackers to optimize their mining strategies and potentially gain an edge by serving multiple clients simultaneously.

Throughout the following sections, we will examine these attack vectors in detail, considering both unlimited and limited mining throughput scenarios. Our analysis will focus on determining the conditions under which these attacks could be economically viable for miners, and we will provide mathematical derivations to support our findings

Shrink attack

In the following sections, we consider three different attacks. The first attack assumes that the mining throughput is not limited and shows how in this case the adversary can gain advantage over honest miners by using a different hardware configuration. In the follwing two attacks, we assume that the mining throughput was limited to mitigate the first attack, but we show that new issues arise: adversary can be economically incentivised to drop some part of the stored file, and perform Moore attack using more efficient hardware than that of honest miners.

In our costs analyses we make a few reasonable assumptions about the relationship between the costs and make conservative estimates of adversary advantage.

Unlimited throughput: achieving advantage over honest miners

In this scenario, we consider the case where an attacker reduces the size of their memory module to gain an economic advantage. We make a pessimistic assumption that if the memory size is reduced by half, the maintenance cost (energy consumption) and throughput will remain the same, while the cost will be reduced by half. In reality, the energy consumption would likely be lower, but this assumption can only make our analysis more conservative.

To compare the cost efficiency of the attacker and the reference miner, we normalize the values by the cost and present them in the following table:

CostMaintenanceThroughput
reference1AA1
attacker1χA\chi Aχ\chi
  • The reference miner's cost of purchasing one unit of hardware is set to 1 as a baseline; this is without loss of generality as we normalize other values with respect to this, eliminating a free variable.

  • A1A \sim 1 represents the maintenance cost (energy consumption) per time unit for the reference miner, which is assumed to be close to 1 for simplicity.

  • The reference miner's throughput is also normalized to 1.

  • The attacker's cost is set to 1, assuming that one unit of attacker's hardware has the same cost as that of a reference miner. This is a conservative estimate, since one unit of attacker's hardware is assumed to be less efficient than that of a reference miner.

  • The attacker's maintenance cost is χA\chi A, where χ>1\chi > 1 represents the throughput advantage of the attacker. This is because the attacker's memory size is smaller, but the energy consumption per unit of memory remains the same.

  • The attacker's throughput is χ\chi, reflecting their advantage in terms of throughput per unit cost.

To compare the total cost efficiency, we calculate the throughput per unit of total cost (cost + maintenance) for both the reference miner and the attacker:

Reference miner: 11+A\frac{1}{1+A}

Attacker: χ1+χA=11/χ+A\frac{\chi}{1+\chi A} = \frac{1}{1/\chi+A}

Since χ>1\chi > 1 when the attacker reduces the memory size, we can conclude that:

11+A<χ1+χA=11/χ+A\frac{1}{1+A} < \frac{\chi}{1+\chi A} = \frac{1}{1/\chi+A}

This inequality demonstrates that the attacker has a better total cost efficiency compared to the reference miner.

Therefore, the original PoRA is not resistant to shrink attacks under unlimited mining throughput conditions. The only way to protect against this vulnerability is to limit the mining rewards, which would discourage attackers from exploiting this weakness.

Limited throughput: not storing part of the file

In this scenario, we consider the case where the mining throughput is limited to an optimal value of 1, and we analyze the cost efficiency for an attacker who uses only a fraction pp of their memory.

Let's define the following variables:

  • nn: the number of random accesses

  • q=1p1q = 1 - p \ll 1, assuming qn1qn \lesssim 1

  • nen_e: the efficient average number of accesses, given by ne=(1pn)/(1p)(1exp(qn))/qn_e = (1-p^n)/(1-p) \approx (1 - \exp(-qn)) / q

  • psp_s: the success probability, given by ps=pnexp(qn)p_s = p^n \approx \exp(-qn)

  • τ\tau: the slowdown of sampling, given by τ=ne/(nps)=(exp(qn)1)/(qn)\tau = n_e/(n \cdot p_s) = (\exp(qn)-1)/(qn)

  • BB: the sampling cost, assumed to be much smaller than 1 (B1B \ll 1) to ensure that the main cost of the algorithm is not CPU PoW

We can compare the reference miner and the attacker using the following table:

CostMaintenanceSamplingThroughput
reference1AABB1
attacker1χA\chi AχB\chi Bχ\chi
attackerppχpA\chi p AχpBτ\chi p B\tauχp\chi p
  • The reference miner's costs and throughput are normalized to 1.

  • The attacker's cost and throughput are scaled by χ\chi when using the full memory.

  • When the attacker uses only a fraction pp of their memory, their cost, maintenance, and throughput are scaled by pp, while the sampling cost is scaled by pτp\tau to account for the slowdown in sampling.

For qn1qn \lesssim 1, we have τ1\tau \sim 1, which means Bτ1B\tau \ll 1.

To consume all throughput, the attacker must satisfy the equation: χp=1\chi p = 1.

For efficient mining, the following condition must be met:

p(1+χA)+Bτ<1+A+Bp\cdot (1 + \chi A) + B \tau < 1 + A + B

Simplifying this condition, we get:

p+(τ1)B<1p + (\tau - 1) B < 1

q>(τ1)BqnB/2q > (\tau - 1) B \approx qnB/2

nB2n B \lesssim 2

To estimate BB, let's consider the example of a Samsung 970 SSD with a throughput of 2GB/s, TDP of 6W, and a value size of 1MB. The hash efficiency for CPU is 30MH/J, and for ASIC, it is 3GH/J.

The additional TDP for sampling will be:

  • For CPU: 2e9/1e6/30e6=6e-5W2e9/1e6/30e6 = 6\text{e-5}W

  • For ASIC: 2e9/1e6/3e9=6e-7W2e9/1e6/3e9 = 6\text{e-7}W

By dividing these values by the TDP, we can roughly estimate BB to be in the range of 1e-51\text{e-}5 to 1e-71\text{e-}7.

This means that nn should be greater than 1e51\text{e}5 to 1e71\text{e}7 to make the shrink attack inefficient, which may not be practical in real-world scenarios.

When qn1qn \lesssim 1, pp can take any value. For example, with a storage size of 1TB, value size of 1MB, n=1e4n=1\text{e}4, and B=1e-5B=1\text{e-}5, we get q=1e-4q=1\text{e-}4, which means that 100 MB of data could be forgotten while still providing economic benefits for the miner.

Limited throughput: Moore attack

When considering the Moore attack, it's important to note that miners will align their throughput to the limit imposed by the system. Let's analyze the cost efficiency of the reference miner and the attacker in this scenario.

Cost + MaintenanceSamplingThroughput
reference1BB1
attacker1BBχ\chi
attackerppθBpτ\theta Bp\tauθχp\theta \chi p
  • The reference miner's cost, maintenance, and throughput are normalized to 1, with a sampling cost of BB.

  • After upgrading their hardware, the attacker's cost and maintenance remain the same, but their throughput increases by a factor of χ\chi.

  • When the attacker uses only a fraction pp of their upgraded hardware, their sampling cost is scaled by θpτ\theta p\tau, where θ\theta is a throughput utilization parameter, and their throughput is scaled by θχp\theta \chi p.

θ\theta represents the throughput utilization parameter, which indicates the fraction of the attacker's upgraded throughput that they actually use. For example, if θ=0.8\theta = 0.8, the attacker is utilizing 80% of their upgraded throughput. This parameter allows us to model situations where the attacker may not be using their full upgraded capacity, either intentionally or due to technical limitations.

To consume all available throughput, the attacker must satisfy the equation: θχp=1\theta \chi p = 1.

For efficient mining, the following condition must be met:

p(1+θBτ)<1+Bp \cdot (1 + \theta B \tau) < 1 + B

Expanding this condition using the approximations for τ\tau and psp_s from the previous chapter, we get:

(1q)(1+χ1B(1+qn/2))<1+B(1-q) (1 + \chi^{-1} B (1 + qn/2)) < 1 + B

Simplifying further:

χ1nB/21Bχ1qnB/2<0\chi^{-1} nB/2 - 1 - B - \chi^{-1} qnB/2 < 0

χ1pnB/2<1+B\chi^{-1} pnB/2 < 1 + B

nB2χn B \lesssim 2 \chi

To find the optimal values for the arbitrary parameters θ\theta and pp, we need to perform additional calculations. Taking the partial derivative of p(1+χ1Bτ)p \cdot (1 + \chi^{-1} B \tau) with respect to qq, we get:

q(p(1+χ1Bτ))(1+χ1B(1+qn/2)+χ1Bn/2(1+qn/3))=χ1Bn/2(1+χ1B)+χ1Bqn(n/31/2)=0\partial_q (p \cdot (1 + \chi^{-1} B \tau)) \approx -(1 + \chi^{-1} B (1 + qn/2) + \chi^{-1} Bn/2 \cdot (1 + qn/3)) = \chi^{-1} Bn/2 - (1 + \chi^{-1} B) + \chi^{-1} B q n (n / 3 - 1/2) = 0

Solving for qq, we get:

q=Bn/2+χ+BBn(n/31/2)>0q = \frac{-Bn/2 + \chi + B}{B n (n / 3 - 1/2)} > 0

This result suggests that nn should be greater than 1e51\text{e}5 to 1e71\text{e}7 to make the Moore attack inefficient.

For example, consider a storage size of 1TB, value size of 1MB, n=1e4n=1\text{e}4, B=1e-5B=1\text{e-}5, and χ=2\chi=2. Plugging these values into the equation for qq, we get q=0.005q=0.005, which means that 5GB of data could be forgotten while still providing economic benefits for the attacker.

RAM rig

In the original PoRA paper, the authors compare the performance of a Samsung 970 EVO NVMe SSD and 256GB DDR4-3200 RAM. Based on the calculations in the previous sections, we arrive at a counterintuitive conclusion: when there are no throughput limitations, only the throughput matters, not the size of the storage. To further illustrate this point, let's compare the efficiency of a Crucial T705 1TB NVMe SSD and Crucial 8GB DDR5-4800 RAM.

Cost (USD)TDP (W)Throughput (GB/S)
NVMe1881513.7
DDR5251072

The table above compares the cost, thermal design power (TDP), and throughput of the two storage devices. The NVMe SSD has a higher cost and TDP but a lower throughput compared to the DDR5 RAM.

To calculate the cost efficiency of each device, we need to consider the maintenance cost and the amortization of the equipment over its lifetime. Let's assume that the maintenance cost for 1W of power is about 4.4 USD per year and that the equipment is amortized over 4 years.

For the NVMe SSD, the cost per 1 GB/s of throughput per year is:

(188/4+154.4)/13.7=8.25(188/4 + 15*4.4) / 13.7 = 8.25 USD

For the DDR5 RAM, the cost per 1 GB/s of throughput per year is:

(25/4+104.4)/72=0.70(25/4 + 10*4.4) / 72 = 0.70 USD

The results show that the DDR5 RAM is significantly more cost-efficient than the NVMe SSD when considering the cost per 1 GB/s of throughput per year. This finding supports the idea that, in the absence of throughput limitations, using high-throughput RAM can be more economically viable for mining than using NVMe SSDs, despite the difference in storage capacity.

Conclusion

The analysis of the shrink and Moore attacks on the PoRA consensus mechanism highlights potential vulnerabilities in the system. The article demonstrates that without proper limitations on mining rewards and a sufficiently high number of random accesses, attackers could gain economic benefits by using cheaper, smaller storage devices or leveraging advancements in technology to increase throughput. To mitigate these risks, the PoRA mechanism should be designed with appropriate parameters, such as limiting mining rewards and ensuring a high number of random accesses. Additionally, the comparison between NVMe storage and RAM suggests that RAM-based mining rigs could pose a significant threat to the security of the system, as they are more cost-effective per unit of throughput.

Further research

We are planning to publish soon an article with green (no PoW inside) proofs of storage, based on statistics, economics, and zkSNARK cryptography, suitable for our decentralized storage research, available at: