fee_source 1.0.0

Get bitcoin network fees from mempool instance and convert to formats needed by other services
Documentation
# 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:

- [esplora]https://blockstream.info/api/fee-estimates
- [lnd]https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json
- [mempool.space]https://mempool.space/api/v1/fees/recommended

## 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.

```bash
cp .env.example .env
```

### Nginx
You can expose the fee feeds via nginx by adding the following configuration:
```nginx
<...>

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

```bash
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:
```bash
cargo build --target=x86_64-unknown-linux-musl --release
```

## Releasing
1. Merge all PRs in the master branch that you want to include in the next version.
2. Update `Cargo.toml` version
3. Build release binary `cargo build --target=x86_64-unknown-linux-musl --release` (this will update `Cargo.lock`)
4. Update `CHANGELOG.md` with the given format. Use the commit history on the master to determine the changes.
5. Create a PR with the title: `chore: vx.x.x`.
6. Let the PR review and squash + merge.
7. Create a [new Github release]https://github.com/synonymdev/fee_source/releases/new.
    - Tag: `vx.x.x`
    - Title: `vx.x.x`
    - Description: Changelog for the current version.