# Mathematics of Bonding Curves

A bonding curve is a financial instrument proposed by Simon de la Rouviere in his Medium articles. ETH is bonded in a smart contract to mint tokens, and unbonded to burn them. Every bonding and unbonding changes the price of the token according to a predefined formula. The “curves” represent the relationship between the price of a single token and the token supply. The result is an ETH-backed token that rewards early adopters.

Inside a transaction, **the price paid/received per token is not constant** and depends on the amount that is bonded or unbonded. This complicates the calculations.

Let’s say for an initial supply of $S_0$, we want to bond $T$ tokens which are added to the new supply $S_1=S_0+T$. The ETH $E$ that must be spent for this bonding is defined as

\[E = \int_{S_0}^{S_1} P\, dS\]which is illustrated in the figure above. If one wanted to unbond $T$ tokens, the upper limit for the integral would be $S_0$ and the lower $S_0-T$, with E corresponding to the amount of ETH received for the unbonding.

# Linear Curves

A linear relationship for the bonding curves are defined as

\[P(S) = P_0 + S I_p\]where $P_0$ is the initial price of the token and $I_p$ is the price increment per token.

## Bonding Tokens

Let us have $E$ ETH which we want to bond tokens with. Substituting $P$ into the integral above with the limits $S_0\to S_0+T$, we obtain $E$ in terms of the tokens $T$ that we want to bond:

\[E(S, T) = T P_0 + T I_p S + \frac{1}{2} T^2 I_p\]where $S$ is the supply before the bonding. Solving this for $T$, we obtain the tokens received in a bonding as a function of the supply and ETH spent:

\[\boxed{T(S, E) = \frac{\sqrt{S^2I_p^2 + 2E I_p + 2 S P_0 I_p + P_0^2}-P_0}{I_p} - S.}\]## Unbonding Tokens

Let us have T tokens which we want to unbond for ETH. Unbonding $T$ tokens decreases the supply from $S_0$ to $S_0-T$, which we apply as limits for the above integral and obtain:

\[\boxed{E(S, T) = T P_0 + T I_p S - \frac{1}{2} T^2 I_p.}\]# Breaking Even in PoWH3D

PoWH3D is one of the applications of bonding curves with a twist: 1/10th of every transaction is distributed among token holders as dividends. When you bond tokens with $E$ ETH, you receive $9/10 E$ worth of tokens and $1/10 E$ is distributed to everybody else in proportion to the amount they hold.

This means you are at a loss when you bond P3D (the token used by PoWH3D). If you were to unbond immediately, you would only receive 81% of your money. Given the situation, one wonders when exactly one can break even with their investment. The activity in PoWH3D isn’t deterministic; nonetheless we can deduce **sufficient but not necessary conditions** for breaking even in PoWH3D.

## Sufficient Bonding

Let us spend $E_1$ ETH to bond tokens at supply $S_0$. The following calculations are done with the assumption that the tokens received

\[T_1 = T(S_0, 9E_1/10)\]are small enough to be
neglected, that is $T_1 \ll S_0$ and $S_1 \approx S_0$. In other words, *this only
holds for non-whale bondings*.

Then let others spend $E_2$ ETH to bond tokens and raise the supply to $S_2$. The objective is to find an $E_2$ large enough to earn us dividends and make us break even when we unbond our tokens at $S_2$. We have

\[S_2 = S_0 + T(S_0, E_2).\]Our new share of the P3D pool is $T_1/S_2$ and the dividends we earn from the bonding is equal to

\[\frac{1}{10}\frac{T_1}{S_2}E_2.\]Then the condition for breaking even is

\[\boxed{\frac{9}{10} E(S_2, T_1) + \frac{1}{10}\frac{T_1}{S_2}E_2 \geq E_1.}\]This inequality has a lengthy analytic solution which is impractical to typeset. The definition should be enough:

\[E^{\text{suff}}_2(S_0, E_1) := \text{solve for $E_2$}\left\{\frac{9}{10} E(S_2, T_1) + \frac{1}{10}\frac{T_1}{S_2}E_2 = E_1\right\}\]and

\[E_2 \geq E^{\text{suff}}_2.\]$E^{\text{suff}}_2$ can be obtained from the source of this page in JavaScript from
the function `sufficient_bonding`

. *The function involves many power
and square operations and may yield inexact results for too high values of
$S_0$ or too small values off $E_1$, due to insufficient precision of the
underlying math functions.* For this reason, the calculator is disabled
for sensitive input.

The relationship between the initial supply and sufficient bonding is roughly quadratic, as seen from the graph above. This means that the difficulty of breaking even increases quadratically as more people bond into P3D. As interest in PoWH3D saturates, dividends received from the supply increase decreases quadratically.

The relationship is not exactly quadratic, as seen from the graph above. The function is sensitive to $E_1$ for small values of $S_0$.

## Sufficient Unbonding

Let us spend $E_1$ ETH to bond tokens at supply $S_0$ and receive $T_1$ tokens.

Then let others unbond $T_2$ P3D to lower the supply to $S_2$. The objective is to find a $T_2$ large enough to earn us dividends and make us break even when we unbond our tokens at $S_2$. We have

\[S_2 = S_0 - T_2.\]Our new share of the P3D pool is $T_1/S_2$ and the dividends we earn from the bonding is equal to

\[\frac{1}{10}\frac{T_1}{S_2} E(S_2, T_2)\]Then the condition for breaking even is

\[\boxed{\frac{9}{10} E(S_2, T_1) + \frac{1}{10}\frac{T_1}{S_2} E(S_2, T_2) \geq E_1.}\]Similar to the previous section, we have

\[T^{\text{suff}}_2(S_0, E_1) := \text{solve for $T_2$}\left\{\frac{9}{10} E(S_2, T_1) + \frac{1}{10}\frac{T_1}{S_2} E(S_2, T_2) = E_1\right\}\]and

\[T_2 \geq T^{\text{suff}}_2.\]$T^{\text{suff}}_2$ can be obtained from the function `sufficient_unbonding`

.

The relationship between $S_0$ and $T^{\text{suff}}_2$ is linear and insensitive to $E_1$. Regardless of the ETH you invest, the amount of tokens that need to be unbonded to guarantee your break-even is roughly the same, depending on your entry point.

## Calculator

Below is a calculator you can input $S_0$ and $E_1$ to calculate $E^{\text{suff}}_2$ and $T^{\text{suff}}_2$.

$S_0$ | |
---|---|

$E_1$ | |

$E^{\text{suff}}_2 $ | |

$T^{\text{suff}}_2 $ |

For the default values above, we read this as:

For 100 ETH worth of P3D bonded at 3,500,000 supply, either a bonding of ~31715 ETH or an unbonding of ~3336785 P3D made by other people is sufficient to break even.

In order to follow these statistics, you can follow this site.

# Conclusion

Bonding curve calculations can get complicated because the price paid per token depends on the amount of intended bonding/unbonding. With this work, I aimed to clarify the logic behind PoWH3D. Use the formulation and calculator at your own risk.

The above conditions are only sufficient and not necessary to break even. As PoWH3D becomes more popular, it gets quadratically more difficult to break even from a supply increase. PoWH3D itself doesn’t generate any value or promise long-term returns for its holders. However every bond, unbond and transfer deliver dividends. According to its creators, P3D is intended to become the base token for a number of games that will be built upon PoWH3D, like FOMO3D.