Cypherium | Power, Gas, and Gasprice Mechanism Design V1.0.0

Cypherium
Cypherium
Published in
5 min readDec 5, 2018

1.1 The role of gas

In Ethereum, the gas paid by the originator of the transaction will eventually be calculated and paid in the value of the ETH currency.

Accordingly, mining work is calculated as a fee, using the following equation:

Gas = GsUsed * GasPrice.

Gas and ETH serve various roles in the Ethereum network:

● A measure of the on-chain computing resources expended by users and developers when initiating various operations.

● A reward method for the miners who pack and verify blocks.

● A operational fee, which may serve as protection against a Denial-of-Service type attack, preventing economic paralysis.

1.2 The pain point of the ETH gas mechanism

Because Etherum can achieve just 4 to 20 transactions per second (TPS), the computing resources of the network are very valuable, and competition for those resources sets the order of transaction processing. Gasprice’s bidding mode gets sorted for the amount of gas required, and the highest bidders get their transactions processed.

When transferring money or issuing smart contracts, the real-time gas and gasprice on the current network is often opaque, so in order to keep transaction from failing and the idle fee from being deducted, as well as to speed up the transaction processing, transaction originators regularly increase the value of the gasprice and gaslimit (the largest amount of gas the user is willing to pay), forming malicious competition. This becomes untenably expensive when the network is congested, for two main reasons. Firstly, users become unwilling to pay for this bidding method at a high frequency over a long period of time, which reduces the daily activity of dApp. Secondly, for devs, expensive development and maintenance costs will make development advances increasingly heavy, affecting company development and the progress of particular projects.

1.3 CPH Network Usage Rights Solution

1.3.1 Power mechanism

Power is a dynamically released stake point for users who hold CPH that represent each account’s use of network power resources (computing, storage, bandwidth, etc.). Every time you hold a CPH, you will be assigned a certain amount of Power, and each Power represents 1 share of the total network resources.

In other words, there zero commission required to operate the network, but this does not mean that you can use the network without paying any price whatsoever. Users still have to pay a cost for the amount of time spent holding their CPH. The more coins a user holds, the more Power that user has, allowing that user access to network resources, such as the maximum limit per transaction. And the larger the Power value, the greater the recovery rate after Power is consumed.

Here’s a figurative way to understand how Power operates the Cypherium network. In a video game, a power value determines the maximum amount of Health Points (HP) and HP recovery rate of a given player. In fighting against a monster, the player must necessarily expend a certain amount of HP, and the more monsters you fight, the more damage you’ll incur and the HP you will need to use up in order to defeat those enemies. In terms of the Power mechanism, the damage value corresponds to the amount of CPH being transferred, and the maximum HP value is the Power Max of the account. The HP recovery speed of the monster-slayer, then, refers to a Cypherium user’s Power Speed, and the task of killing different types of monsters is the different types of operations, such as executing a transaction or deploying a contract.

Power is different from Gas in ETH in two crucial aspects:

● For each account, the maximum Power fixed in accordance with a fixed account balance.

● Power is restored and the recovery speed is positively correlated with the number of CPH in the given account.

All accounts with a balance greater than or equal to 0.01 CPH will continue to accrue Power as the block height increases.

Power is generated until the upper limit of this account is reached. Power consumption, thus, serves as a power reduction process, whereas in Ethereum, calculating transaction fees through Gas becomes a process of accumulation.

Of course, there are still structural similarities. The operations that consuming Power in Cypherium are comparable to the kinds of operations consuming Gas in ETH:

● Sending a transaction requires an account to consume Power.

● The larger the amount of Data carried during the transaction, the more Power is consumed.

● The higher the computational complexity of the data in the contract, the more Power is consumed

● Sorting in the transaction pool is sorted by Gas Price from high to low

1.3.2 Power Variable Formula

Power has two variables:

● PowerMax

● PowerSpeed

Formula for an account’s Power:

Power = Min(PowerMax, BlockGap * PowerSpeed)

BlockGap = current block height — the height of the last transaction block containing this account

Formula of Power consumed by a transaction and its resulting cost:

PowerSpend= Gas* GasPrice

For example: a general transfer of Gas is 21000 and GasPrice is 18Gwei.

18Gwei = 0.000,000,018 cph

A normal transfer requires power = 21000 * 0.000000018 = 0.000378 cph

Formula of Power Upper Limit PowerMax for an account:

PowerMax = (Math.exp(-1/(x*50)*10000)*10000000+200000)*0.000000018

For example: for an account with a 0.01 CPH balance, PowerMax is 0.0036 CPH. Assuming

GasPrice is set to 18Gwei (ie 0.000000018 CPH), this balance of 0.01 CPH account’s single maximum transaction can be set to Gas = 0.0036 / 0.000000018 = 200000, which means in the case of GasPrice is 18Gwei, this account cannot send transactions with more than 200,000 Gas.

Suppose GasPrice is set to 36Gwei (ie 0.000000036 CPH), this 0.01 CPH balance

The maximum transaction amount for a single account can be set to Gas = 0.0036 / 0.000000036 = 100000, which means in the case of GasPrice is 36Gwei, this account cannot send transactions that cost over 100,000 Gas.

Formula of an account’s Power recovery rate PowerSpeed:

PowerSpeed ​​= (Math.exp(-1/(x*2)*1000)*200000+1000)*0.000000018

For example: an account with a balance of 0 receives 0.01 cph at a block height of 100:

● Power of this account at block height 101 = (101–100) * 0.000018 = 0.000018

● Power of this account at block height 102 = (102–100) * 0.000018 = 0.000036

● Power of this account at block height 201 = (201–100) * 0.000018 = 0.0018

● Power of this account at block height 301 = (301–100) * 0.000018 = 0.0036

● Power of this account at block height 401 = (401–100) * 0.000018 = 0.0036

(will not continue to grow)

After the block height 301, the upper limit has been reached. If you need more Power, you will need to increase the account balance.

1.4 Balance Transfer and Smart Contract Deployment

Balance transfer

If a transaction only has balance transfers, gasprice can be set to zero, but power consumption will be relatively large. In practice, this means there will be speed limits for frequently executed small transfers.

Smart contract deployment

When developers deploy smart contracts, gasprice cannot be set to zero. The Cypherium Virtual Machine (CVM) calculates a minimum gasprice, with gas based on the size of the particular codedata. This is the minimum requirement of a smart contract that can be successfully deployed on the Cypherium blockchain. These two minimum values ​​are only positively related to the size of the codedata. When the network is busy, the larger the codedata’s value, the faster the smart contract can be deployed.

--

--