Quota

TIP

Please note this is not a technical document, but mainly describes quota and quota-related topics. Technical details will be introduced in the yellow paper.

The Definitions of Terms:

  • Quota: In Vite system, transactions consume quota for exchanging computing and storage resources.
  • : Proof of Work, used to prove a certain amount of computation has been performed.
  • Stake: A quantity of in the account is frozen and cannot be spent, usually for quota in return.
  • Staking address:The account who starts the staking transaction.
  • Quota recipient address:The account who receives quota.

What is quota

In Ethereum, transactions have to compete with each other by specifying attractive gas price as transaction fee. The higher gas price the bigger chance the transaction has to be processed by the miner. This is a typical bidding model. In principle, the gap between supply and demand can be effectively balanced by price. However, because it is difficult for users to determine the current supply and demand before bidding, in addition to the impossibility of predicting other competitors, market failure could be caused often. Moreover, since all the competing bids are simply applied to transactions, no effective solution is implemented to allocate TPS resources among accounts. In Vite, a certain amount of quota is consumed when the user initiates a transaction, such as transfer, deploying smart contract, invoking smart contract method, issuing new token, registering SBP, retrieving mining rewards, voting or staking. Vite has designed a quota model to balance between resource supply and demand.

Users are able to acquire quota in two ways:

  • Compute a when doing a transaction, or
  • Stake a amount of in the account.

If the user only needs to send a transaction, he may calculate a to get a small amount of free quota on demand. If the user need send frequent transactions constantly, he should stake to get enough quota.

We recommend users to obtain quota by staking.

Quota usage rules

Different transactions consume different amount of quota. In Vite TestNet, the quota required for various transaction types are as follows:

Transaction type Quota consumed
Send a transaction without comment 21000
Receive a transaction 21000
Register SBP 62200
Update SBP registration 62200
Revoke SBP registration 83200
Retrieve mining rewards 238800
Vote 62000
Cancel voting 62000
Stake for quota 21000
Cancel staking 21000
Issue new token 83200
Retrieve issuance stake 83200

In addition, comment consumes additional quota - 4 quota for zero character and 68 quota for each non-zero character.

For example, given hex encoding is used, to send a transfer transaction with the comment of 0x0001 (having two characters in total while the first is zero and the second is non-zero). The consumed quota is:

Quota calculation

Quotas are calculated by the following formula:

  • : The current available quota of the account;
  • : The quota cap of a single account, related to total system throughput and total number of accounts;
  • : The difficulty computed by the account when sending a transaction;
  • : The weight of the quota obtained by computing ;
  • : The amount of staked by the account;
  • : The waiting time before sending a transaction, equivalent to height different between the snapshot block that current transaction refers to and an older snapshot block that previous transaction refers to.
  • : The weight of the quota obtained by staking.

In TestNet some are constants,

  • = 1000000
  • = 6.259419649e-10
  • = 4.200627522e-24

For the convenience in actual calculation, only is calculated. The result is mapped into corresponding quota based on the following table:

The maximum number of uncommented transactions can be sent in a snapshot Approximately equivalent to how much is staked without computing Approximately equivalent to how much is calculated without staking
0.0 0 0 0 0
21000 1 10000 67108864
42000 2 20009 134276096
63000 3 30036 201564160
84000 4 40089 269029376
105000 5 50178 336736256
126000 6 60312 404742144
147000 7 70501 473120768
168000 8 80754 541929472
189000 9 91082 611241984
210000 10 101495 681119744
231000 11 112005 751652864
252000 12 122623 822910976
273000 13 133362 894976000
294000 14 144235 967946240
315000 15 155256 1041903616
336000 16 166440 1116962816
357000 17 177804 1193222144
378000 18 189364 1270800384
399000 19 201141 1349836800
420000 20 213156 1430462464
441000 21 225428 1512824832
462000 22 237989 1597120512
483000 23 250862 1683513344
504000 24 264082 1772216320
525000 25 277682 1863491584
546000 26 291702 1957568512
567000 27 306188 2054791168
588000 28 321192 2155479040
609000 29 336772 2260041728
630000 30 353004 2368962560
651000 31 369958 2482757632
672000 32 387743 2602090496
693000 33 406468 2727755776
714000 34 426270 2860646400
735000 35 447322 3001933824
756000 36 469840 3153051648
777000 37 494096 3315826688
798000 38 520436 3492593664
819000 39 549332 3686514688
840000 40 581427 3901882368
861000 41 617620 4144775168
882000 42 659288 4424400896
903000 43 708576 4755193856
924000 44 769276 5162500096
945000 45 848844 5696520192
966000 46 965904 6482067456
987000 47 1197301 8034975744

For example, without calculating , staking 10000 should meet a transaction rate of up to 1 and 2 rate can be reached by 20009 stake. Staking 10 and waiting 1000 snapshot blocks (about 16 minutes and 40 seconds) is also sufficient to send a transfer transaction without comment.

Two ways of obtaining quota

Stake

Users can obtain quota by sending a stake transaction to built-in contract. When the transaction is received and confirmed, the specified quota recipient account will be granted with the corresponding quota.

Parameters

  • Staking amount: The minimum staking amount is 10.
  • Quota recipient address: The account who receives quota, could be the staking account itself or any other account since staking for other accounts is permitted.

The staked will be temporarily deducted from balance, and cannot be traded during staking period. The staking account can retrieve staked tokens after 259,200 snapshot blocks (about 3 days) by sending a cancel-staking transaction. After this transaction is received and confirmed, the corresponding quota in the quota recipient account won't exist any more.

Computing PoW

The user can obtain an one-time quota by computing a upon transaction sending. According to the formula, the expected difficulty is 0x3FFFFFF for sending an uncommented transfer transaction without staking.

In the TestNet, we have built a pool, which provides the capability to obtain transaction quotas by calculating PoW in Vite official wallet.

PoW formula

  1. Convert to in following formula:

= 2**256 / (1 + 1/)

  • : difficulty, 256-bit number, padding zeros at front when less than 256 bits;
  • : target, 256-bit number, usually the first bit is 1.

For example, if = 0x3FFFFFF, then = 0xFFFFFFC000000000.

  1. Calculate based on transaction data. is the proof of work. In calculation, a random number is continuously assigned to until the following conditions are met:

  • : Hash function
  • : User account address
  • : Hash of previous account block

FAQ

  • Can I stake for multiple quota recipient addresses?

Yes. You need to send multiple staking transactions to different quota recipient addresses. Each staking can have different expiration.

  • Can I stake for the same recipient multiple times?

Yes, the staking amount for this recipient will be accumulated. Staking expiration time = height of snapshot block referenced by the response block of last staking transaction + 259200.

  • Can I have my , which was staked to a recipient address, be retrieved in multiple times?

Yes. After stake expires, staked can be retrieved in multiple times. Stake retrieval won't change the expiration time.

  • Is a stake retrievable if it has not expired yet?

No. However, the stake can be retrieved at any time after it expires.

  • Will the quota obtained by staking be used up?

Quota obtained through staking is related to staking amount and snapshot block height difference during the period in which no transaction has taken place, and continues to be effective as long as the staked is not retrieved. If the wallet shows your current quota is 0, it may increase after waiting for a while.

  • Can a recipient accept quota staked from multiple staking addresses?

Yes. The received quota is the sum of the staking amount that has applied to this recipient address.

  • Does receiving transaction consume quota?

Yes, an individual receiving transaction consumes 21,000 quota.

  • How to receive the first transaction in a new account if I don't stake?

If you don't have to stake, you can calculate to get one-time quota instead.