Credit Traffic¶
Each Ace Stream user has a "credit limit" of traffic in amount of 10 GB. This means that during settlements for traffic a user can consume traffic on credit if he does not have enough funds to pay for traffic. The creditors are the peers which provide traffic. The maximum total amount of credits for one user is 10 GB. If a user has exceeded his credit limit, then network peers stop sending traffic to him until the loan is paid back (in whole or in part).
The credit limit for each user is stored in the blockchain and is expressed as an integer from 0 to 10240 as this is the number of megabytes of traffic that a user can loan.
Credit repayment¶
Credit repayment is performed automatically by system smart contracts from the account for paying for services according to the traffic payment algorithm. The traffic price is calculated at the moment of credit repayment.
Technical implementation¶
The credit limit for an individual account is formed on the basis of two numbers stored in the main blockchain:
- system setting
traffic_credit_limit- the maximum number of traffic units that can be loaned - field
traffic_credit_usedof account it is an integer and the number of traffic units that the account took on credit. This field can only be changed by system smart contracts.
Credit limit formula:
credit_limit = SystemSettings.traffic_credit_limit - account.traffic_credit_used
Information about the loans itself (who owes whom and how much) is stored in the second-level blockchains.
Example¶
We introduce the following marks:
UserA- is a new member of the Network: credit limit 10240, on account there is 0 tokens.UserB,UserC,UserD- are Network peers who provide traffic to UserA
Now let's look at an example of how these peers interact:
UserAreceives 3 Gb (3072 Mb) of traffic fromUserB. AsUserAhas no tokens, then he receives traffic on credit. This means thatUserAhas owedUserB3072 Мb.UserAcredit limit has decreased to 7168 (10240 - 3072).UserAreceives 7 Gb (7168 Мb) of traffic from UserС. AsUserAhas no tokens, then he receives traffic on credit. This means thatUserAhas owedUserC7168 Мb.UserAcredit limit has decreased to 0.UserCstops providing data toUserA, as he exceeded credit limit and cannot pay for traffic.-
UserArefills his paying for services account for 0.2 XAB.System smart contract covers
UserAcredits:UserBreceives 0.03 XAB (minus system commission) - payment for 3 Gb traffic which was given on creditUserCreceives 0.07 XAB (minus system commission) - payment for 7 Gb traffic which was given on creditUserAis charged 0.1 XAB- UserA
credit limitincreased to 10240 UserAreceives 15 GB (15360 MB) of traffic fromUserD.UserAhas 0.1 XAB and this is enough to pay for 10 GB traffic. The remaining 5 GB of trafficUserAtakes fromUserDon credit:UserDreceives 0.1 XAB (minus system commission)UserAis charged 0.1 XABUserAcredit limit decreased to 5120UserAhas owedUserD5 Gb traffic