nix-bitcoin icon indicating copy to clipboard operation
nix-bitcoin copied to clipboard

Add mempool

Open erikarvstedt opened this issue 2 years ago • 6 comments

This PR tracks my modifications to #456 (nixbitcoin:mempool-nb). It is based on https://github.com/fort-nix/nix-bitcoin/pull/504 (Add fulcrum). Deployed at https://mempool.nixbitcoin.org

erikarvstedt avatar Jul 04 '22 11:07 erikarvstedt

I think this pretty much works now and could be spun out into a new PR to merge.

nixbitcoin avatar Jul 08 '22 12:07 nixbitcoin

This PR is ready for review. Here's the unsquashed version.

Upstream requirements for merging:

  • https://github.com/mempool/mempool/pull/2096
  • https://github.com/mempool/mempool/pull/2078
  • https://github.com/mempool/mempool/pull/2058

erikarvstedt avatar Jul 14 '22 22:07 erikarvstedt

Thanks for working on this. Will get back to on those PRs soon.

wiz avatar Jul 14 '22 22:07 wiz

To explicitly check the change to nodeinfo (which is covered by the tests), run:

run-tests.sh -s '{
  imports = [ scenarios.regtestBase ];
  services.mempool.enable = true;
  nix-bitcoin.onionServices.mempool-frontend.enable = true;
  nix-bitcoin.nodeinfo.enable = true;
}' container --run c nodeinfo

# Result:
# {
#   ...
#   "mempool-frontend": {
#     "local_address": "127.0.0.1:60845",
#     "onion_address": "udiacmki6rjrtcxkttwpv3iilczaz52gybodi7ceqwmubulhndhrapad.onion:80"
#   }
# }

erikarvstedt avatar Jul 15 '22 08:07 erikarvstedt

After reviewing the code and testing the module, I think this PR is ready to get merged. Let's wait for the upstream PRs and then merge this. :tada:

nixbitcoin avatar Jul 15 '22 13:07 nixbitcoin

Sorry for the delay on merging the upstream PRs but they are in the queue

wiz avatar Jul 23 '22 03:07 wiz

