To use resources on ParallelChain Mainnet, transactions impost some cost for storage and execution. ParallelChain Mainnet implements gas units in terms of XPLL (i.e., 1 Gray equals 1 gas). This means the actual cost of gas used during transactions is dynamically balanced when the price of the token increases or decreases due to economic factors. Please see the section Base Fee Formula in ParallelChain Mainnet Protocol for details.
Gas is a representation of the cost incurred by resources per transaction in the ParallelChain Mainnet ecosystem. Every transaction is assigned a cost through gas metering.
There are different categories of gas cost in the ParallelChain Mainnet ecosystem:
- WASM opcode execution inside a contract call
- Reading and writing WASM memory from host functions inside a contract call
- Transaction-related data storage
- World state storage and access
- Cryptographic operations
Details about gas can be found in ParallelChain Mainnet Protocol.
How are Gas Fees Calculated?
Gas Fee here refers to the amount that is paid with the account's balance for the gas consumed in transaction execution. It can be generalized by the following equation:
Gas Fee = Gas Consumption x (Base Fee Per Gas + Priority Fee Per Gas)
Gas Consumptionis the gas unit consumed during the transaction execution.
Base Fee Per Gasis the dynamically adjusted value that depends on the traffic of the network at the time of transaction execution.
Priority Fee Per Gasis the amount specified in the transaction by the signer, which is transferred to block producer, on per-gas basis.
Transaction can fail for setting the Gas limit too low. There is no absolute answer to what gas limit should be specified. In general, the gas limit must be greater than Transaction Inclusion Cost and smaller than Block Gas Limit (500000000).
The following table summaries on estimated gas consumption of different transaction commands:
|Deploy Contract||size of contract bytecode * 2600|
|Call Contract||Varies a lot depends on contract implementation|
|Set Deposit Setting||159,560|
|Withdraw Deposit||4,000,000 (varies a lot depends on the state of the pools)|
|Stake||4,000,000 (varies a lot depends on the state of the pools)|
|Unstake||4,000,000 (varies a lot depends on the state of the pools)|
The above values are calulated by including the transaction inclusion cost (Assume one transaction with one command). It is estimated based on experiments in ParallelChain Mainnet version as of the date on 11-May-2023.