Everythin' Has Its Price...

Nothin’ fer Nothin’

They say the best things in life are free, but then again, is anything in this life really ‘free?’ Well partner, truth be told, no matter what gets done or who does it, somebody somewhere is payin’ fer it. Fact is, folks don’t work or do much of anything without somethin’ in return. Oh sure, there’s charity and helpin’ those less fortunate, but even then, there’s some kind of payoff, ain’t there?

Besides a couple of fringe cases and donations, just about everyone else expects somethin’ in return fer their time and effort. In the world of the digital Wild West (or blockchain fer you city slickers), network participants expect some kind of remuneration fer helpin’ secure the network and forgin’ new blocks. Now exactly how these delegators and validators receive their rewards, and exactly how much they get fer pitchin’ in, is determined by the way fees work - how much should a transaction cost? Do different kinds of transactions require different fee structures? What if someone wants to pay more to get their transaction processed more rapidly?

When it comes to buildin’ a blockchain and runnin’ it, you’ll need to answer these questions and ensure that you possess some knowledge of the options available to you. How you want to structure your fees will depend on a range of factors, but ultimately it’s up to you to decide just how to go about settin’ them and rewardin’ network participants fer their contributions.

What Is Gas?

Gas refers to the fee (or pricing value) required to successfully carry out a transaction or execute a contract on a blockchain. Priced in small fractions of a given cryptocurrency (more commonly referred to as satoshi), the gas is used to pay for the execution of the transaction and acts as a reward for validators. The purpose of this is to create an economic incentive for validators to continue their work and maintain the best possible levels of performance and security for the network. Fortunately Bearmint provides you with several options when it comes to fees and allows you to implement your own strategies for how this cost is calculated.

Fixed Cost

If you’re running a network with low activity or simply want to provide stable costs to your end users, you might consider charging people a fixed gas rate for transactions. This is a good approach for the aforementioned reasons, but validators may not find this method particularly attractive. Furthermore, using fixed costs is fairly uncommon these days.

Size-based Cost

Using this approach, the exact price of gas is determined by factors related to supply and demand. In other words, the network's validators can deny a transaction if the gas price does not meet their required minimum threshold. However, network users seek processing power, so if many of them wish to process their transactions (as in the network becomes busy or even congested), then gas prices tend to increase. The antithesis also applies in that, if a network is relatively quiet or only has a few users looking to process transactions, gas prices may decrease to encourage users to use the network.

Alternatives

You’re also free to implement your own system when it comes to calculating gas fees. You may wish to introduce a completely novel approach to gas fees, or you may wish to use a hybrid of both fixed and size-based fees. At the end of the day, if network participants feel happy to pay gas fees and validators believe they receive fair compensation for their efforts, then your fee structure may indeed live up to industry standards.

In what you may consider a more ‘extreme’ approach, you may even wish to use a gasless approach when it comes to creating and sending transactions as seen in projects like Nano for example. Bear in mind though that this particular approach is not necessarily superior or easy to achieve, but it does mean that network participants may essentially transfer funds free of charge.

Consensus Implications

In light of the above, it is important to note that gas values do have a significant impact on consensus. Milestones become hashed and form part of every block, meaning that, unless everyone’s milestone configurations are identical, consensus will not be possible. Milestones determine gas value configurations, so it is of the utmost importance that validators unanimously agree on values and run the exact same milestone configurations to ensure that reaching consensus is unaffected.

Which One Is Best?

It’d be might challengin’ to tell ya which one of these approaches to gas is best partner, but if you know anything from our previous posts, it’s that it all rides on your unique use case. In short, there is no single ‘best’ approach - that said, the most widely used approach is to calculate gas based on the size of a transaction as it guarantees that every participant is charged according to the processing power required for their transaction - which is only fair, right?

A transaction that only takes 1ms to process shouldn’t cost the same as one that take 100ms or even 1000ms since it takes significantly less resources and time to complete. Of course, if your network doesn’t have much activity, a fixed-cost model may make more sense for your use case.

Regardless of what you choose, ol’ Buckley will make sure your gas fee structure works just as you intend it to and tell folks to skedaddle if they can’t pay the minimum fees! We here at Bearmint take our work real serious, and we’re happy to provide you with the solutions and resources you need to make your blockchain run like clockwork!