Hello @erikarvstedt , do you think we can proceed with merging this one (as mentioned in https://github.com/mempool/mempool/issues/2246#issuecomment-1302763702)?

if you still consider this PR unstable, I was thinking about adding support for an alternative explorer - btc-rpc-explorer. What do you think?

Thanks.

seberm avatar Nov 15 '22 14:11 seberm

I think we are still waiting to merge a big nginx PR ?

wiz avatar Nov 16 '22 02:11 wiz

I think we are still waiting to merge a big nginx PR ?

I think this was discussed here, @erikarvstedt wanted to merge regardless

your-sudden-death avatar Nov 16 '22 11:11 your-sudden-death

I think we are still waiting to merge a big nginx PR ?

No, this PR is only blocked by https://github.com/mempool/mempool/issues/2246. You recently downgraded the axios dependency (a possible cause of the bug), so let's give this another try.

erikarvstedt avatar Dec 04 '22 16:12 erikarvstedt

any updates?

your-sudden-death avatar Jan 02 '23 20:01 your-sudden-death

On 2023-01-17 the nixbitcoin.org mempool instance will have run for 30 days. If the axios bug hasn't appeared by then, we can merge this. Things are fine when address queries are served without an error, like https://mempool.nixbitcoin.org/address/16KYNEvXdjVei9CJoHMsYye7zKmjVbnybi.

erikarvstedt avatar Jan 06 '23 23:01 erikarvstedt

@knorrium have you observed the axios state bug since we downgraded the dependency version?

wiz avatar Jan 07 '23 07:01 wiz

Closes https://github.com/fort-nix/nix-bitcoin/issues/394

prusnak avatar Jan 08 '23 12:01 prusnak

The bug has reappared, after running for 26 days. I've restarted the backend.

What we'll do now:

  • Release mempool as an extension flake in a separate repo, with a weekly timer that restarts the backend.
  • Add an extra instance to nixbitcoin.org that can be used for debugging.

erikarvstedt avatar Jan 13 '23 11:01 erikarvstedt

hmm that suggests the old bug we had where axios would get into a broken state is still around, easier to reproduce using tor - @knorrium after the umbrel release we should prioritize investigating this

wiz avatar Jan 13 '23 13:01 wiz

The mempool flake will be released when https://github.com/fort-nix/nix-bitcoin/pull/586 is merged.

I've added two extra mempool instances to nixbitcoin.org.

  • https://mempool-debug-tor.nixbitcoin.org This sets a Tor SOCKS5PROXY, like in our main config.
  • https://mempool-debug.nixbitcoin.org This runs without a Tor proxy. We've never run this in production over an extended period of time. Maybe the bug doesn't happen here.

These instances share the same bitcoind and fulcrum backend, and are implemented here.

@wiz, when the bug reappears, we'll keep these instances running and give you SSH access to the nodejs debug socket.

erikarvstedt avatar Jan 20 '23 17:01 erikarvstedt

The mempool extension module has been released for some time, and is now listed in the nix-bitcoin README.

erikarvstedt avatar Feb 27 '23 12:02 erikarvstedt

Thanks for the hard work on this. We've also made progress tracking down the remaining issues, it seems we weren't using axios in all places and the built-in NodeJS http client is buggy 😓

wiz avatar Feb 27 '23 14:02 wiz

The bug has now appeared on both debug instances: https://mempool-debug.nixbitcoin.org/address/1CGG9qVq2P6F7fo6sZExvNq99Jv2GDpaLE https://mempool-debug-tor.nixbitcoin.org/address/1CGG9qVq2P6F7fo6sZExvNq99Jv2GDpaLE

Both instances were started on 2023-02-24 and failed ~20 days (debug-tor) and ~25 days (debug) later. @wiz, @knorrium, if you're interested in SSH nodejs debug socket access, let me know via Matrix.

erikarvstedt avatar Apr 06 '23 20:04 erikarvstedt

Can you upgrade to v2.5.0 tag? We added a potential fix for this issue

wiz avatar Apr 07 '23 08:04 wiz

What's the status of this? I was looking into running one of these today.

jb55 avatar May 08 '23 18:05 jb55

I've updated the extension module to the latest release 2.5.0.

Also, I've updated both debug instances. If they run stably for 30 days, I'll add mempool as a core nix-bitcoin module.

@jb55, the extension module is ready for production use.

erikarvstedt avatar May 09 '23 15:05 erikarvstedt

@erikarvstedt not gonna lie I have no idea how to extend my nixos system modules, I've always just patched my nixpkgs.

jb55 avatar May 09 '23 20:05 jb55

ah cool there are instructions. thank you!

jb55 avatar May 09 '23 20:05 jb55

The Electrum backend failure bug has been fixed. Ready to merge. This branch is running live on nixbitcoin.org.

Use this for comparing the content of this PR with the extension flake:

git clone https://github.com/fort-nix/nix-bitcoin-mempool /tmp/nix-bitcoin-mempool
extension=/tmp/nix-bitcoin-mempool
nb=<nix-bitcoin-src>
git diff --no-index {$extension,$nb}/modules/mempool.nix
git diff --no-index {$extension,$nb}/pkgs/mempool

erikarvstedt avatar Aug 06 '23 19:08 erikarvstedt

Rebased.

erikarvstedt avatar Aug 19 '23 12:08 erikarvstedt

Hmm is this active on mempool.nixos.org rn? Address queries appear to be failing.

Screenshot from 2023-09-06 10-35-43

chrisguida avatar Sep 06 '23 16:09 chrisguida

Rebased and deployed.

erikarvstedt avatar Oct 30 '23 11:10 erikarvstedt

The shellcheck job fails.

jonasnick avatar Oct 30 '23 12:10 jonasnick