Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patricklodder/971e1c46d25083086564d2613ff54f60 to your computer and use it in GitHub Desktop.
Save patricklodder/971e1c46d25083086564d2613ff54f60 to your computer and use it in GitHub Desktop.
2021 Dogecoin Fee Policy Proposal

DOGECOIN FEE POLICY CHANGE PROPOSAL

This document proposes a new fee structure and policy for Dogecoin Core, to be gradually deployed to the network over multiple software releases.

Historical fee policy

Meaningful fees were introduced for Dogecoin in 2014 to reduce on-chain spam. With a 1 DOGE fee per kilobyte, rounded up, the Dogecoin chain provided relatively cheap transactions, yet creating enough of a barrier to prevent large amounts of spam. The fee policy was a developer recommendation and was not enforced on the network in any way, other than it being a default in the Dogecoin Core software.

Additionally, to disincentivize spam further, the minimum output size was recommended to be 1 DOGE, where any outputs smaller than that to were to be penalized with an additional 1 DOGE fee.

Current fee policy

Late 2018, the choice was made to enforce the fee policy on the relay code of Dogecoin Core nodes, which is triggered when nodes make a decision to broadcast a transaction. With the enforcement of fees on relay fully activating with the v4 softfork (as that removed all miners that were not running updated software) in November 2020, it turned out that a significant amount of transactions were not compliant with the original default policy:

  • Approximately 8% of all transactions were taking advantage of the "free tier" inherited from Bitcoin Core. Meaning no fees were paid at all.
  • Another ~11% of all transactions were not implementing fees correctly due to missing wallet implementations. Many wallets simply implemented Bitcoin-like fee calculation.

Because of the sudden disruption in transaction relay starting from November 2020, the policy rollout was not a success and better policy transition must be implemented in the future.

Impact of exchange rate peaks

In the first 6 months of 2021, multiple new all time high exchange rates against both USD and BTC have caused the recommended fee of 1 DOGE to become steep for the perceived value of transacting Dogecoin on-chain, and is, together with the dust limit (also 1 DOGE), disincentivizing on-chain transactions unnecessarily. This situation causes people to keep their DOGE in custody of centralized platforms longer, because the perceived value loss of transferring DOGE to a secure wallet is (too) high.

Below table displays the cost in USD of creating a full day of full blocks at current, 1y low and 1y high exchange rates, using minimum fees, for BTC, LTC and DOGE.

coin 6/26 1y low 1y high
BTC 44640 12960 92160
LTC 70272 23040 237312
DOGE 345599 2880 1051200

Since inception, the goal of Dogecoin has been to be accessible to everyone, but with current exchange rates, transacting DOGE is kept artificially higher than instated on Bitcoin's and Litecoin's chains, disregarding their fee economies. Where transacting DOGE used to be 10x cheaper than transacting LTC, it is as of writing nearly 5x more expensive.

Therefore, it makes sense to reduce fees by at least 50x to stay competitive.

Proposed changes

The proposed changes below bring the decision power towards which transactions to include back to miners instead of the relay network and increase configurability of all fee related parameters, enhancing the sovereignty of each individual node operator and the community as a whole.

  1. Lower the minimal relay fee to 0.001 DOGE
  2. Lower the dust limit to 0.01 DOGE
  3. Set the default block inclusion fee rate to 0.01 DOGE
  4. Bring back a functional free transaction space
  5. Lower the default fee rate to 0.01 DOGE
Parameter Current value Proposed value
MIN_RELAY_FEE 100,000,000 100,000
DEFAULT_FALLBACK_FEE 100,000,000 1,000,000
DEFAULT_TRANSACTION_FEE 0 1,000,000
DUST_RELAY_TX_FEE 100,000,000 100,000
DEFAULT_BLOCK_MIN_TX_FEE 1,000 1,000,000
DEFAULT_DUST_LIMIT (100,000,000) 1,000,000

1. Significantly lower minimum relay fee rate

