Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Calculate Minimum Transaction Fee for each Block #276

Open
ACK-J opened this issue Aug 8, 2022 · 12 comments
Open

[Feature Request] Calculate Minimum Transaction Fee for each Block #276

ACK-J opened this issue Aug 8, 2022 · 12 comments

Comments

@ACK-J
Copy link

ACK-J commented Aug 8, 2022

This is a selfish request as I am creating a chart at the moment which needs this information and there is no historical source which I can pull the data from. I will recalculate the values myself but it would be really cool if the XMR block explorer advertised the base transaction fee for the block, even if it was an estimate.

https://www.getmonero.org/2017/12/11/A-note-on-fees.html

https://github.com/monero-project/monero/blob/master/tests/unit_tests/fee.cpp

@moneroexamples
Copy link
Owner

Is it something that you could calculate on your side from existing info? Or there is some piece of information missing that should be exposed by the explorer?

@ACK-J
Copy link
Author

ACK-J commented Aug 14, 2022

There is very little documentation or understanding surrounding how the "base fee" is calculated, it seems there are a lot of moving parts. I've been trying to figure it out for myself to write a blog post to help others. If the block explorer automatically did this, I think it would also help people understand more about the fee paid in a transaction, relational to the base they had to pay.

https://github.com/monero-project/monero/blob/b6a029f222abada36c7bc6c65899a4ac969d7dee/src/wallet/wallet2.cpp#L7349-L7362

I think there is certain information needed that needs to be calculated for each block, but I am not certain. Also I have a 0.2 xmr bounty outstanding for anyone who makes it possible to get the base transaction fee of an arbitrary block on-chain, its not a lot of xmr but its something.

@moneroexamples
Copy link
Owner

moneroexamples commented Aug 14, 2022

Monero daemon has RPC get_dynamic_base_fee_estimate which is use by monero wallet:

https://github.com/monero-project/monero/blob/master/src/wallet/wallet2.cpp#L7338

If that would help, I could expose that?

@ACK-J
Copy link
Author

ACK-J commented Aug 14, 2022

Yea that would work! But would this work for past blocks or just for the newest one?

@moneroexamples
Copy link
Owner

I think its for the current ones only.

@ACK-J
Copy link
Author

ACK-J commented Aug 15, 2022

Would you know how to make it work for any arbitrary block? My problem is that I need to know the average "base transaction fee" over a 100,000 block period starting at block #2566273.

@moneroexamples
Copy link
Owner

moneroexamples commented Aug 15, 2022

At the moment I'm not sure. Would have too look into it in more depth. Maybe you could ask on reddit if there is some easy way?

@moneroexamples
Copy link
Owner

Have you check the json api for the explorer: https://github.com/moneroexamples/onion-monero-blockchain-explorer#apinetworkinfo
It returns fee_per_kb which is estimate of a fee per kb (10 blocks).

@ACK-J
Copy link
Author

ACK-J commented Aug 24, 2022

Yea it looks like it makes an RPC call to get it, I don't think it would allow me to return the fee_per_kb of an arbitrary block :/

if (!rpc.get_dynamic_per_kb_fee_estimate(
FEE_ESTIMATE_GRACE_BLOCKS,
fee_estimated, error_msg))

@moneroexamples
Copy link
Owner

Its only based on current blocks. Is there any API in monero itself to get a fee estimate for any block?

@ACK-J
Copy link
Author

ACK-J commented Aug 24, 2022

I dont believe so, but I wish there was one

@ACK-J
Copy link
Author

ACK-J commented Mar 20, 2023

Would you be able to expose the get_dynamic_base_fee_estimate wallet2 function as an API endpoint? This way sites like moneroj.net can track it from now on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants