Home | Blog | Towards Flexible Marketplace With ARK Dynamic Fees Running On New Core
Kristjan Košič
Blockchain
Reading time: 5 min
Date: 5th Dec 2018

Towards Flexible Marketplace With ARK Dynamic Fees Running On New Core

In this post I will talk about the (i) dynamic fee system, (ii) how to calculate dynamic-fees (spreadsheet and code sample provided) and (iii) what are the variables we introduced in Ark Improvement Proposal 16 , that is already implemented and running on our brand new Mainnet with Core v2 engine.

ARK is all about making development of blockchain solutions easier by empowering developers with the tools and libraries they can use in almost any popular programming language. The immense efficiency of such an ecosystem, supported by the delegate community who runs the network, are also some of my personal reasons for sailing together with the Ark Ecosystem.

With Core v2 a new era begins — enabling developers to build new modular features and customizations with minimum effort.

Dynamic Fee System

**ARK Core V2****is the first implementation of a dynamic fees system** within a DPoS network model. We envisioned that creating a “fee marketplace” between users and delegates will move ARK even closer to creating a dynamic, responsive and resilient network. Both delegates and end-users stand to benefit from dynamic fees: end-users benefit from delegate competition in the form of lower transaction fees, while delegates gain another tool in their arsenal to contend with potential attack vectors such as spam attacks.

Dynamic fees is a protocol-level change. On the one hand, delegates (block producers) set their own minimum acceptable fee for each transaction type. Meanwhile, ARK users define how much they are prepared to pay for a transaction to get included in the block and blockchain. The bigger the set fee from the user, the quicker the inclusion of the transaction in the block.

Node operators have an option to customize fees in the config file according to the network they are running their node for. The configuration consists of the following variables:

  • minFeePool — minimum fee pool entry multiplier.
  • minFeeBroadcast — minimum broadcast multiplier.
  • transaction offsets — are transaction type offsets/addon bytes that are used in dynamic fee formula calculation. Their main purpose is to adjust the fee calculation for a specific transaction type.

Dynamic fee calculation

The calculation formula: Fee = (T+S) * C

  • T:offset value depending on transaction type, defined by the network. T is here to account for extra processing power to process special transaction whose transfer value is null, and thus reducing economic interest to spam the network.
  • C: fee multiplier constant (Arktoshi/byte) defined by the delegates for including the transaction in his forged block/transaction pool. The C constant is replaced with the settings value from your network.json file (mainnet.json), the minFeePool and minFeeBroadcast.
  • S: size of the serialised transaction. For instance, for transfer we have offset T = 100, C = 3000 Arktoshi/byte. For a classic transfer transaction with empty VendorField size is 153 bytes, the fee is:

Fee:= (100 + 153) * 3000 = 759000 ARKTOSHI === 0.00759 ARK

Dynamic Fee calculation simulator

For default values and fee calculations related to transaction type please see the calculated values in the table below.

Calculated dynamic fees as provided by our default settings.If you want the play with fee calculation settings there is a simulation spreadsheet available, so you get the feeling what values are possible with different transaction types and sizes. In the table above, there are multiple options for the same transaction type, for example a transfer transaction (green color) has three calculation options:

  • transfer with no vendor field and no 2nd signature = 153 bytes
  • transfer with 2nd signature and no vendor field = 225 bytes
  • transfer with vendor field and 2nd signature = 289 bytes

The spreadsheet has a column custom_offset where you can override the value and observe the results. The same goes for the multiplier setting. By default we set it to 3000, but you can override it with your custom value.

I don’t trust the spreadsheets — I prefer the code 🙈

For all the geeky souls out there and in general everyone that is more comfortable with programming language, please find a short code sample below, where you can create transaction using our transactionBuilder from the arkecosystem/crypto package and use the dynamic-fee calculator. Calculated values are displayed in the console.

Where to next?

In this short article I explained the essence of dynamic-fees and also provided a **calculation****simulation** package for you to use (spreadsheet and code sample). Here are some future ideas to make this easier for end users to visualize.

  • More user friendly tools that display the network fee settings and a web application for fee calculation would be of great use for end users. For example BitCoin has specific web applications dedicated to displaying history fee values.
  • It is also possible to calculate the minimum and maximum accepted fee currently on the network, by querying all the peers for node/configuration API, where settings are exposed for each node. By reading the settings the only thing that remains is the math.

The above examples (web app for fee calculation and network fee page overview) are just some basic ideas that could also fit into an ACF proposal, so if anyone has interest — here is the link: .

For myself, I will be attempting to be more active in public channels. Meaning that I will try to write monthly posts where we will discuss some of the more technical features of Ark, where we currently are, what challenges we face and how are we overcoming them.

ARK.io

Stay up to date
By submitting this form you agree to receive email updates. Find out how we process your data here.
Download
Visit our download page to learn more about our latest releases
2021 © ARK.io | All rights reserved An ARK.io Product