The minimum relay fee is prohibiting lower fee transactions to be propagated to miners. Even if miners would lower their own relay fees, the chances of a random set of nodes relaying transactions to the miner's nodes is minimal at the time of writing: within a subset of 862 nodes, 853 were filtering fees at 1 DOGE. The chance to connect to a node that is also connected to a miner at this time is (9/862)^2 * 8 ~= 0.0008 or 8 in 10,000.

Lowering the default relay fee below the default (fallback) fee enables future fee reductions. Optimal forward flexibility can be assured by always setting minimal relay to be lower than the recommended fee whenever the default fee recommendation changes.

Individual node operators can set a custom relay fee by setting the -minrelaytxfee parameter.

2. Lower the dust limit

The dust limit is currently as prohibitive for Dogecoin to be used for microtransactions as the relay fee is, because dust outputs are disincentivized.

Currently the dust limit does not have it's own parameter but is statically calculated in CTxOut::GetDustThreshold() to always return COIN (= 1 DOGE). As we want to be able to tune the dust limit, visibly, we add a new global nDustLimit, a constant DEFAULT_DUST_LIMIT and create a -dustlimit runtime parameter to allow node operators to change this, independently from software releases.

3. Define the default block inclusion fee rate

With Dogecoin 1.14, the block inclusion fee rate has not been changed vs the forked Bitcoin 0.14 equivalent of 0.00001 DOGE. Although this means that miners are configured to be incredibly relaxed to accept lower fees by default, currently no transactions with fees under 1 DOGE are not reaching the miners, preventing this limit to ever be applied by mining code. This limit is too low to prevent spam, and thus is better increased.

To keep spam prevention effective within the defaults, we increase the default minimum block inclusion fee to be 0.01 DOGE, matching the target recommended fee rate.

Individual miners can set a custom inclusion fee for their blocks with the -blockmintxfee parameter.

4. Bring back a functional free transaction space

A reservation of 27kb per block is inherited from Bitcoin 0.14 that allows transactions with insufficient (or no) fee to be included in each block, but this facility is currently largely unused because eligible transactions currently do not get relayed to miners. The relay logic has to be changed to once more accept free space transaction relay.

We would allow the following transactions to be included in the free transaction space exclusively:

  • Transactions that are smaller than or equal to the free transaction space
  • Inputs that spend p2pkh, p2sh and legacy p2pk scripts
  • Outputs with p2pkh and p2sh scripts.
  • No dust outputs.

This can be amended as new output scripts are becoming standardized.

Inclusion would be decided based on impact to the utxo database by subtracting the number of outputs from inputs, without assessing fee, i.e. the mempool would be sorted as follows:

prio tx struct (p2pkh) delta tx bytes
1 175 inputs 2 outputs 173 25978
2 60 inputs 1 output 59 8924
3 5 inputs 2 outputs 3 818
4 3 inputs 1 output 2 488
5 2 inputs 1 outputs 1 340
6 1 input 2 outputs -1 226

In the next block, transaction 1 and 3 will be included, and a subsequent block will include transactions 2, 4, 5 and 6.

Miners can modify the free transaction space for their blocks by setting the -blockprioritysize parameter on their nodes.

5. Lower the recommended minimum fee rate

The fee used for transactions can only be lowered if we can make sure that the network relays those transactions with fees under 1 DOGE per kb.

In a second software release, once the network has at least 30% of nodes allowing relay of transactions with a fee rate of 0.01 DOGE or less, a new default fee recommendation of 0.01 can be deployed.

Alternative approach

Removing the byte rounding function in fee calculation

Transaction byte rounding was introduced as a means to keep the fees optically simple, but creates a disincentive to optimize transaction size because there is no difference in fee between a p2pkh transaction with 2 inputs and 2 outputs, or 2 inputs and 10 outputs. Although this could allow for "free" consolidation of inputs, it also makes spamming painless, as including additional outputs within the same 1 kilobyte range costs nothing extra.

Standard p2pkh transactions currently pay fees as follows:

