btcpayserver-docker icon indicating copy to clipboard operation
btcpayserver-docker copied to clipboard

Add Mempool Explorer

Open Kukks opened this issue 2 years ago • 17 comments

Kukks avatar Aug 30 '21 12:08 Kukks

Why did this never leave draft state? Shall we give it another stab?

dennisreimann avatar Sep 08 '22 18:09 dennisreimann

@dennisreimann @softsimon mentioned in Riga that he can try to do it in ~4 months.

pavlenex avatar Sep 08 '22 18:09 pavlenex

I think we can pull it off on our own, most of the things @kukks did look good and I've once also set it up manually. We just need to get to it – docs here. https://github.com/mempool/mempool/tree/master/docker

dennisreimann avatar Sep 08 '22 18:09 dennisreimann

The basics are updated and in place now, need to wait for my txindex to be build so that I can continue here.

dennisreimann avatar Sep 10 '22 11:09 dennisreimann

@softsimon Is there an easy way to run the app under a directory-prefix like /mempool/ instead of directly in the root?

The HTML contains <base href="/">, which is aso updated via JS depending on the language (e.g. it might get turned into <base href="/de/">), which makes the browser load the assets from the root — we'd need a prefix like /mempool/ to run it in our context, so that we don't have to generate new SSL certs for a subdomain like mempool.mybtcpay.org.

Normally we would use nginx sub_filter to rewrite paths for our needs, but the JS overrides it anyways.

dennisreimann avatar Sep 10 '22 18:09 dennisreimann

@kukks @dennisreimann @softsimon I think this is an important feature - I'd like to donate a 0.05 BTC bounty to make it a priority.

danielalexiuc avatar Oct 10 '22 23:10 danielalexiuc

I have it almost working, fiddling with the details right now.

dennisreimann avatar Oct 11 '22 12:10 dennisreimann

Done now, ready for review :)

dennisreimann avatar Oct 11 '22 16:10 dennisreimann

you could have rebased it against master once more I guess? Just downgraded my 1.6.12 BTCPayServer to 1.6.10 - including older nbxplorer ... hopefully nothing breaks.

So far the GUI came back. 🤞

petzsch avatar Oct 12 '22 09:10 petzsch

one btcpay-restart.sh later:

NGinx isn't starting anymore. Container log from nginx fills with:

2022/10/12 09:41:07 [emerg] 1#1: "proxy_pass" directive is duplicate in /etc/nginx/conf.d/default.conf:116
nginx: [emerg] "proxy_pass" directive is duplicate in /etc/nginx/conf.d/default.conf:116

Any help with this is appreciated.

petzsch avatar Oct 12 '22 09:10 petzsch

Viewing Blocks leads to error 404 in the devtools and doesn't show the list of transactions: https://btcpay.4sats.net/mempool/block/000000000000000000051e3857f4f76691f7897ede16d0e21eee7c2bb60ceb84

image

petzsch avatar Oct 12 '22 10:10 petzsch

@petzsch Thanks for the pointer, f8eae35 contains the fix.

dennisreimann avatar Oct 12 '22 10:10 dennisreimann

How to test

Prerequisite: You need a non-pruned node, the fragment opt-add-mempool is incompatible with pruning.

Go to your BTCPay Server directory and run the following commands:

# Checkout this pull request
git checkout -b mempool
git pull origin mempool

# Prepare
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-mempool"

# Install
. ./btcpay-setup.sh -i

# Check
docker logs generated_mempool_api_1

dennisreimann avatar Oct 12 '22 10:10 dennisreimann

Awesome! Unfortunately I couldn't test for now as all my nodes are pruned 😬

Generating /app/Generated/docker-compose.generated.yml
The fragment opt-add-mempool is incompatible with 'pruning'

ndeet avatar Oct 12 '22 11:10 ndeet

@ndeet Yes, the requirement for ElectrumX leads to the incompatibility there. Updated the How To Test comment, thanks for the pointer!

dennisreimann avatar Oct 12 '22 11:10 dennisreimann

I've noticed a strange redirection bug:

When I want to view a transaction with my browser configured to use the german language by default (i.e. Chrome) and visiting https://btcpay.4sats.net/mempool/tx/9a840e18a6104ebeeee5958027e7377752e51126a1f2f7138bfc1d750dffdd44 - it redirects me to: https://btcpay.4sats.net/mempool/de/

While when the browser is configured to english, it stays on the first link and displays the transaction correctly.

I think the desired behaviour would have been a redirect to https://btcpay.4sats.net/mempool/de/tx/9a840e18a6104ebeeee5958027e7377752e51126a1f2f7138bfc1d750dffdd44

Could be an upstream problem - not sure.

petzsch avatar Oct 12 '22 12:10 petzsch

@petzsch I think this needs to be fixed on the application level. We are rewriting some of the content with nginx sub_filter already, but I'd refrain from rewriting parts of the JavaScript.

@softsimon Do you see an easy solution for this, like specifying/infering an app variable similar to the API_URL_PREFIX, so that we can make the app know about the URL prefix /mempool/, which we are using?

dennisreimann avatar Oct 12 '22 13:10 dennisreimann

@kukks I think we can merge and ship this — the leftover URL issue is minor I think and we can later on fix it.

dennisreimann avatar Oct 29 '22 14:10 dennisreimann

@danielalexiuc https://d11n.net/donate.html for bounty <3

Kukks avatar Oct 30 '22 08:10 Kukks

That's brilliant guys - awesome work, gladly paid. I think a lot of people will benefit from this.

danielalexiuc avatar Oct 30 '22 22:10 danielalexiuc