Search…
⌃K

Payments

Payments are facilitated by maintaining an account balance in the ssv network smart contract, which keeps a balance sheet for all network participants.
Accounts created when registering validators and operators to the network are accessible and owned by the wallet address that transmitted the transaction. This means that the address is the account’s owner, enabling it to manage its balance and its chosen validators/operators.
All account balances are pooled in the SSV network smart contract to enable the calculation of payment flows between network participants. The flows are maintained by keeping track of each user’s accumulated deposits, withdrawals, revenue, and expenses which forms their account balance.
Balance components are calculated by a set of formulas (outlined below) every time an event occurs that influences that user’s account. Each time such an event occurs the components of the balance are calculated retroactively up to the current state and a new snapshot is taken to be used for future calculations.
Contract payment flow
The account balance consists of 4 variables and is calculated by:
balance=d+rewbalance = d + r - e - w
  • Legend
    • d - deposits
    • r - revenue
    • e - expenses
    • w - withdrawals

Deposits & Withdrawals

The net transfers of deposits and withdrawals made to the user account balance.

Revenue

Earnings received by operators as payment from stakers for operating their validators.
  • Revenue is calculated by the sum of earnings from all the operators of the account:
revenue=(eoperators)revenue = \sum(e_{operators})
  • Earnings for each operator are calculated by:
eoperator=ep+(bbp)fve_{operator}= e_p + (b-b_p) * f * v
  • Legend
    • epe_p
      ​ - previously accumulated earnings
    • bb
      - current block
    • bpb_p
      ​ - previous block
    • ff
      - fee​ ($SSV per block)
    • vv
      ​ - # of validators that the operator manages
Earnings are calculated for each operator by keeping track of their accumulated earnings (
epe_p
) every time an operator fee changes (
ff
) or when gaining or losing a validator (
vv
).

Expenses

Expenses come in the form of payments made to operators for managing their validators and network fees paid to the network.
  • Expenses are calculated by the sum of payments to operators in addition to accrued network fees:
expenses=(poperators)+pnetworkexpenses = \sum(p_{operators}) + p_{network}
Indexes: Operator and Network Fees
Indexes help keep track of payments in relation to ongoing fee updates from the network and its operators.
Indexes are stored separately for both operator and network fee changes and represent a curve of accumulated fee changes over time.
Operator Index from block 100 (registration) to block 200, presenting 4 fee updates
  • Indexes are calculated by:
index=indexp+(bbp)findex =index_p + (b - b_p) * f
  • Legend
    • indexpindex_p
      ​ - previous index
    • bb
      ​ - current block
    • bpb_p
      ​ - previous block
    • ff
      - fee ($SSV per block)
      • Operator index - operator fee
      • Network fee index - protocol fee
Indexes are calculated by keeping track of the accumulation of fees over time (
indexpindex_p
) every time the network or an operator changes their fee (
ff
).
Indexes in Payments
Each account on the network stores an operator and network index from the time an operator (and the network) starts managing their validators. Referencing the current
indexindex
of the operator in relation to the previous index (
indexpindex_p
) - during the payment calculations - enables the contract to determine account expenses in isolation. This is done to exclude it from the other network participants' activity (e.g. frequent fee changes), allowing the calculation to be accomplished in an isolated manner which optimizes contract execution performance and cost.

Payments

  • Payment per each operator is calculated by:
poperator=pp+(iip)vp_{operator}=p_p + (i-i_p) * v
  • Legend
    • ppp_p
      - previously accumulated payments
    • ii
      - current operator index
    • ipi_p
      - previous operator index
    • vv
      - # of validators operators for the user (specific operator)
Payments are calculated for each operator by keeping track of it’s accumulated payments (
ppp_p
) every time an account changes its validators count (
vv
) with the operator.
  • Network payment per each account is calculated by:
pnetwork=pp+(iip)vp_{network} =p_p + (i - i_p) * v
  • Legend
    • ppp_p
      - previous accumulated network fees
    • ii
      - current network fee index
    • ipi_p
      - previous network fee index
    • vv
      - # of validators operator for the user (across all operators)
Network fees are calculated for each account by keeping track of it’s accumulated network fees(
ppp_p
) every time an account onboards a new validator to the network, or leaves it (
vv
).

Indexes Scenario Example

  • Bob has registered a validator to the network to be managed by Alice the operator at block 120:
    • palice=0p _{alice} = 0
      ,
      ppp_p
      --> 0 ,
      ipi_p
      --> 200 ,
      vv
      --> 1
  • At block 140, Bob has registered an additional validator to be managed by Alice:
    • palice=0+(800200)1=600p _{alice} = 0 + (800 - 200) * 1 = 600
      ,
      ppp_p
      --> 600 ,
      ipi_p
      --> 800 ,
      vv
      --> 2
  • At block 180, Bob chose to replace Alice with Eve to manage his validators - the total payments Bob has made to Alice thus far is 3000:
    • palice=600+(2000800)2=3000p_{alice} = 600 + (2000 - 800) * 2 = 3000
      ,
      ppp_p
      --> 3000 ,
      ipi_p
      --> 2000 ,
      vv
      --> 0

Network Fees

Fees accrued to the protocol treasury from validators for using the network.
  • Network fees are calculated by:
Network  Fees=NFp+(bbp)fvNetwork \; Fees= NF_p + (b-b_p) * f * v
  • Legend
    • NFpNF_p
      - previous accumulated fees
    • bb
      - current block
    • bbb_b
      - previous block
    • ff
      - fee ($SSV per block)
    • vv
      - # of validators in the network
Fees are maintained for the whole network by keeping track of it’s accumulated fees (
NFpNF_p
) every time the network fee changes (
ff
) or when the network gains or loses a validator (
vv
).
Last modified 2mo ago