Gas
Every transaction in the Pontem Network requires the sender to pay a fee as well as set a maximum amount of weight which can be used during transaction execution.

Weight

Each transaction in the Pontem network the parameter weight. Weight is the cost of operation on the blockchain. When transactions are executed, it uses the resources of validators such as CPU, memory, storage and compute for read/write operations. Each operation described has a cost in weight.
Each block on Pontem Network should be within an alloted time, usually it's about 12 seconds. The protocol converts these 12 seconds into weight using the following logic (from official Substrate documentation):
The amount of weight a block may contain is limited, and optional weight consumption (i.e. weight that is not required to be deployed as part of the block's initialization or finalization phases nor used in mandatory inherent extrinsics) will generally be limited through economic measures --- or in simple terms, through transaction fees. The fee implications of the weight system are covered in the Transaction Fees document.
Substrate defines one unit of weight as one picosecond of execution time, that is 1012 weight = 1 second, or 1,000 weight = 1 nanosecond, on fixed reference hardware (Intel Core i7-7700K CPU with 64GB of RAM and an NVMe SSD).
The maximum block weight should be equivalent to one-third of the target block time, allocating one third for block construction, one third for network propagation, and one third for import and verification. Doubling the block time would allow a doubling of the maximum block weight. These tuning options give runtime developers a way to make the optimal transaction per second vs. hardware requirement trade-offs for their use case. These trade-offs can be tuned with runtime updates to keep up with hardware and software improvements.
So when a user prepares a transaction to the network, a user sets from the Pontem Network node a required weight for this transaction. Weight can be dynamic or fixed. The Move VM transactions has dynamic weight capabilities based on gas.
Read more about weight in the Substrate documentation.

Gas

Maintaining compatibility with the Diem Blokchain Move VM, the Pontem Network also supports gas parameters by converting the amount of gas provided by the user into weight. Gas is the cost of operation in a Move Virtual Machine used only during execution of VM related transactions (scripts and modules as well as execution/publishing).
The gas amount parameter is an u64 number and configured during the preparation of the transaction. So the max gas limit is u64 max number 18446744073709551615, and the minimum is 1.
During the execution of a transaction, the Move VM estimates gas expenditure using the provided Gas Cost Table. Each operation described in the table costs a certain amount of gas. If the gas amount provided by the user is not enough to execute a smart contract transaction, the VM will revert a transaction and return a Out Of Gas error.
Gas is converted to weight using the following formula:
1
1. Estimate how much gas the VM will spend during 1 second.
2
2. Estimate how much weight is spent for 1 second.
3
3. Divide WEIGHT_PER_SECOND / GAS_PER_SECOND and get the amount WEIGHT_PER_GAS.
4
4. Safe mul provided gas on WEIGHT_PER_GAS.
Copied!
You can see it in our Move VM pallet code:
1
/// Through inheritance from Moonbeam and from Dfinance (based on validators statistic), we believe max 4125000 gas is currently enough for a block.
2
/// In the same time, we use the same 500ms Weight as Max Block Weight, from which 75% is only used for transactions.
3
/// So our max gas is GAS_PER_SECOND * 0.500 * 0.65 => 4125000.
4
pub const GAS_PER_SECOND: u64 = 11_000_000;
5
6
/// Approximate ratio of the amount of Weight per Gas.
7
/// u64 works for approximations because Weight is a very small unit compared to gas.
8
pub const WEIGHT_PER_GAS: u64 = WEIGHT_PER_SECOND / GAS_PER_SECOND;
9
10
pub struct MoveVMGasWeightMapping;
11
12
// Just use provided gas.
13
impl gas::GasWeightMapping for MoveVMGasWeightMapping {
14
fn gas_to_weight(gas: u64) -> Weight {
15
gas.saturating_mul(WEIGHT_PER_GAS)
16
}
17
18
fn weight_to_gas(weight: Weight) -> u64 {
19
u64::try_from(weight.wrapping_div(WEIGHT_PER_GAS)).unwrap_or(u32::MAX as u64)
20
}
21
}
Copied!
✈️ See our instructions on how to send transaction and configure gas using Polkadot JS UI or CLI.
You can estimate gas before sending a transaction using the RPC calls.

Maximum block weight

Average block time in Pontem network is 12 seconds. We reserve half a second for transaction processing, so maximum block weight is:
1
pub const MaximumBlockWeight: Weight = WEIGHT_PER_SECOND / 2; // 10^12 / 2.
Copied!
Maximum gas limit for the Move pallet transactions is 8250000. In the future, once the network is stabilized, we can increase this parameter.

Fees

Pontem network transaction fees can be paid only in PONT tokens. A transaction fee consists of two parts: length_fee (based on transaction size) and weight_fee (based on transaction weight).
Based on the above, the final fee of a dispatchable is:
1
fee =
2
len(tx) * length_fee +
3
WeightToFee(weight)
Copied!
Additional fee to speed up transactions is called a tip, which a user cana set when sending a transaction. See how to configure tips in the Polkadot JS UI.
Read more about fees in the Substrate documentation.
Last modified 1mo ago