diff --git a/production/bitcoin.conf b/production/bitcoin.conf index 3ec72e2e2..26d61b18c 100644 --- a/production/bitcoin.conf +++ b/production/bitcoin.conf @@ -84,6 +84,39 @@ zmqpubrawtx=tcp://127.0.0.1:18335 #addnode=[2401:b140:4::92:205]:18333 #addnode=[2401:b140:4::92:206]:18333 +[testnet4] +daemon=1 +rpcbind=127.0.0.1:48332 +rpcbind=[::1]:48332 +bind=0.0.0.0:48333 +bind=[::]:48333 +zmqpubrawblock=tcp://127.0.0.1:48334 +zmqpubrawtx=tcp://127.0.0.1:48335 +#addnode=[2401:b140:1::92:201]:48333 +#addnode=[2401:b140:1::92:202]:48333 +#addnode=[2401:b140:1::92:203]:48333 +#addnode=[2401:b140:1::92:204]:48333 +#addnode=[2401:b140:1::92:205]:48333 +#addnode=[2401:b140:1::92:206]:48333 +#addnode=[2401:b140:2::92:201]:48333 +#addnode=[2401:b140:2::92:202]:48333 +#addnode=[2401:b140:2::92:203]:48333 +#addnode=[2401:b140:2::92:204]:48333 +#addnode=[2401:b140:2::92:205]:48333 +#addnode=[2401:b140:2::92:206]:48333 +#addnode=[2401:b140:3::92:201]:48333 +#addnode=[2401:b140:3::92:202]:48333 +#addnode=[2401:b140:3::92:203]:48333 +#addnode=[2401:b140:3::92:204]:48333 +#addnode=[2401:b140:3::92:205]:48333 +#addnode=[2401:b140:3::92:206]:48333 +#addnode=[2401:b140:4::92:201]:48333 +#addnode=[2401:b140:4::92:202]:48333 +#addnode=[2401:b140:4::92:203]:48333 +#addnode=[2401:b140:4::92:204]:48333 +#addnode=[2401:b140:4::92:205]:48333 +#addnode=[2401:b140:4::92:206]:48333 + [signet] daemon=1 rpcbind=127.0.0.1:38332 diff --git a/production/mempool-build-all b/production/mempool-build-all index 63dadaac0..1466de3ab 100755 --- a/production/mempool-build-all +++ b/production/mempool-build-all @@ -96,6 +96,8 @@ build_backend() -e "s!__MEMPOOL_MAINNET_PASS__!${MEMPOOL_MAINNET_PASS}!" \ -e "s!__MEMPOOL_TESTNET_USER__!${MEMPOOL_TESTNET_USER}!" \ -e "s!__MEMPOOL_TESTNET_PASS__!${MEMPOOL_TESTNET_PASS}!" \ + -e "s!__MEMPOOL_TESTNET4_USER__!${MEMPOOL_TESTNET4_USER}!" \ + -e "s!__MEMPOOL_TESTNET4_PASS__!${MEMPOOL_TESTNET4_PASS}!" \ -e "s!__MEMPOOL_SIGNET_USER__!${MEMPOOL_SIGNET_USER}!" \ -e "s!__MEMPOOL_SIGNET_PASS__!${MEMPOOL_SIGNET_PASS}!" \ -e "s!__MEMPOOL_MAINNET_LIGHTNING_USER__!${MEMPOOL_MAINNET_LIGHTNING_USER}!" \ @@ -130,7 +132,7 @@ source "${NVM_DIR}/nvm.sh" # what to look for frontends=(mainnet liquid onbtc) -backends=(mainnet testnet signet liquid liquidtestnet onbtc) +backends=(mainnet testnet testnet4 signet liquid liquidtestnet onbtc) frontend_repos=() backend_repos=() diff --git a/production/mempool-config.testnet4.json b/production/mempool-config.testnet4.json new file mode 100644 index 000000000..64336866d --- /dev/null +++ b/production/mempool-config.testnet4.json @@ -0,0 +1,84 @@ +{ + "MEMPOOL": { + "OFFICIAL": true, + "NETWORK": "testnet", + "BACKEND": "esplora", + "HTTP_PORT": 8990, + "MINED_BLOCKS_CACHE": 144, + "SPAWN_CLUSTER_PROCS": 0, + "API_URL_PREFIX": "/api/v1/", + "INDEXING_BLOCKS_AMOUNT": -1, + "AUDIT": true, + "RUST_GBT": true, + "POLL_RATE_MS": 1000, + "DISK_CACHE_BLOCK_INTERVAL": 1, + "MAX_PUSH_TX_SIZE_WEIGHT": 4000000, + "ALLOW_UNREACHABLE": true, + "MAX_TRACKED_ADDRESSES": 10 + }, + "SYSLOG" : { + "MIN_PRIORITY": "debug" + }, + "CORE_RPC": { + "PORT": 48332, + "USERNAME": "__BITCOIN_RPC_USER__", + "PASSWORD": "__BITCOIN_RPC_PASS__" + }, + "ESPLORA": { + "UNIX_SOCKET_PATH": "/bitcoin/socket/esplora-bitcoin-testnet4", + "FALLBACK": [ + "http://node201.fmt.mempool.space:3005", + "http://node202.fmt.mempool.space:3005", + "http://node203.fmt.mempool.space:3005", + "http://node204.fmt.mempool.space:3005", + "http://node205.fmt.mempool.space:3005", + "http://node206.fmt.mempool.space:3005", + "http://node201.va1.mempool.space:3005", + "http://node202.va1.mempool.space:3005", + "http://node203.va1.mempool.space:3005", + "http://node204.va1.mempool.space:3005", + "http://node205.va1.mempool.space:3005", + "http://node206.va1.mempool.space:3005", + "http://node207.va1.mempool.space:3005", + "http://node208.va1.mempool.space:3005", + "http://node209.va1.mempool.space:3005", + "http://node210.va1.mempool.space:3005", + "http://node211.va1.mempool.space:3005", + "http://node212.va1.mempool.space:3005", + "http://node213.va1.mempool.space:3005", + "http://node214.va1.mempool.space:3005", + "http://node201.fra.mempool.space:3005", + "http://node202.fra.mempool.space:3005", + "http://node203.fra.mempool.space:3005", + "http://node204.fra.mempool.space:3005", + "http://node205.fra.mempool.space:3005", + "http://node206.fra.mempool.space:3005", + "http://node207.fra.mempool.space:3005", + "http://node208.fra.mempool.space:3005", + "http://node209.fra.mempool.space:3005", + "http://node210.fra.mempool.space:3005", + "http://node211.fra.mempool.space:3005", + "http://node212.fra.mempool.space:3005", + "http://node213.fra.mempool.space:3005", + "http://node214.fra.mempool.space:3005", + "http://node201.tk7.mempool.space:3005", + "http://node202.tk7.mempool.space:3005", + "http://node203.tk7.mempool.space:3005", + "http://node204.tk7.mempool.space:3005", + "http://node205.tk7.mempool.space:3005", + "http://node206.tk7.mempool.space:3005" + ] + }, + "DATABASE": { + "ENABLED": true, + "HOST": "127.0.0.1", + "SOCKET": "/var/run/mysql/mysql.sock", + "USERNAME": "__MEMPOOL_TESTNET4_USER__", + "PASSWORD": "__MEMPOOL_TESTNET4_PASS__", + "DATABASE": "mempool_testnet4" + }, + "STATISTICS": { + "ENABLED": true, + "TX_PER_SECOND_SAMPLE_PERIOD": 150 + } +} diff --git a/production/mempool-start-all b/production/mempool-start-all index ff962f95e..c08f1ec07 100755 --- a/production/mempool-start-all +++ b/production/mempool-start-all @@ -4,7 +4,7 @@ source "$NVM_DIR/nvm.sh" nvm use v20.12.0 # start all mempool backends that exist -for site in mainnet mainnet-lightning testnet testnet-lightning signet signet-lightning liquid liquidtestnet;do +for site in mainnet mainnet-lightning testnet testnet-lightning testnet4 signet signet-lightning liquid liquidtestnet;do cd "${HOME}/${site}/backend/" && \ echo "starting mempool backend: ${site}" && \ screen -dmS "${site}" sh -c 'while true;do npm run start-production;sleep 1;done' diff --git a/production/nginx/location-testnet4-api.conf b/production/nginx/location-testnet4-api.conf new file mode 100644 index 000000000..c0569ecf2 --- /dev/null +++ b/production/nginx/location-testnet4-api.conf @@ -0,0 +1,162 @@ +########### +# mempool # +########### + +# Block the internal APIs of esplora +location /testnet4/api/internal/ { + return 404; +} +location /testnet4/api/v1/internal/ { + return 404; +} + +# websocket has special HTTP headers +location /testnet4/api/v1/ws { + rewrite ^/testnet4/(.*) /$1 break; + try_files /dev/null @mempool-testnet4-api-v1-websocket; +} + +# warm cache mining and mempool API responses +location /testnet4/api/v1/statistics { + rewrite ^/testnet4/(.*) /$1 break; + try_files /dev/null @mempool-testnet4-api-v1-cache-warm; +} +location /testnet4/api/v1/mining { + rewrite ^/testnet4/(.*) /$1 break; + try_files /dev/null @mempool-testnet4-api-v1-cache-warm; +} + +# it's ok to cache blockchain data "forever", so we do 30d +location /testnet4/api/v1/block/ { + rewrite ^/testnet4/(.*) /$1 break; + try_files /dev/null @mempool-testnet4-api-v1-cache-forever; +} + +# everything else gets "normal" cache +location /testnet4/api/v1 { + rewrite ^/testnet4/(.*) /$1 break; + try_files /dev/null @mempool-testnet4-api-v1-cache-normal; +} + +########### +# esplora # +########### + +# it's ok to cache blockchain data "forever", so we do 30d +location /testnet4/api/block/ { + rewrite ^/testnet4/api/(.*) /$1 break; + try_files /dev/null @esplora-testnet4-api-cache-forever; +} +# other API responses cannot be cached +location /testnet4/api/ { + rewrite ^/testnet4/api/(.*) /$1 break; + try_files /dev/null @esplora-testnet4-api-cache-disabled; +} + +########### +# routing # +########### + +location @mempool-testnet4-api-v1-websocket { + proxy_pass $mempoolTestnet4; + proxy_http_version 1.1; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-Proto $scheme; +} + +location @mempool-testnet4-api-v1-cache-forever { + proxy_pass $mempoolTestnet4; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache apicold; + proxy_cache_valid 200 30d; + proxy_redirect off; + + expires 30d; +} + +location @mempool-testnet4-api-v1-cache-warm { + proxy_pass $mempoolTestnet4; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache apiwarm; + proxy_cache_valid 200 10s; + proxy_redirect off; +} + +location @mempool-testnet4-api-v1-cache-normal { + proxy_pass $mempoolTestnet4; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_cache apinormal; + proxy_cache_valid 200 10s; + proxy_redirect off; + + expires 10s; +} + +location @mempool-testnet4-api-v1-cache-disabled { + proxy_pass $mempoolTestnet4; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_redirect off; + proxy_buffering off; + + expires -1; +} + +location @esplora-testnet4-api-cache-disabled { + proxy_pass $esploraTestnet4; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_redirect off; + proxy_buffering off; + + expires -1; +} + +location @esplora-testnet4-api-cache-forever { + proxy_pass $esploraTestnet4; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + proxy_cache_background_update on; + proxy_cache_use_stale updating; + proxy_cache apicold; + proxy_cache_valid 200 30d; + proxy_redirect off; + + expires 30d; +} diff --git a/production/nginx/nginx.conf b/production/nginx/nginx.conf index c48d4992a..169faab30 100644 --- a/production/nginx/nginx.conf +++ b/production/nginx/nginx.conf @@ -55,12 +55,14 @@ http { set $mempoolMainnetLightning "http://mempool-bitcoin-mainnet-lightning"; set $mempoolTestnet "http://mempool-bitcoin-testnet"; set $mempoolTestnetLightning "http://mempool-bitcoin-testnet-lightning"; + set $mempoolTestnet4 "http://mempool-bitcoin-testnet4"; set $mempoolSignet "http://mempool-bitcoin-signet"; set $mempoolSignetLightning "http://mempool-bitcoin-signet-lightning"; # for blockstream/esplora daemons, see upstream-esplora.conf set $esploraMainnet "http://esplora-bitcoin-mainnet"; set $esploraTestnet "http://esplora-bitcoin-testnet"; + set $esploraTestnet4 "http://esplora-bitcoin-testnet4"; set $esploraSignet "http://esplora-bitcoin-signet"; # filesystem paths diff --git a/production/nginx/server-mempool.conf b/production/nginx/server-mempool.conf index 892fe50e1..a63c27fca 100644 --- a/production/nginx/server-mempool.conf +++ b/production/nginx/server-mempool.conf @@ -5,5 +5,7 @@ include mempool/production/nginx/location-api-v1-lightning.conf; include mempool/production/nginx/location-api.conf; include mempool/production/nginx/location-testnet-api.conf; include mempool/production/nginx/location-testnet-api-v1-lightning.conf; +include mempool/production/nginx/location-testnet4-api.conf; +#include mempool/production/nginx/location-testnet4-api-v1-lightning.conf; include mempool/production/nginx/location-signet-api.conf; include mempool/production/nginx/location-signet-api-v1-lightning.conf; diff --git a/production/nginx/upstream-esplora.conf b/production/nginx/upstream-esplora.conf index b7fbbf163..88ffa11bd 100644 --- a/production/nginx/upstream-esplora.conf +++ b/production/nginx/upstream-esplora.conf @@ -7,6 +7,9 @@ upstream esplora-liquid-mainnet { upstream esplora-bitcoin-testnet { server unix:/bitcoin/socket/esplora-bitcoin-testnet fail_timeout=10s max_fails=10 weight=99999; } +upstream esplora-bitcoin-testnet4 { + server unix:/bitcoin/socket/esplora-bitcoin-testnet4 fail_timeout=10s max_fails=10 weight=99999; +} upstream esplora-bitcoin-signet { server unix:/bitcoin/socket/esplora-bitcoin-signet fail_timeout=10s max_fails=10 weight=99999; } diff --git a/production/nginx/upstream-mempool.conf b/production/nginx/upstream-mempool.conf index c9cf9c2bb..50d291910 100644 --- a/production/nginx/upstream-mempool.conf +++ b/production/nginx/upstream-mempool.conf @@ -7,9 +7,6 @@ upstream mempool-liquid-mainnet { upstream mempool-bitcoin-testnet { server 127.0.0.1:8997 fail_timeout=10s max_fails=10 weight=99999; } -upstream mempool-bitcoin-bisq { - server 127.0.0.1:8996 fail_timeout=10s max_fails=10 weight=99999; -} upstream mempool-bitcoin-signet { server 127.0.0.1:8995 fail_timeout=10s max_fails=10 weight=99999; } @@ -25,3 +22,6 @@ upstream mempool-bitcoin-testnet-lightning { upstream mempool-bitcoin-signet-lightning { server 127.0.0.1:8991 fail_timeout=10s max_fails=10 weight=99999; } +upstream mempool-bitcoin-testnet4 { + server 127.0.0.1:8990 fail_timeout=10s max_fails=10 weight=99999; +}