1 stable release
1.0.0 | Jan 21, 2025 |
---|
#3 in #fees
93 downloads per month
21KB
405 lines
Fee Source
Bitcoind's fee estimation is not always reliable. This is a small libary that takes data from mempool.space with fallback to bitcoind and exposes it in formats of:
Fee feeds
When run as a binary it will fetch data and store it in the given folder. The data is stored in the following formats:
- esplora fee at
<ENV.FEE_FOLDER_PATH>/esplora.json
{
1: 100,
3: 50,
6: 20,
144: 1,
1008: 1,
}
- LND fee feed at
<ENV.FEE_FOLDER_PATH>/lnd.json
{
current_block_hash: "0000000000000000000XXXX",
fee_by_block_target: {
1: 102400,
3: 51200,
6: 20480,
144: 1024,
1008: 1024,
},
min_relay_feerate: 1024
}
- mempool.space fee feed at
<ENV.FEE_FOLDER_PATH>/mempool.json
{
"fastestFee": 100,
"halfHourFee": 50,
"hourFee": 20,
"economyFee": 1,
"minimumFee": 1,
}
Configuration
See .env.example
for configuration options.
cp .env.example .env
Nginx
You can expose the fee feeds via nginx by adding the following configuration:
<...>
location /fee/esplora {
alias <ENV.FEE_FOLDER_PATH>/esplora.json;
default_type application/json;
}
location /fee/lnd {
alias <ENV.FEE_FOLDER_PATH>/lnd.json;
default_type application/json;
}
location /fee/mempool {
alias <ENV.FEE_FOLDER_PATH>/mempool.json;
default_type application/json;
}
<...>
Running
cargo run
Building
OpenSSL uses OS dependencies. Older Ubuntu versions (i.e. 20.04) may have older versions of libc=v2.31
thus running standard ubuntu build may fail. To build for Ubuntu 20.04 use musl
target:
cargo build --target=x86_64-unknown-linux-musl --release
Releasing
- Merge all PRs in the master branch that you want to include in the next version.
- Update
Cargo.toml
version - Build release binary
cargo build --target=x86_64-unknown-linux-musl --release
(this will updateCargo.lock
) - Update
CHANGELOG.md
with the given format. Use the commit history on the master to determine the changes. - Create a PR with the title:
chore: vx.x.x
. - Let the PR review and squash + merge.
- Create a new Github release.
- Tag:
vx.x.x
- Title:
vx.x.x
- Description: Changelog for the current version.
- Tag:
Dependencies
~11–28MB
~446K SLoC