V1.1.0-ANALYSIS-GAS-COST-DETERMINATION

FieldValue
Name[1.1.0] [Analysis] Gas Cost Determination
Slug219
Statusdeprecated
TypeRFC
CategoryInformational
EditorThomas Lavaur [email protected]
ContributorsFilip Dimitrijevic [email protected]

Timeline

  • 2026-05-28d45eed2 — Chore: mirror blochain specs into github/mdbook (#347)

Owner: @Thomas Lavaur

Reviewers: @Mehmet @Daniel Sanchez Quiros @lvaro Castro-Castilla @David Rusu

Revision History

VersionChangesDate
1.0.0Initial revision.2025-09-25
1.1.0?2025-10-07

Introduction

In Mantle, each Mantle Transaction contains one Ledger Transaction and one or more Operations. These components consume gas, measured through fixed gas units that reflect their execution or storage impact. Logos Blockchain introduces three independent gas markets:

  • Execution Gas: measuring computational workload.
  • Permanent Storage Gas: measuring cost of fully replicated storage.
  • Ephemeral DA Storage Gas: measuring sharded storage in the DA layer.

Gas constants are carefully calibrated to reflect the computational and storage requirements of different operations on the Logos Blockchain. By standardizing gas measurements, the system can accurately charge fees proportional to resource usage, preventing network abuse and incentivizing efficient transaction design.

Overview

We conducted a comprehensive analysis of execution requirements for each Operation type in Mantle Transactions and of Ledger Transaction. This detailed examination allowed us to determine precise gas amounts for each Operation based on the actual computational resources consumed.

The gas constants we established are strategically divided between permanent storage, ephemeral data store on the DA layer and execution components, directly proportional to their respective resource utilization within Mantle Transactions. This separation ensures that gas costs accurately reflect the true computational burden of different operations. Moreover, gas can also be adjusted arbitrarily to incentivize or disincentivize the usage of certain Operations compared to others.

Our methodology involved measuring execution complexity and defining how gas is determined for each Gas Market. This is critical for proper network operation as it directly impacts transaction prioritization and network economics.

Permanent Storage Gas

Permanent Storage is paid directly for the entire signed Mantle Transaction. The Permanent Storage Gas price is included in the Mantle Transaction structure and is used to determine the Permanent Storage fee. 1 Permanent Storage Gas corresponds to 1 byte.

permanent_storage_fee = len(encode(tx_signed)) * permanent_storage_gas_price

Ephemeral Storage Gas

Ephemeral storage is a unique market exclusive to Blobs. For this reason, the DA Storage Gas price is included in the Blob Operation structure and is used to determine the DA Storage fee. 1 DA Storage Gas corresponds to 1 byte.

da_storage_fee = blob_size * DA_storage_gas_price

Execution Gas

Execution is a third general market that represents how costly an operation or a Ledger Transaction is to execute. This cost can be fixed or variable based on the content of the Operation / Transaction. The Execution Gas price is contained in the Mantle Transaction structure and each Operation or Ledger Transaction define its execution gas amount. 1 Execution Gas corresponds to 1,000 CPU cycles.

execution_fee = (tx.ops.get_summed_gas() + tx.ledger_tx.get_gas())
* execution_gas_price

The gas derivation of each Operation and of a Ledger Transaction are:

LEDGER_TRANSACTION_GAS = 590
CHANNEL_INSCRIBE_GAS   = 56
CHANNEL_BLOB_GAS       = 6356 + 1600 * sample_size
CHANNEL_SET_KEYS       = 56
SDP_DECLARE_GAS        = 646
SDP_WITHDRAW_GAS       = 590
SDP_ACTIVE_GAS         = 590
LEADER_CLAIM_GAS       = 580

and come from our implementation observations as described in Gas determination from measures. As a reminder, sample_size = blob_size / (1024x31).To get these numbers, we based our calculations on the following measures:

OperationNumber of CPU cycles
ZkSignature batch verification3,900,000 + number_of_proof x 590,000
Proof of Claim batch verification2,640,000 + number_of_proof x 580,000
Blob sampling batch verification5,000,000 + number_of_sample x (315,000 + 80,000 x sample_size )
Eddsa25519 signature verification56,000

Comparison, list searching, hashes and operation in small fields are neglected. We also supposed that the initialization cost for batch verification is paid by everyone and deduced from the block directly. The user then pay only for the part that is proportional to the number of proofs.

Ledger Transaction

The Execution Gas of the Ledger Transaction compensates for the verification of the ZkSignature proof and the validation of the overall Mantle Transaction balance. This fundamental gas cost ensures proper cryptographic verification and data integrity of both the Ledger Transaction and the Mantle Transaction. It covers the cost of computing the Mantle Transaction hash.

Execution: ~590k CPU cycles.

  • Verification of the ZK signature: 590,000 cycles.
  • Verification of the balance: negligible.
  • Computation of the Mantle Transaction hash: negligible.

Input Gas

Input gas covers the computational cost of verifying that one Note Id exists in the Ledger and is not locked. Additionally, it compensates for the removal of one Note Id from the Ledger.

Execution: negligible.

  • Verification that the note is in the ledger: negligible.
  • Verification that the note is unlocked: negligible.
  • Removing of the note from the ledger: negligible.

Output Gas

Output gas accounts for the computational resources required to verify that one output is well-formed and for its inclusion in the Ledger.

Execution: negligible.

  • Verification of the output validity: negligible.
  • Insertion of the note in the ledger: negligible.

Operations

Channel Inscription

The validation process includes verifying an Eddsa25519 signature, confirming that the signer is authorized for the specified channel, and checking the chaining sequence of the channel. The execution encompasses creating channel records (if not previously used) and updating the tip of the channel.

Execution: ~56k CPU cycles.

  • Verification of the Ed25519 signature: 56,000 cycles.
  • Verification of the signer authorization (signer in the list): negligible.
  • Verification of channel sequencing (equality check): negligible
  • Update the tip of the channel: negligible

Channel Blobs

The validation encompasses several critical security checks: verifying an Eddsa25519 signature, confirming the signer's authorization for the specified channel, and validating the chaining sequence of the channel. The execution process involves creating channel records (if not previously established), updating the channel tip, and executing the sampling operations necessary to verify data availability.

Execution: ~6.356M + sample_size x 1.6M CPU cycles

  • Verification of the Ed25519 Signature: 56,000 cycles.
  • Verification of the signer authorization (signer in the list): negligible.
  • Verification of channel sequencing (equality check): negligible.
  • Update the tip of the channel: negligible.
  • Verification of twenty sample : 20 x (315,000 + 80,000 x sample_size ) cycles.

Channel Set Keys

This gas amount covers the verification of the Eddsa25519 signature and ensures the operation is well-formed. This represents the computational cost associated with processing key management operations.

  • Execution: ~56k CPU cycles.
    • Verification of the Ed25519 signature: 56,000 cycles.
    • Modification of the key list of the channel: negligible.

SDP Declaration

This gas covers multiple verification processes: confirming ownership of the locked note through ZkSignature verification, validating the zk_id via a second ZkSignature, and establishing ownership of the provider_id through an Eddsa25519 signature. It also includes verification of the declaration format, confirmation of note existence, validation that the note is not already locked, and verification of its amount. Additionally, it accounts for the computational costs associated with the note locking mechanism and declaration management.

Execution: ~ 646k CPU cycles.

  • Verification of the Ed25519 signature: 56,000 cycles.
  • Verification of the ZK signature: 590,000 cycles.
  • Verification that the declaration doesnt already exist: negligible.
  • Verification of locator length: negligible.
  • Verification of locked note existence: negligible.
  • Verification of locked note value: negligible.
  • Verification that the note isnt already locked for the service: negligible.
  • Locking the note: negligible.

SDP Withdraw

This gas covers a verification process that includes: confirming ownership of the zk_id through ZkSignature verification, validating the existence of the locked note, verifying that the note has exceeded its lock period, and confirming that the declaration exists and has not been previously withdrawn. The validation process also ensures that the withdrawal message's nonce is greater than any previous nonce, preventing replay attacks. During execution, the system updates the declaration's status to withdrawn, removes the declaration from the locked note's associated declarations, andif the note has no remaining declarationsremoves it from the locked notes dictionary.

Execution: ~ 590k CPU cycles.

  • Verification that the note exists, is locked and bound to the declaration: negligible.
  • Verification that the note can be unlocked: negligible.
  • Verification that the declaration exist: negligible.
  • Verification of the ZK signature: 590,000 cycles.
  • Verification that the declaration wasnt already withdrawn: negligible.
  • Verification of nonce incrementation: negligible.
  • Update declaration: negligible.
  • Remove declaration from locked note: negligible.
  • Unlock the note if not linked to any declaration: negligible.

SDP Activation

This gas funds the verification of the zk_id signature through the ZkSignature verification process, validates the existence of the declaration in the system, and ensures that the activation message's nonce is greater than any previous nonce to prevent replay attacks. The validation includes confirming that the declaration ID is present in the declarations dictionary and that the signature corresponds to the declaration's registered zk_id public key.

  • Execution: ~590k CPU cycles.
    • Verification that the declaration exist: negligible.
    • Verification of nonce incrementation: negligible.
    • Verification of the ZK signature: 590,000 cycles.
    • Evaluation of the activity depends on the service and is neglected here

Leader Claims

This gas covers the verification of reward voucher ownership through a Proof of Claim, confirmation that the voucher nullifier is not already present in the nullifier set, and validation that the rewards root exists in the list of recent voucher Merkle tree roots. The execution process involves adding the voucher nullifier to the nullifier set and increasing the Ledger Transaction balance by the designated leader reward amount.

Execution: ~580k CPU cycles.

  • Verification that the voucher nullifier isnt already in the set: negligible.
  • Verification that the rewards root is one of the root of the reward tree of the last blocks: negligible.
  • Verification of the proof of claim: 580,000 cycles.
  • Insertion of the nullifier in the voucher nullifier set: negligible.

Annex

Gas determination from measures

The material used for the benchmarks is the following:

  • CPU : 13th Gen Intel(R) Core(TM) i9-13980HX (24 cores / 32 threads)
  • RAM : 32GB - Speed: 5600 MT/s
  • Motherboard: Micro-Star International Co., Ltd. MS-17S1
  • OS : Ubuntu 22.04.5 LTS
  • Kernel : 6.8.0-59-generic

Proof of Claim

We found the best linear curve approximating these measures (over 100 iterations):

Number of BatchesNumber of CPU cycles
12,502,356
23,662,746
34,216,022
44,800,445
55,324,304
66,091,442
76,618,446
87,165,629
97,692,432
108,421,783
2014,257,450
3020,131,137
4025,782,519
5031,595,523
6037,286,419
Number of BatchesNumber of CPU cycles
7042,901,298
8048,309,912
9054,191,072
10061,082,050
11066,927,817
12073,758,494
13078,816,789
14084,801,250
15091,693,824
16094,248,613
17099,430,138
180105,607,812
190112,379,089
200116,599,001

We got the curve that we decided to approximate to :

Diagram

ZkSignature

We found the best linear curve approximating these measures (over 1000 iterations):

Number of BatchesNumber of CPU cycles
14,126,177
24,904,084
35,538,085
46,061,800
56,957,754
67,421,851
78,237,485
88,621,986
99,115,091
1010,186,171
2015,777,800
3021,456,771
4027,441,722
5033,430,729
6038,986,389
Number of BatchesNumber of CPU cycles
7044,708,450
8050,894,373
9056,534,430
10063,606,624
11070,036,347
12075,612,096
13082,048,010
14087,080,407
15091,473,391
16097,862,623
170104,019,852
180111,498,103
190114,814,226
200119,739,702

We got the curve that we decided to approximate to :

Diagram

Blob Sampling

We measure different scenarios. For each size of sample, we derived a linear equation of the form with the number of samples to verify.

32 KiB blobs (2 sample elements):

Batch SizeCPU Cycles
108,529,507
2013,818,649
3018,985,695
4025,089,415
5030,648,329
6035,502,866
7038,892,864
8043,399,433
9047,671,839
10052,314,907
Batch SizeCPU Cycles
11058,208,545
12062,786,791
13067,786,161
14072,179,484
15076,278,407
16080,940,080
17086,766,298
18090,567,870
19093,692,283
20098,343,499

The best fitting curve is that we approximated by :

Diagram

64 KiB blobs (3 sample elements)

Batch SizeCPU Cycles
109,239,126
2015,131,351
3020,961,330
4027,594,193
5032,845,900
6037,949,973
7043,022,847
8048,129,313
9053,190,914
10058,218,004
Batch SizeCPU Cycles
11063,390,371
12068,451,282
13075,767,779
14080,669,658
15085,627,442
16090,819,416
17095,532,120
180100,443,619
190105,375,207
200110,394,398

The best fitting curve is that we approximated by :

Diagram

128 KiB blobs (5 sample elements)

Batch SizeCPU Cycles
1010,964,607
2020,686,848
3028,941,578
4038,295,293
5045,960,757
6053,745,474
7061,650,124
8069,167,994
9076,875,286
10084,404,885
Batch SizeCPU Cycles
11092,380,948
12099,812,683
130109,947,874
140117,477,348
150124,924,958
160132,430,262
170141,098,267
180148,117,833
190157,570,978
200166,188,496

The best fitting curve is that we approximated by :

Diagram

256 KiB blobs (10 sample elements)

Batch SizeCPU Cycles
1014,785,938
2026,318,392
3038,260,143
4050,502,225
5061,301,092
6072,028,954
7082,362,773
8093,485,923
90104,042,321
100114,602,636
Batch SizeCPU Cycles
110125,615,987
120136,706,128
130148,619,389
140158,348,399
150168,918,545
160179,787,233
170192,484,193
180203,995,906
190212,814,837
200223,817,125

The best fitting curve is that we approximated by :

Diagram

512 KiB blobs (17 sample elements)

Batch SizeCPU Cycles
1019,822,834
2036,328,022
3052,876,723
4070,217,070
5086,017,119
60101,724,856
70117,470,096
80133,111,662
90149,254,798
100164,761,143
Batch SizeCPU Cycles
110180,287,296
120195,906,310
130213,611,965
140229,460,354
150245,987,045
160261,140,370
170276,891,655
180293,255,638
190309,324,730
200324,752,182

The best fitting curve is that we approximated by :

Diagram

768 KiB blobs (25 sample elements)

Batch SizeCPU Cycles
1024,802,125
2046,362,059
3067,781,105
4090,334,595
50111,300,953
60131,842,378
70152,872,933
80173,311,447
90194,630,157
100215,504,778
Batch SizeCPU Cycles
110235,840,678
120257,025,208
130279,135,548
140299,488,712
150319,182,136
160340,687,653
170361,057,665
180379,539,673
190402,246,965
200419,518,033

The best fitting curve is that we approximated by :

Diagram

1024 KiB blobs (34 sample elements)

Batch SizeCPU Cycles
1034,936,346
2066,539,633
3097,890,996
40130,256,521
50160,952,882
60191,807,748
70222,242,226
80253,226,954
90283,563,420
100315,080,511
Batch SizeCPU Cycles
110344,833,795
120376,006,265
130409,130,375
140439,438,063
150471,270,848
160501,121,144
170532,336,865
180563,566,629
190592,486,314
200622,146,228

The best fitting curve is that we approximated by :

Diagram

From all these curves and for simplification, we assumed that the initialization cost is the same for every sample size and equals 5M CPU cycles. Then, we simply linearized again the linear factor of each curve giving us:

Sample sizeLinear factor
2470,000
3530,000
5800,000
101,100,000
171,600,000
252,100,000
343,100,000

Which gives use the linear equation that we approximated by .

Diagram

This gives us a final sample verification cost (in Execution Gas) of:

The 5000 Execution Gas cost is removed from the Execution Gas limit directly and the rest is applied per Blob Operation individually.