[Discussion] Dynamic burn tax: let the rate follow on-chain volume (code ready for review)

Not an on-chain proposal yet. I’d like feedback on the idea and the code first, and I’ll keep this topic updated as things change.

The burn tax is a flat 1.5% no matter what the chain is doing. My idea is to let it follow activity. When there’s a lot of taxable volume the rate creeps up, when things are quiet it drifts back down, and governance sets the floor and the ceiling.

I went ahead and wrote it against core so there’s something concrete to look at:

It’s a draft PR. Nothing changes after the upgrade itself because the feature ships turned off, and the tax stays at 1.5% until a separate gov vote enables it and sets the numbers.

How it works

Each block, the chain adds up the volume that actually paid burn tax. USTC and the other denoms get converted to LUNC through the oracle. That goes into a moving average over roughly an hour, so a single whale transfer or a few empty blocks don’t do much.

Every 100 blocks (about 10 minutes) the rate gets adjusted. If the average is above the target it goes up, if it’s below it goes down, and the further from target the bigger the step, up to a cap. In formula form:

change   = clamp(speed × (avg_volume − target) / target, −max_change, +max_change)
new_rate = clamp(rate × (1 + change), rate_min, rate_max)

Between updates the rate doesn’t move, so whatever a wallet estimates is what the user gets charged.

Starting numbers

All of these are x/tax params, so they can be changed with a normal param change proposal. They’re my first guess and I expect people to push back on them.

Param Value
burn_tax_rate_min / burn_tax_rate_max 0.5% / 3%
target_block_volume 700k LUNC per block
volume_ema_smoothing 0.001667 (≈ 600 blocks, about an hour)
rate_adjustment_speed 0.05
max_rate_change_per_update 5% of the current rate
rate_update_interval 100 blocks

The 700k target is a quick estimate. This epoch has collected about 982M LUNC in tax so far, which at 1.5% is about 65B LUNC of taxable volume across ~93k blocks. Someone should check it against a few months of data before this goes anywhere near an enable vote.

With these settings, going from 1.5% to 3% would take at least 2.5 hours of volume sitting at twice the target or more, and realistically longer because the average lags. Dropping to 0.5% takes 3.5+ hours of almost no volume. So it’s slow on purpose.

Wallets, exchanges, contracts

This is where I spent most of the time, because I didn’t want anyone’s transfers going wrong.

The burn_tax_rate query and compute_tax both return the current rate, so anything that reads the rate from the chain keeps working. Contracts aren’t touched. Sending funds into a contract still isn’t taxed, and when a contract sends funds out the tax still comes off the amount like it does now. I also added a dynamic_burn_tax query that shows the current rate, the previous one and the volume average.

There’s one catch I found while testing. Say a wallet calculates the tax, the user signs, and the rate goes up before the tx lands. Right now, if the fee is short of the tax, the chain switches to reverse charge. It keeps the whole fee as gas and then also takes the full tax out of the amount being sent, so the user pays the tax twice. With a fixed rate that never happens, but with a moving rate it would.

So there’s a grace window. If the fee covers the tax at the previous interval’s rate, the tx just goes through at that rate. Combined with the 10 minute interval, you’d only hit the double charge if a tx sat unconfirmed for more than one full interval. There’s a test that runs exactly this case through the ante handler, the bank handler and the post handler.

The ones who would need to change something are integrations that have 1.5% hardcoded instead of asking the chain. If the rate goes above 1.5% and stays there, their users would run into the double charge. Exchanges and wallets should hear about this well before any enable vote.

Testing

Unit tests cover the rate math, param validation, the migration and genesis export/import, plus the end-to-end ante test above. The existing app, custom, x and wasmbinding suites all pass. I haven’t run it on a localnet or rebel-2 yet. If someone with testnet nodes wants to help, I’d really like to see how the rate behaves with real traffic.

About the upgrade name: I used v14_7 because v14_6 is already taken by the open wasmvm PR. The core team can rename it or fold it into whatever release makes sense.

What I’m not sure about

  • The direction. I went with busy chain = higher tax = more burn. You could argue the opposite, cheaper when busy to pull in more volume. I think we should settle this first.
  • Whether 0.5% to 3% is a sensible range, and how to pick the target properly.
  • Whether 10 minutes and 5% per step is too slow or too fast.
  • If anyone knows which exchanges hardcode 1.5%, that would help a lot.

Something unrelated I noticed while reading the code: the TaxRate query that contracts use (in wasmbinding/query_plugin.go) returns the old treasury rate, which is 0 on mainnet, not the burn tax. I didn’t touch it because fixing it changes how existing contracts behave, but it probably needs its own topic.

Comments welcome here or directly on the PR.