inputs outputs kb fee fee per kb % of tx
1 1 192 1 DOGE 5.21 DOGE 4%
1 2 226 1 DOGE 4.42 DOGE 36%
2 1 340 1 DOGE 2.94 DOGE 11%
2 2 374 1 DOGE 2.67 DOGE 5%
1 24 974 1 DOGE 1.03 DOGE -

This means that for the 56% most common transactions, a 2.5-5x fee reduction can be realized by removing the rounding function, rewarding small transactions and removing benefits inadvertently given to spam transactions.

Alternative fee recommendation

We'd only have to reduce the recommended fees 40x instead of 100x to have a positive effect on pricing for the most common transactions while making spam more expensive simultaneously.

Parameter Current value Alternative value
MIN_RELAY_FEE 100,000,000 100,000
DEFAULT_FALLBACK_FEE 100,000,000 2,500,000
DEFAULT_TRANSACTION_FEE 0 2,500,000
DUST_RELAY_TX_FEE 100,000,000 100,000
DEFAULT_BLOCK_MIN_TX_FEE 1,000 2,500,000
DEFAULT_DUST_LIMIT (100,000,000) 2,500,000

Comparison of alternatives

The following table displays the fee for the 4 most common transactions and a spam transaction.

inputs outputs size cur fee cur fee/kb new fee new fee/kb alt fee alt fee/kb
1 1 192 1 5.21 0.01 0.0521 0.0048 0.025
1 2 226 1 4.42 0.01 0.0442 0.0057 0.025
2 1 340 1 2.67 0.01 0.0267 0.0085 0.025
2 2 374 1 2.67 0.01 0.0267 0.0094 0.025
1 24 974 1 1.03 0.01 0.0103 0.0244 0.025

As shown above, the alternative fee calculation without rounding the transaction size up to the nearest multiple of 1kb, will make simple, standard transactions cheaper than with the rounding in place yet make spam transactions linearly more expensive than with a rounded-up fee.

Implementation proposal

Release 1.14.4 would ideally implement:

  • Lower relay fee, incl. optionally removal of rounding function
  • Dust limit
  • Block inclusion rate, incl. optionally removal of rounding function
  • Free transaction space

Release 1.14.5 would then implement:

  • Recommended minimum fee
  • Optionally, removal of rounding

Release 1.21.0 then implements everything from 1.14.4 and 1.14.5 at once.

@srreeyes
Copy link

🚀

@EliKurc
Copy link

EliKurc commented Jun 28, 2021

it can change

@l4p4
Copy link

l4p4 commented Jun 28, 2021

Just post deadline for each! 👌🏻🐶

@josedavidnup
Copy link

🚀

@etherx-dev
Copy link

Any developer who has introduced breaking changes on the past will be called out for in my upcoming platform. This is a work in progress to help prevent less catastrophic events being triggered resulting in a loss of funds to users.

You know who you are, if you are reading this. How many wallets broke? How many coins became unspendable because of the lack of support from developers whom imposed these changes on the sly? Why do people need to have a level of programming or understanding of the Satoshi version of bitcoin as fun as it is to learn, it shouldn’t be necessary to be able to have full control of your own funds!

Want to pay 0 fee? Duck it go ahead Maybe warn users but ignoring the transactions and also crashing miners wallets? I mined and handed out millions of doge and I’m left with 0 thanks to your team.

@patricklodder
Copy link
Author

@etherx-dev Not sure what you're on about? But by all means make your case - be it on your platform or someone else's.

I mined and handed out millions of doge and I’m left with 0 thanks to your team

Did you mine on the wrong side of a hardfork? What happened?

@shahroozam
Copy link

D6ftB9SDo9w1i4mT6Hb8Km3xaNj4vsjjCN

@etherx-dev
Copy link

@etherx-dev Not sure what you're on about? But by all means make your case - be it on your platform or someone else's.

I mined and handed out millions of doge and I’m left with 0 thanks to your team

Did you mine on the wrong side of a hardfork? What happened?

i had 100's of orphantx's and wallet was crashing, the wallet file is around 350mb and whenever i try to generate a new address the last 2 keys int the keypool won't return the private key but the public key exists with funds sitting there...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment