# Fees in StarkNet Alpha

**URL:** <https://community.starknet.io/t/fees-in-starknet-alpha/286>\
**Category:** Starknet Technical Development\
**Tags:** fees, alpha\
**Created:** [January 3, 2022, 2:10pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286 "2022-01-03T14:10:13Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![lior-stark](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/lior-stark/32/14_2.png) [@lior-stark](https://community.starknet.io/u/lior-stark)\
**Post date:** [January 6, 2022, 8:06am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/21 "2022-01-06T08:06:00Z")

</div>

> [@martriay](#):
>
> the concerns around gas estimation services

Right, as Tom noted above, once we have full nodes operational, this could be done locally (in a node).

* * *

> [@martriay](#):
>
> why an average instead of dynamic for each message?

This is just a first approximation, so it’s just simplicity.  
It will probably be more accurate when we indeed count per message.

* * *

> [@martriay](#):
>
> do you mean the number of state updates or the size of the state diff?

Basically how many times the state has been updated in this transaction.  
do you call this “state updates”?

* * *

> [@martriay](#):
>
> does this mean that the current tx ordering is still FIFO? so MEV is going to be a latency game more than anything. Have you looked into [proposer-builder separation](https://ethresear.ch/t/proposer-block-builder-separation-friendly-fee-market-designs/9725)? do you think that would make any sense in here?

In this case it won’t be FIFO. But note this is forward-looking, and we haven’t yet decided on this.  
I didn’t look into this proposer-builder separation. Thanks for the pointer!

---

<div class="post-metadata">

**Author:** ![maciejka](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/maciejka/32/96_2.png) [@maciejka](https://community.starknet.io/u/maciejka)\
**Post date:** [January 6, 2022, 8:57pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/22 "2022-01-06T20:57:00Z")

</div>

> [@lior-stark](#):
>
> \_msgbytes\_per\_msg

Is whole payload of the l2-\>l1 message stored on l1 not only its hash?

---

<div class="post-metadata">

**Author:** ![bbrandtom](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/bbrandtom/32/9_2.png) [@bbrandtom](https://community.starknet.io/u/bbrandtom)\
**Post date:** [January 6, 2022, 9:07pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/23 "2022-01-06T21:07:34Z")

</div>

> [@maciejka](#):
>
> Is whole payload of the l2-\>l1 message stored on l1 not only its hash?

Only the hash is stored.  
bytes\_per\_msg is multiplied by gas\_per\_byte as it is sent as call data.

---

<div class="post-metadata">

**Author:** ![martriay](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/martriay/32/25_2.png) [@martriay](https://community.starknet.io/u/martriay)\
**Post date:** [January 7, 2022, 3:25am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/24 "2022-01-07T03:25:35Z")

</div>

> [@lior-stark](#):
>
> do you call this “state updates”?

yes

> [@lior-stark](#):
>
> I didn’t look into this proposer-builder separation. Thanks for the pointer!

👍 I also think it is very important to take the MEV component into account.

---

<div class="post-metadata">

**Author:** ![jmonteer](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/jmonteer/32/179_2.png) [@jmonteer](https://community.starknet.io/u/jmonteer)\
**Post date:** [January 8, 2022, 10:32am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/25 "2022-01-08T10:32:33Z")

</div>

thanks for the post.

> [@lior-stark](#):
>
> gas\_per\_step is a constant pricing for a single step validation (on L1).  
> stepstxnsteps\_{txn}stepstxn​ is the number of steps for this function’s execution.

what is a step in this context?

* * *

what do you expected L2 costs to compare vs L1 costs? Is this what you are talking about here?

> [@lior-stark](#):
>
> The main factor driving the cost is the L1 data component. This includes the state diff and the messages. In other words, the computation cost will be negligible compared to the cost of data posted on L1 (gas\_per\_step\<\<gas\_per\_bytegas\_per\_step \<\< gas\_per\_bytegas\_per\_step\<\<gas\_per\_byte).

* * *

the post explains how fees are calculated, how does the mechanism of fee collection work? is “sign transaction with fee” just an ETH transfer from client to sequencer’s address? where (L2 or L1) does it happen?

---

<div class="post-metadata">

**Author:** ![lior-stark](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/lior-stark/32/14_2.png) [@lior-stark](https://community.starknet.io/u/lior-stark)\
**Post date:** [January 9, 2022, 9:10am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/26 "2022-01-09T09:10:10Z")

</div>

> [@jmonteer](#):
>
> what is a step in this context?

A Cairo trace step

* * *

> [@jmonteer](#):
>
> what do you expected L2 costs to compare vs L1 costs? Is this what you are talking about here?

Basically, what we’re currently seeing as driving the price is the L1 cost; mainly the cost of data transfer and storage.  
The price of L2 is low compared.  
This statement, and the setting of the relevant parameters will probably reflect that at a first phase.

* * *

> [@jmonteer](#):
>
> how does the mechanism of fee collection work?

This is still being finalized. It will probably be an L2 transfer.

---

<div class="post-metadata">

**Author:** ![fracek](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fracek/32/23_2.png) [@fracek](https://community.starknet.io/u/fracek)\
**Post date:** [January 11, 2022, 2:40pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/27 "2022-01-11T14:40:37Z")

</div>

One small question. Will the starknet simulator (the library we use to run tests) report the state diff items and the number of steps? That way we can start estimating how effective some optimizations are.

---

<div class="post-metadata">

**Author:** ![martriay](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/martriay/32/25_2.png) [@martriay](https://community.starknet.io/u/martriay)\
**Post date:** [January 11, 2022, 10:29pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/28 "2022-01-11T22:29:14Z")

</div>

heh, I just asked the same this morning. +1 to the question.

---

<div class="post-metadata">

**Author:** ![milan](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/milan/32/23836_2.png) [@milan](https://community.starknet.io/u/milan)\
**Post date:** [January 14, 2022, 3:09pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/29 "2022-01-14T15:09:01Z")

</div>

Will events emitted by a function count as messages?

---

<div class="post-metadata">

**Author:** ![lior-stark](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/lior-stark/32/14_2.png) [@lior-stark](https://community.starknet.io/u/lior-stark)\
**Post date:** [January 16, 2022, 11:31am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/30 "2022-01-16T11:31:57Z")

</div>

Events don’t count as messages to L1.

---

<div class="post-metadata">

**Author:** ![fracek](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fracek/32/23_2.png) [@fracek](https://community.starknet.io/u/fracek)\
**Post date:** [February 10, 2022, 2:09pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/33 "2022-02-10T14:09:50Z")

</div>

How will contract deployment fees be calculated? In other words, will the contract size be taken into account when deploying the contract?

---

<div class="post-metadata">

**Author:** ![lior-stark](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/lior-stark/32/14_2.png) [@lior-stark](https://community.starknet.io/u/lior-stark)\
**Post date:** [February 14, 2022, 8:33am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/34 "2022-02-14T08:33:57Z")

</div>

At the moment we’re not taking fees for contract deployment since it’s a separate transaction, with no source account contract.

We _are_ looking into how to address this, e.g. by making deployment a system call (and therefore a regular transaction), so a fee can be collected.

---

<div class="post-metadata">

**Author:** ![DukeDuke](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/dukeduke/32/336_2.png) [@DukeDuke](https://community.starknet.io/u/DukeDuke)\
**Post date:** [March 1, 2022, 3:20pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/35 "2022-03-01T15:20:53Z")

</div>

will it be possible to pay gas fee for a trans in another token on your wallet?

---

<div class="post-metadata">

**Author:** ![lior-stark](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/lior-stark/32/14_2.png) [@lior-stark](https://community.starknet.io/u/lior-stark)\
**Post date:** [March 1, 2022, 4:52pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/36 "2022-03-01T16:52:13Z")

</div>

not right now.  
but we’re thinking of having fee abstraction (as part of account abstraction), and this will then be possible.

---

<div class="post-metadata">

**Author:** ![NikkiMyCat](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/nikkimycat/32/175_2.png) [@NikkiMyCat](https://community.starknet.io/u/NikkiMyCat)\
**Post date:** [June 3, 2022, 9:32pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/40 "2022-06-03T21:32:02Z")

</div>

i wonder the fee looks like now, like the average fee per transaction

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/system/32/5572_2.png) [@system](https://community.starknet.io/u/system)\
**Post date:** [October 31, 2022, 9:25pm UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/42 "2022-10-31T21:25:03Z")

</div>

Closed on October 31, 2022, 9:25pm UTC

This topic is temporarily closed for at least 4 hours due to a large number of community flags.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/system/32/5572_2.png) [@system](https://community.starknet.io/u/system)\
**Post date:** [November 1, 2022, 9:26am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/43 "2022-11-01T09:26:15Z")

</div>

Opened on November 1, 2022, 9:26am UTC

This topic was automatically opened after 12 hours.

---

<div class="post-metadata">

**Author:** ![park](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/park/32/8208_2.png) [@park](https://community.starknet.io/u/park)\
**Post date:** [February 14, 2023, 2:56am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/44 "2023-02-14T02:56:25Z")

</div>

How are emitted events charged for gas on StarkNet? And is there a limit on the number of fields included in one event (say like a felt\* array)?

---

<div class="post-metadata">

**Author:** ![gal](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/gal/32/17945_2.png) [@gal](https://community.starknet.io/u/gal)\
**Post date:** [March 16, 2023, 9:45am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/46 "2023-03-16T09:45:50Z")

</div>

Thank you for sharing the details on estimating and collecting transaction fees on the StarkNet Alpha network. It’s interesting to see the factors that contribute to the transaction cost and how the current mechanism works to estimate fees based on gas price and resource consumption. It’s good to know that there are plans to optimize and refine the fee calculation method in the future, especially as the network becomes decentralized. I look forward to seeing how fee auctions and fee abstraction will be implemented on the StarkNet network.

---

<div class="post-metadata">

**Author:** ![sicalpath](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/sicalpath/32/14284_2.png) [@sicalpath](https://community.starknet.io/u/sicalpath)\
**Post date:** [April 26, 2023, 2:15am UTC](https://community.starknet.io/t/fees-in-starknet-alpha/286/49 "2023-04-26T02:15:57Z")

</div>

That makes sense. Given that full nodes are currently not widely available for anyone to utilize, a bridging solution is needed as a temporary measure. It is good that this limitation is explicitly acknowledged in the post to set the right expectations.  
The upcoming release of the pathfinder Rust full node by the end of this month is promising. Once API services start integrating with pathfinder, it should enable improved gas estimation by executing transactions locally or through those API services using the full node.  
With pathfinder and other full nodes becoming more widely deployed and integrated, we can then transition to a more robust solution for transaction execution and gas estimation that taps into those full nodes. The current bridging solution can then be phased out.  
Overall, it seems like good progress is being made toward a more decentralized network with greater node diversity and participation. The release of pathfinder and its adoption should be an important step forward in that direction. Please continue the good work!

[Previous page](https://community.starknet.io/t/fees-in-starknet-alpha/286.md?page=1)

[Next page](https://community.starknet.io/t/fees-in-starknet-alpha/286.md?page=3)
