Skip to content

Exchanges How to Distribute Gas to Users

Peter Lin edited this page Oct 9, 2017 · 14 revisions

The Steps that Exchanges Follow to Distribute Gas to Users

  1. Take a data snapshot of the users’ Neo positions at regular intervals;

  2. Calculate the weight of a single user’s Neo positions, i.e. summing up the weights of this user’s position at all the snapshots. The weight of a position at Snapshot n equals the position times its holding period.

  3. Calculate the total weight of all the users’ Neo positions, i.e. summing up the weights of each single user.

  4. Calculate the total amount of Gas to be distributed and claim them.

  5. Calculate the proportion of Neo owned by each user and distribute the corresponding amount of Gas to each user based on this proportion.

Details of the Distribution

  1. We assume that all the addresses in the exchanges are in one wallet;

  2. Calculation Procedure: Let TotalNeoGas be the total amount of Gas to be distributed (decided by the exchange), and NeoAmountA1 be the position of User A at the 1st Snapshot moment, then NeoAmountA = NeoAmountA1 + … + NeoAmountAn
    NeoAmountTotal = NeoAmountA + … + NeoAmountZ
    NeoRatioA = NeoAmountA / NeoAmountTotal
    Thus, the amount of Gas that User A should be granted can be calculated as:
    DistributedGasA = TotalNeoGas x NeoRatioA

  3. The shorter the snapshot interval, the more precise the calculation is;

  4. If the snapshot interval is not uniform, we will use the weighted average calculation as the following: Let TotalNeoGas be the total amount of Gas to be distributed (decided by the exchange), NeoAmountA1 be the position of User A at the 1st Snapshot, and Tn be the time length between the nth snapshot and the n-1th snapshot, then
    NeoAmountA = NeoAmountA1 x T1 + … + NeoAmountAn x Tn
    NeoAmountTotal = NeoAmountA + … + NeoAmountZ
    NeoRatioA = NeoAmountA / NeoAmountTotal
    Thus, the amount of Gas that User A should be granted can be calculated as:
    DistributedGasA = TotalNeoGas x NeoRatioA.

The Operational Procedure Taken by Neo to Claim Gas

  1. Run the client

./neo-cli.dll /rpc

  1. Check the version of the client

version
img

  1. Check the synchronized height of the client

show state
img
Height: height/header height, Nodes: amount of connected nodes

  1. Create a wallet

create wallet /home/NeoNode/test.db3
img

  1. Open the wallet created in the last step

open wallet /home/NeoNode/test.db3
img

  1. Check the address list in the wallet

list address
img

  1. Check the assets in the wallet

list asset
img

  1. Get the details of the balances of Neo Gas in the wallet

show gas
img

  1. Transfer Neo to yourself to change the status of Gas to be claimable.

send NEO AaAHt6Xi51iMCaDaYoDFTFLnGbBN1m75SM 1
img

  1. Get the details of the balances of Neo Gas in the wallet again. Now the status of all the Gas should be available to claim.

show gas
img

  1. Claim Neo Gas

claim gas
img

  1. Check balace again

list asset
img

Introduction of Neo Gas

  1. Brief Introduction
    Neo Gas represents the right to use the Neo Blockchain. There will be 100 million Neo Gas in total. Neo Gas are generated along with every new block. The issuance will slow down according to a set slowly-decreasing pace, while Neo Gas will go through a generating process to grow from zero to 100 million. Once Neo is acquired, Neo Gas will be generated in the system following the algorithms.

  2. Basic Concept
    Every Neo has two states, unspent and spent. Each Gas has two states too, which are available and unavailable. A life cycle of a Neo starts from being transferred into an address and ends with being transferred out of that address. When it is transferred in, its state becomes unspent while when it is transferred out, its state becomes spent. When Neo is at the unspent state, its generated Gas will be in unavailable state; when Neo is at the spent state, its generated Gas will be in available state, so the users can claim them.

  3. Mathematical Model
    t_start = the moment that Neo goes into the state of unspent
    t_end = the moment that Neo goes into the state of spent
    Δt_const = t_end - t_start
    Δt_var = t - t_start
    Available Gas = f(neo_amount, Δt_const)
    Unavailable Gas = f(neo_amount, Δt_var)
    Please note that:
    Δt_const is fixed, thus the available Gas is of a fixed amount too. And this amount is a function of the amount of Neo held by the user and the duration between the moments that he or she transferred this amount of Neo into and out of his or her address. The current time is a variable, so the amount of the unavailable Gas also grows through time, which means it is a variable.

  4. How to Claim Gas
    Gas can be claimable after you transfer your Neo. For example, someone has Neo in address A and gas are not claimable, he transfer his Neo to himself(address A) then the Neo gas are claimable.

  5. Usage

  • To pay to the Neo blockchain for recording
  • To pay to the Neo blockchain for additional services