Open notmandatory opened 1 year ago
Nakamoto has a way of estimating feerate per block. https://docs.rs/nakamoto-client/0.4.0/nakamoto_client/enum.Event.html#variant.FeeEstimated. I don't yet know how we could use that information for feerate calculation in the case of CBF, but I will definitely look into it.
In my opinion it would be great to have a trait that abstracts away the implementation details of each of the clients.
I also think that having traits to abstract details is the way to go. It is also more future-proof as well.
Before adding a trait can we use the fee estimation in all the examples.
Picking this up. Is there any opposition to adding a trait that abstracts away different sources, as mentioned by sebastianmontero and realeinherjar?
Describe the enhancement
In the pre-1.0.0 BDK APIs the
Blockchain.estimate_fee
API provided a thin wrapper around blockchain clients native calls. Since theBlockchain
trait is not needed anymore we need a new way to help users estimate transaction fees.A couple options are:
electrum-client:
esplora-client BlockingClient:
eplora-client AsyncClient:
bitcoincore_rpc:
FeeEstimator
trait with implementations for each of the above. Could also add implementations for popular providers custom APIs like mempool.space.Use case
Getting the fee rate is a common operation most bdk based apps will need. It is also something that pre-1.0 BDK provided and if missing could slow down users migrating to the 1.0.
Additional context
This issue was discussed in #1052 by @tnull and in bitcoindevkit/.github#70 and on Discord.