🧮

# Variables, Equations and the State

### Token Mechanics Diagram

Coming from the causal loop diagram, the diagram below goes a level deeper to define the relationships between the variables mathematically.  ### Variables & Equations

Mathematical definitions of the variables and the relationships between them are as shown below:

#### Queries

Qcᵢ: Number of queries from Connector i, i [1, n] Qcuᵢ: Number of queries from Curator i, i [1, n] Qhᵢ: Number of queries from Hollower i, i [1, n] Quᵢ: Number of queries from User i, i [1, n] Qutot: Total user queries by users Qbriᵢ: # of queries bridger i’s content received Qbritot: Total # of received queries by all bridgers Cqᵢ: # of content per query for Connector i, i [1, n]
$Qutot = \sum_{i=1}^{n} Qu_i$
$Qbritot = \sum_{i=1}^{n} Qbri_i$

#### Fees

DBFq: DBaaS Fee Per Query DBFhᵢ: Fees collected from Hollower i, i [1, n] DBFtot: Total DBaaS Fees Collected
$DBFh_i = DBFq * Qh_i$
$DBFtot = \sum_{i=1}^{n} DBFh_i$
PFq: PaaS Fee Per Query PFcᵢ: Fees collected from Connector i, i [1, n] PFtot: Total PaaS Fees Collected
$PFcq_i = PFq * Qc_i$
$PFtot = \sum_{i=1}^{n} PFcq_i$
SSFq: SSaaS Fee Per Query SSFcuᵢ: Fees collected from Curator i, i [1, n] SSFtot: Total DBaaS Fees Collected
$SSFcu_i = SSFq * Qcu_i$
$SStot = \sum_{i=1}^{n} SSFcu_i$
Ftot: Total Fees Collected
$Ftot = PFtot + DBFtot + SSFtot$

#### Reward Rates

RRuser: User Rewards Rate RRbrid: Bridger Rewards Rate RRfb: FirstBatch Revenues Rate
$RRuser + RRbrid + RRfb = 1$

#### Reward Amounts

Rutot: Total User Rewards Rbritot: Total Bridger Rewards Rfb: FirstBatch Revenues Ruᵢ: User i’s rewards, i [1, n] Rbriᵢ: Bridger i’s Rewards, i [1, n] Rfb: FirstBatch Revenues
$Ftot = \frac{Rutot}{RRuser} = \frac{Rbritot}{RRbrid} =\frac{Rfb}{RRfb}$
$Rbri_i = \frac{RbriTot * Qbri_i}{Qbritot}$
$Ru_i = \frac{Rutot * Qu_i}{Qutot}$

#### Utility Function

The utility function of the protocol is given by a coub-douglas productivity function of bridger and user rewards, divided by an exponential function of the personalization fees per query. This equation expresses the positive effect bridger and users rewards have on the ecosystem while still accounting for the negative effect of query fees:
$U(BriRq, UserRq, PFq) = \frac{BriRq^{\frac{a}{a+b}} \cdot UserRq^{\frac{b}{a+b}}}{e ^ {PFq}},\\ \quad \text {where } \frac{a}{a+b}=RRbrid \quad and \quad\frac{b}{a+b}=RRuser$
$U(BriRq, UserRq, PFq) = \frac{BriRq^{\frac{a}{a+b}} \cdot UserRq^{\frac{b}{a+b}}}{e ^ {PFq}},\\ \quad \text {where } \frac{a}{a+b}=RRbrid \quad and \quad\frac{b}{a+b}=RRuser$
Lagrange multipliers equation of the Coub-Douglas part of the utility function and its first order conditions can be calculated as:
\begin{aligned} L &= BriRq^a \cdot UserRq^b + \lambda(Qbritot \cdot BriRq + Qutot \cdot UserRq - Ftot_{xfb}) \end{aligned}
$\frac{\partial L}{\partial BriRq} = aBriRq^{a-1} * UserRq^b + \lambda Qbritot = 0$
$\frac{\partial L}{\partial UserRq} = bBriRq^a * UserRq^{b-1} + \lambda Qutot = 0$
$\frac{\partial L}{\partial \lambda} = Qbritot * BriRq + Qutot * UserRq - Ftot_{xfb} = 0$
The monetary policy of the protocol is dynamically managed by controlling reward rates and fee amounts while satisfying the first-order conditions above. Fees for the Similarity Search as a Service and DataBase as a Service are based on traditional SaaS pricing methods.

### State

The state of the token ecosystem is defined as a combination of 7 sections. Protocol-wide variables are under the first two sections; exogenous variables (fee amounts and reward rates) are continuously updated to determine the monetary policy, and endogenous variables keep track of the sums created by the agents’ actions. The other sections keep data related to unique agents for each role. The state as the ecosystem from a high level is as such:
$\left\{ \begin{matrix} \text{Protocol Exogenous} \\ \text{Protocol Endogenous} \\ \text{FirstBatch} \\ \text{Users} \\ \text{Connectors} \\ \text{Curators} \\ \text{Hollowers} \end{matrix} \right\}$
The set above has multiple subsets and matrices as its elements as seen in the code snippet below:
State = {
"ProtocolEx":{"DBFq":2,"PFq":2,"SSFq":3,"RRuser":0.5, "RRbrid":0.2, "RRfb":0.3}, # Protocol-wide variables set by FirstBatch
"ProtocolEn":{"Qutot":0,"Qbritot":0,"DBFtot":0,"PFtot":0, "SSFtot":0, "Ftot":0, "Rutot":0, "Rbritot":0}, # Protocol-wide sums determined by actions
"FirstBatch":{"Rfb":0}, # FirstBatch's revenue
"Users":[{"Qu":0,"Ru":0}, {"Qu":0,"Ru":0}, {"Qu":0,"Ru":0}], # Query count and rewards of each user
"Bridgers": [{"Rbri":0,"Qbri":0}, {"Rbri":0,"Qbri":0}, {"Rbri":0,"Qbri":0}], # Query count and rewards of each bridger
"Connectors": [{"Qc":0,"Cq":50, "PFc":3}, {"Qc":0,"Cq":50, "PFc":3}], # Query count, content per query and fees collected for each connector
"Curators": [{"Qcu":0,"SSFcu":0}, {"Qcu":0,"SSFcu":0}], # Query count and fees collected for each curator
"Hollowers": [{"DBFh":0,"Qh":0}, {"DBFh":0,"Qh":0}] # Query count and fees collected for each hollower
}

#### Protocol Exogenous

• DBFq (DBaaS Fee Per Query)
• PFq (PaaS Fee Per Query)
• SSFq (SSaaS Fee Per Query)
• RRuser (User Rewards Rate)
• RRbrid (Bridger Rewards Rate)
• RRfb (FirstBatch Reward Rate)

#### Protocol Endogenous

• Qutot (Total user queries)
• Qbritot (Total # of received queries by all bridgers)
• DBFtot (Total DBaaS Fees Collected)
• PFtot (Total PaaS Fees Collected)
• SSFtot (Total DBaaS Fees Collected)
• Ftot (Total Fees Collected)

#### FirstBatch/FB Foundation

• Rfb (FirstBatch Revenues)

#### Users

• User i
• Quᵢ (Number of queries from User i)
• Ruᵢ (User i’s rewards)

#### Bridgers

• Bridger i
• Rbriᵢ (Bridger i’s Rewards)
• Qbriᵢ (# of queries bridger i’s content received)

#### Connectors

• Connector i
• Qcᵢ (Number of queries from Connector i)
• Cqᵢ (# of content per query for Connector i)
• PFcᵢ (Fees collected from Connector i)

#### Curators

• Curator i
• Qcuᵢ (Number of queries from Curator i)
• SSFcuᵢ (Fees collected from Curator i)

#### Hollowers

• Hollower i
• DBFhᵢ (Fees collected from Hollower i)
• Qhᵢ (Number of queries from Hollower i)