Add mempool.space

This commit is contained in:
Taylor Helsper 2019-12-22 23:46:42 -06:00
parent cc64f2b535
commit 8c9b7fa09f
10 changed files with 136 additions and 5 deletions

View File

@ -0,0 +1,27 @@
# MempoolSpace service
# /etc/systemd/system/mempoolspace.service
[Unit]
Description=MempoolSpace
Wants=www.service
After=www.service
[Service]
WorkingDirectory=/opt/mynode/mempoolspace
EnvironmentFile=/mnt/hdd/mynode/settings/.btcrpc_environment
ExecStartPre=/usr/bin/wait_on_bitcoin.sh
ExecStart=/usr/bin/docker run --rm --name mempoolspace -p 4080:80 -e BITCOIN_NODE_HOST=172.17.0.1 -e BITCOIN_NODE_USER=mynode -e BITCOIN_NODE_PASS=${BTC_RPC_PASSWORD} mempoolspace
ExecStop=/usr/bin/docker stop -t 2 mempoolspace
User=root
Group=root
Type=simple
TimeoutSec=240
Restart=always
RestartSec=30
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=mempoolspace
[Install]
WantedBy=multi-user.target

View File

@ -32,6 +32,29 @@ while [ 1 ]; do
echo $WEBSSH2_UPGRADE_URL > $WEBSSH2_UPGRADE_URL_FILE
fi
# Upgrade mempool.space
if [ $IS_PREMIUM -eq 1 ]; then
MEMPOOLSPACE_UPGRADE_URL=https://github.com/mempool-space/mempool.space/archive/master.zip
MEMPOOLSPACE_UPGRADE_URL_FILE=/mnt/hdd/mynode/settings/mempoolspace_url
CURRENT=""
if [ -f $MEMPOOLSPACE_UPGRADE_URL_FILE ]; then
CURRENT=$(cat $MEMPOOLSPACE_UPGRADE_URL_FILE)
fi
if [ "$CURRENT" != "$MEMPOOLSPACE_UPGRADE_URL" ]; then
cd /opt/mynode
rm -rf mempoolspace
wget $MEMPOOLSPACE_UPGRADE_URL -O mempool.zip
unzip -o mempool.zip
rm mempool.zip
mv mempool* mempoolspace
cd mempoolspace
docker build -t mempoolspace .
echo $MEMPOOLSPACE_UPGRADE_URL > $MEMPOOLSPACE_UPGRADE_URL_FILE
fi
fi
# Check again in a day
sleep 24h
done

View File

@ -15,6 +15,7 @@ ufw allow 1900 comment 'allow SSDP for UPnP discovery'
ufw allow 10009 comment 'allow Lightning gRPC'
ufw allow 10080 comment 'allow Lightning REST RPC'
ufw allow 9735 comment 'allow Lightning'
ufw allow 8332 comment 'allow Bitcoin RPC - filtered by rpcallowip'
ufw allow 8333 comment 'allow Bitcoin mainnet'
ufw allow 18333 comment 'allow Bitcoin testnet'
ufw allow 2222 comment 'allow WebSSH2'
@ -22,6 +23,7 @@ ufw allow 3000 comment 'allow LndHub'
ufw allow 3002 comment 'allow BTC RPC Explorer'
#ufw allow 3004 comment 'allow LND Admin'
ufw allow 3010 comment 'allow RTL'
ufw allow 4080 comment 'allow mempool.space'
ufw allow 5353 comment 'allow Avahi'
ufw allow 50001 comment 'allow Electrum Server'
ufw allow 50002 comment 'allow Electrum Server'

View File

@ -19,8 +19,12 @@ txindex=1
rpcauth=mynode:7b7e11c032ddd3fc3835e4e463afd305$6c6a32bbd08cb1b67b5ea89b66865c5ca2bf6fd8a91a19d6a4d58157fe0882b4
rpcport=8332
rpcbind=127.0.0.1
rpcbind=0.0.0.0
rpcallowip=127.0.0.1
rpcallowip=10.0.0.0/8
rpcallowip=172.0.0.0/8
rpcallowip=192.0.0.0/8
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333

View File

@ -5,11 +5,10 @@ from config import *
# Generic service check
def is_service_enabled(service):
cmd = "systemctl status {} --no-pager".format(service)
cmd = "systemctl is-enabled {}".format(service)
try:
results = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
if "enabled;" in results:
return True
subprocess.check_call(cmd, shell=True)
return True
except:
return False
return False
@ -69,6 +68,18 @@ def disable_btcrpcexplorer():
os.system("systemctl disable btc_rpc_explorer --no-pager")
def is_mempoolspace_enabled():
return is_service_enabled("mempoolspace")
def enable_mempoolspace():
os.system("systemctl enable mempoolspace --no-pager")
os.system("systemctl start mempoolspace --no-pager")
def disable_mempoolspace():
os.system("systemctl stop mempoolspace --no-pager")
os.system("systemctl disable mempoolspace --no-pager")
def is_vpn_enabled():
if os.path.isfile(VPN_ENABLED_FILE):
return True

