---
# System prepended metadata

title: Price discovery and price controls in the Swarm network

---

# Price discovery and price controls in the Swarm network

*Andrew W. Macpherson*

**Abstract.** Using a simple microeconomic model of a storage market, I argue that the system controlling the price of storage in the Swarm network is underdetermined. In the event that the network replication rate does not converge on the target, it could also lead to undesirable dynamics of the BZZ/DAI exchange rate.

## Introduction

The Swarm price oracle is a component of Swarm's storage incentive system that dynamically adjusts the BZZ-denominated price of storage in response to network conditions. The objective of the oracle is to effect the convergence of the network replication rate --- the mean number of nodes in the network hosting each chunk --- on a target value, currently 4. When the replication rate errs below, respectively above, the target, the price oracle raises, resp. lowers its quote. It is argued that sellers will respond to the new incentives by adding, respectively removing, storage from the network, whence the replication rate tends back towards the target.

The price oracle contract has been implemented as part of [Milestone 3](https://www.ethswarm.org/milestone3) of the Swarm roadmap.

*Disclaimer. My understanding of the functioning of the Swarm price oracle is derived from discussions during the Lake Balaton hackweek; please let me know if I've misunderstood something or if my information is out of date!*

In this post, I will argue that because the BZZ/DAI exchange rate is floating, it constitutes an additional degree of freedom in the economy of storage incentives. This degree of freedom is not controlled by the price oracle. Consequently, the oracle adjustments do not guarantee convergence of the replication rate on the target; instead of adding or removing supply, the market could respond to its movements by inversely proportional adjustments in the BZZ/DAI exchange rate. If the value of BZZ tokens is derived primarily from their use in purchasing storage on Swarm, then it is natural to expect this outcome.

For a worst case scenario, suppose the replication rate settles stably below the target. The oracle raises its quote every epoch and the market responds by marking down the value of BZZ tokens accordingly. If the replication rate does not recover, BZZ goes into a death spiral and the Swarm economy implodes. Suppliers may try to save their income stream by "altruistically" adding more supply, but this is costly, introduces an incentive to Sybil by deduplicating, and suffers from the tragedy of the commons.


The controls of the Swarm replication rate could be made more robust by controlling for the additional degree of freedom in the model we will discuss. For example, the price of BZZ tokens could be controlled by establishing a fund to support the token price at a stable peg. Perhaps more satisfyingly, "proofs of replication" could be enshrined in the protocol to control the replication rate directly. 

It is beyond the scope of this document to propose a full solution to this problem.

### Future directions

In the model I will present, I have made many simplifying assumptions and disregarded exogenous factors that may be relevant. Further work should be done to clarify these aspects. In particular:

* Take into account the ability of the Swarm storage market to absorb excess supply in the form of higher replication rate. Study the dynamics of tâtonnement in this context.
* Model the game theory of SWAP bandwidth incentives, the relation of bandwidth pricing to storage pricing, and its influence on the BZZ/USD exchange rate.
* Study optimal staking and its effect on the supply side of the storage market.
* Investigate the dynamics of changes in the storage radius and the resubdivision of neighbourhood bins that ensues.



## Price discovery in a Swarm market

In the classical microeconomic theory of a competitive market for a single good, prices and consumption rates are expected to converge on the market-clearing rate --- the intersection of the supply and demand curves --- by a process known as *tâtonnement*, where sellers adjust their prices and buyers adjust their consumption until prices converge upon the market-clearing rate.

The theory extends easily to the case of a market with heterogeneous goods of different "grades," say parametrised over a set $\mathcal{M}\subseteq\mathbb{R}^k$. As usual, we can define supply and demand as functions 
$$S,D:[0,\infty)\times\mathcal{M}\rightarrow[0,\infty)$$
where $S(p,g)$ (resp. $D(p,g)$) is the quantity of goods the market would supply (resp. demand) at price $p$ and grade $g$. If the graphs of $S$ and $D$ are transverse, their intersection $\widetilde{\mathcal M}$ has dimension equal to that of $\mathcal{M}$. In other words, we may have a different market-clearing price for each grade.

Now suppose the following restrictions are placed on pricing and consumption:

* The market only offers a single price for goods of all grades at each time step.
* Consumers cannot select the grade of good they purchase. They get whatever they're given. 
  However, the user may have information about the distribution $G$ from which the delivered grade is sampled.
  
We adopt the simplistic assumption that consumers choose their consumption rate according to the expected grade $\mathbb{E}[G]$ of goods they receive. In other words, consumers are not "grade risk" averse.

The market now must find an equilibrium parametrised by a single point $(p,g=\mathbb{E}[G])\in\widetilde{\mathcal{M}}$. This model is underdetermined: we don't have enough information to predict which price and expected grade the market will converge on. The actual equilibrium we end up at could be constrained by forces exogenous to the model, or it could be rather arbitrary and vulnerable to repositioning via shocks.

### A stablecoin model

We first consider a Swarm-like network without a native token. Storage is priced in a numéraire currency whose purchasing power is assumed constant; let's call it DAI. We blackbox the mechanism that quotes prices as an oracle $p\leftarrow\mathcal{O}$. There is a single DAI-denominated price $p_t$ for storage on the network per unit size$\cdot$time at time $t$. There is also a single mean replication rate $N_t$, which is the number of nodes (in consensus) divided by the number of neighbourhoods.

Supply and demand for data storage are parametrised over dimensions other than price. For example, durability and retrieval QoS are important differentiators between storage grades, and each of these can be further broken down into various indicators. If storage grades form an $n$-parameter family, we get an $n$-parameter family of market-clearing prices, one for each grade.

For the present article, the function we are interested in is the *replication rate*, an indicator of durability. We have $n=1$, so the space of equilibria is a curve. We suppose that the image of this curve in the $(p,N)$-plane is the graph of a strictly monotone decreasing function $g$, i.e. $p=g(N)$ everywhere on the curve. Now if the designer of the oracle $\mathcal{O}$ wishes the network to converge on a particular replication rate $\hat{N}$, we might naturally guess that his best move is to configure the oracle to spit out the value $g(\hat{N})$. Then the market will only clear if $N=\hat{N}$.

For this approach to work, $N$ has to be able to evolve under something like tâtonnement. In Swarm with the stablecoin pricing model, this could work as follows: 

1. For simplicity, assume that all nodes within a neighbourhood have identical expected earnings. In the actual Swarm network, this corresponds to the assumption that all nodes within a neighbourhood have equal stake.
2. We also assume the total network usage remains in the interval $(2^k,2^{k+1})$ for some $k$. Thus we don't have to consider neighbourhood resubdivision events.
3. Suppose that the reserve has utilisation rate $u\in (\frac{1}{2},1)$.
4. An operator who runs many nodes can choose to enter or leave a neighbourhood with $N$ nodes based on whether or not he is prepared to supply storage with a revenue of $up/N$ per unit. This has the net effect of adjusting $N$.
5. A consumer can choose whether or not to consume storage at price $p$ and replication rate $N$. This has the net effect of adjusting $u$.

A similar line of thought to the classical case convinces us that the market will achieve an equilbrium $(\hat{u},\hat{N})$. So price fixing in terms of the numéraire works, though it may hurt the growth prospects of the market if the modulus $(p,\hat{N})$ is not in high demand.

Since storage on Swarm has analogues on other markets priced in fiat currencies, it is reasonable to make predictions about the actual location of the equilibrium curve based on pricing in these markets.

### BZZ model

Now we introduce the BZZ token to our model. Suppose that Swarm storage is priced in BZZ with price $p^\mathrm{BZZ}$, and that BZZ is traded on highly liquid markets at a free-floating price $p_\mathrm{BZZ}$ with negligible transaction fees. 

We now have a 5-parameter model $(p_\mathrm{BZZ}, p^\mathrm{BZZ}, p, u, N)$ with one relation 

$$p_\mathrm{BZZ}\cdot p^\mathrm{BZZ}=p \qquad (*)$$

Compared to the stablecoin model, we have an additional degree of freedom.

If either $p_\mathrm{BZZ}$ or $p^\mathrm{BZZ}$ is fixed, we can use the equation $(*)$ to eliminate the other variable and obtain an isomorphism to the stablecoin microeconomic model discussed in the previous section. In particular, there is a 1-parameter family of equilibria. The effect of the Swarm price oracle is to fix $p^\mathrm{BZZ}$, so this is the situation in which Swarm finds itself today.


### Exogenous factors

The actual dynamics within this 1-parameter family could be influenced or constrained by exogenous factors affecting the replication rate, consumption rate, or BZZ token price. 


If the primary use of the BZZ token is to purchase storage on the Swarm network, then it is natural to hypothesise that $p_\mathrm{BZZ}$ is primarily determined endogenously.

On the other hand, the value of $p_\mathrm{BZZ}$ could be controlled by exogenous factors, if for example:

* Another good, for example bandwidth, is priced in BZZ tokens, and the BZZ price of that good is also controlled.
* BZZ tokens acquire memetic status, that is, the token price becomes a meme.

If exogenous factors are enough to impose an additional relation on $p_\mathrm{BZZ}$, then we can eliminate it and $p$ from the model and obtain a unique equilibrium replication rate. If the designer of the Swarm protocol wishes to control the equilibrium replication rate, he must exert a tight control over the dominant exogenous factors --- for example, controlling the BZZ/DAI exchange rate by buying and selling at a fixed price.



## An attack: Permissionless oracle price manipulation

We now turn to the description of an economic "attack" that uses the price oracle to manipulate the price of BZZ. This attack takes advantage of the uncontrolled degree of freedom in the pricing model together with an inexpensive Sybil.

Suppose I take over a large majority of the network, providing many nodes (>4) in every neighbourhood. By running all nodes within a neighbourhood on the same machine, I can save resources by deduplicating storage. One can probably also somewhat deduplicate the network usage by sharing peer lists. Hence running these nodes is not much more expensive than running a single node in each neighbourhood.

The price oracle detects excess supply and starts marking down the BZZ-denominated price of storage. This price keeps going down as long as I continue to run all these nodes. The underlying value of storage on the network does not change during this time. This holds regardless of whether I announce that I'm doing this strategy and hence reveal the true number of replicas being stored.

There are two ways the price of BZZ can respond to this situation:

1. If the price of BZZ is mainly determined by its ability to purchase storage on Swarm, a decrease in $p^\mathrm{BZZ}$ with constant $p$ means an increase in BZZ/DAI.
2. If the price of BZZ is mainly determined by other factors, $p$ will keep going down, eventually pricing "honest" nodes out of the market. However, this cannot happen without limit, because at some point I can arbitrage the storage price by purchasing storage on Swarm and providing it on another decentralised storage network (e.g. Storj). This creates a buy pressure for BZZ. As long as there is someone to make this arbitrage, at some point we end up in scenario 1.

It's easy enough to see how a large scale node operator could increase their short-term profits using this strategy: buy BZZ on the bonding curve, push BZZ price up, sell back to the bonding curve, then switch off the excess nodes.

### Commentary

This attack makes use of Swarm's weak disincentive to deduplicate and the effect of market forces on the price oracle. A protocol that controls replication rate more directly would make it impossible or impractical to deduplicate, and would obviate the need for the self-adjusting price oracle.

Depending on the actual values of some real-world parameters, the attack may not be feasible or profitable in practice. However, the reader should not be fooled into thinking that this is the only vector by which the price oracle could undermine the Swarm economy, or that negative effects can only arise from "adversarial" or "manipulative" behaviour. The underlying issue of the uncontrolled degree of freedom feeding through the oracle can lead to undesirable equilibria through perfectly socially acceptable "fair" business practices.