View File

@ -222,6 +222,7 @@ def index():
btcrpcexplorer_status = ""
btcrpcexplorer_ready = False
btcrpcexplorer_status_color = "gray"
mempoolspace_status_color = "gray"
vpn_status_color = "gray"
vpn_status = ""
@ -325,6 +326,14 @@ def index():
btcrpcexplorer_status_color = "green"
btcrpcexplorer_status = "Waiting on electrs..."
# Find mempool space status
if is_mempoolspace_enabled():
status = os.system("systemctl status mempoolspace --no-pager")
if status != 0:
mempoolspace_status_color = "red"
else:
mempoolspace_status_color = "green"
# Find lndconnect status
if lnd_ready:
lndconnect_status_color = "green"
@ -383,6 +392,8 @@ def index():
"btcrpcexplorer_status_color": btcrpcexplorer_status_color,
"btcrpcexplorer_status": btcrpcexplorer_status,
"btcrpcexplorer_enabled": is_btcrpcexplorer_enabled(),
"mempoolspace_status_color": mempoolspace_status_color,
"mempoolspace_enabled": is_mempoolspace_enabled(),
"lndconnect_status_color": lndconnect_status_color,
"vpn_status_color": vpn_status_color,
"vpn_status": vpn_status,
@ -475,6 +486,15 @@ def page_toggle_btcrpcexplorer():
enable_btcrpcexplorer()
return redirect("/")
@app.route("/toggle-mempoolspace")
def page_toggle_mempoolspace():
check_logged_in()
if is_mempoolspace_enabled():
disable_mempoolspace()
else:
enable_mempoolspace()
return redirect("/")
@app.route("/toggle-vpn")
def page_toggle_vpn():
check_logged_in()

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -68,6 +68,24 @@
{% endif %}
</div>
</div>
<div class="app_tile">
<div class="app_status_icon {% if product_key_skipped %}gray{% else %} {{mempoolspace_status_color}} {% endif %}"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/mempoolspace.png")}}"/></div>
<div class="app_title">Mempool.Space</div>
<div class="app_status">Mempool Viewer</div>
<div class="app_contents">
{% if product_key_skipped %}
Premium Feature
{% else %}
{% if mempoolspace_enabled %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="mempoolspace">View</a>
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-mempoolspace">Disable</a>
{% else %}
<a class="ui-button ui-widget ui-corner-all mynode_button" href="#" id="toggle-mempoolspace">Enable</a>
{% endif %}
{% endif %}
</div>
</div>
<div class="app_tile">
<div class="app_status_icon {% if product_key_skipped %}gray{% else %}green{% endif %}"></div>
<div class="app_logo"><img class="app_logo_icon" src="{{ url_for('static', filename="images/tor.png")}}"/></div>

View File

@ -9,6 +9,7 @@
electrs_enabled = {% if electrs_enabled %}1{% else %}0{% endif %}
lndhub_enabled = {% if lndhub_enabled %}1{% else %}0{% endif %}
vpn_enabled = {% if vpn_enabled %}1{% else %}0{% endif %}
mempoolspace_enabled = {% if mempoolspace_enabled %}1{% else %}0{% endif %}
$("#lndhub").on("click", function() {
url = 'http://'+location.hostname+':3000'
@ -30,6 +31,11 @@
window.open(url,'_blank');
})
$("#mempoolspace").on("click", function() {
url = 'http://'+location.hostname+':4080'
window.open(url,'_blank');
})
$("#toggle-electrs").on("click", function() {
if (electrs_enabled)
{
@ -78,6 +84,10 @@
window.location.href="/toggle-btcrpcexplorer"
});
$("#toggle-mempoolspace").on("click", function() {
window.location.href="/toggle-mempoolspace"
});
function lndconnect() {
$("#lndconnect_form").submit();
lndconnect_dialog.dialog( "close" );

View File

@ -301,6 +301,22 @@ fi
#cd ~
# Install recent version of secp256k1
echo "Installing secp256k1..."
if [ ! -f /usr/include/secp256k1_ecdh.h ]; then
rm -rf /tmp/secp256k1
cd /tmp/
git clone https://github.com/bitcoin-core/secp256k1.git
cd secp256k1
./autogen.sh
./configure
make
make install
cp -f include/* /usr/include/
fi
# Install RTL
RTL_UPGRADE_URL=https://github.com/Ride-The-Lightning/RTL/archive/v0.5.4.tar.gz
RTL_UPGRADE_URL_FILE=/home/bitcoin/.mynode/.rtl_url