Skip to content

Commit de416ef

Browse files
committed
let the user choose his Bitcoin implementation on first boot
1 parent 5d0ab9e commit de416ef

File tree

8 files changed

+111
-0
lines changed

8 files changed

+111
-0
lines changed

rootfs/standard/usr/bin/mynode-install-custom-bitcoin

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,32 @@ elif [ "$APP" = "knots_29_2" ]; then
198198
echo "29.2-knots" > /home/bitcoin/.mynode/bitcoin_version_latest_custom
199199
echo "29.2-knots" > /mnt/hdd/mynode/settings/bitcoin_version_latest_custom
200200

201+
cd ~
202+
elif [ "$APP" = "latest-knots" ]; then
203+
BTC_UPGRADE_URL=https://bitcoinknots.org/files/29.x/29.2.knots20251010/bitcoin-29.2.knots20251010-$ARCH.tar.gz
204+
BTC_SHASUM=https://bitcoinknots.org/files/29.x/29.2.knots20251010/SHA256SUMS
205+
BTC_ASC=https://bitcoinknots.org/files/29.x/29.2.knots20251010/SHA256SUMS.asc
206+
207+
rm -rf /opt/download
208+
mkdir -p /opt/download
209+
cd /opt/download
210+
211+
# Download, install and verify
212+
wget $BTC_UPGRADE_URL $BTC_SHASUM $BTC_ASC
213+
gpg --verify SHA256SUMS.asc SHA256SUMS
214+
sha256sum -c SHA256SUMS --ignore-missing
215+
tar -xvf bitcoin-29.2.knots20251010-$ARCH.tar.gz
216+
mv bitcoin-29.2.knots20251010 bitcoin
217+
install -m 0755 -o root -g root -t /usr/local/bin bitcoin/bin/*
218+
219+
echo "latest-knots" > /home/bitcoin/.mynode/bitcoin_version
220+
echo "latest-knots" > /home/bitcoin/.mynode/bitcoin_version_latest_custom
221+
echo "latest-knots" > /mnt/hdd/mynode/settings/bitcoin_version_latest_custom
222+
touch /mnt/hdd/mynode/settings/bitcoin_implementation_choosen
223+
201224
cd ~
202225
elif [ "$APP" = "default" ]; then
226+
touch /mnt/hdd/mynode/settings/bitcoin_implementation_choosen
203227
# Clear custom info and re-install bitcoin
204228
echo "unknown" > /home/bitcoin/.mynode/bitcoin_version
205229
rm -f /home/bitcoin/.mynode/bitcoin_version_latest_custom

rootfs/standard/usr/bin/mynode_startup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ if [ ! -f /mnt/hdd/mynode/settings/btc_network_settings_defaulted ] &&
333333
fi
334334
echo "drive_mounted" > $MYNODE_STATUS_FILE
335335

336+
if [ ! -f /mnt/hdd/mynode/settings/bitcoin_implementation_choosen ]; then
337+
echo "choose_implementation" > $MYNODE_STATUS_FILE
338+
fi
339+
336340
# BTC Config
337341
source /usr/bin/mynode_gen_bitcoin_config.sh
338342

rootfs/standard/var/pynode/device_info.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ def get_swap_size():
448448
STATE_DOCKER_RESET = "docker_reset"
449449
STATE_GEN_DHPARAM = "gen_dhparam"
450450
STATE_CHOOSE_NETWORK = "choose_network"
451+
STATE_CHOOSE_IMPLEMENTATION = "choose_implementation"
451452
STATE_QUICKSYNC_DOWNLOAD = "quicksync_download"
452453
STATE_QUICKSYNC_COPY = "quicksync_copy"
453454
STATE_QUICKSYNC_RESET = "quicksync_reset"

rootfs/standard/var/www/mynode/mynode.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ def index():
246246
"ui_settings": read_ui_settings()
247247
}
248248
return render_template('choose_network.html', **templateData)
249+
elif status == STATE_CHOOSE_IMPLEMENTATION:
250+
templateData = {
251+
"title": "Choose Bitcoin Implementation",
252+
"ui_settings": read_ui_settings()
253+
}
254+
return render_template('choose_bitcoin_implementation.html', **templateData)
249255
elif status == STATE_DOCKER_RESET:
250256
templateData = {
251257
"title": "MyNode",
22.3 KB
Loading
598 KB
Loading
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!DOCTYPE html lang="en">
2+
<head>
3+
<title>{{ title }}</title>
4+
{% include 'includes/head.html' %}
5+
<meta http-equiv="refresh" content="3600">
6+
7+
<script>
8+
$(document).ready(function() {
9+
10+
11+
});
12+
</script>
13+
14+
<style>
15+
td, th {
16+
border-top: none !important;
17+
}
18+
</style>
19+
20+
</head>
21+
22+
<body>
23+
{% include 'includes/logo_header.html' %}
24+
25+
{% include 'includes/message_display.html' %}
26+
27+
<div class="state_header">Choose Bitcoin implementation</div>
28+
29+
<div class="format_div" style="width: 500px;">
30+
31+
<table style="margin: auto; width: 500px; text-align: center;">
32+
<tr>
33+
<td><img style="width: 160px; margin: auto;" src="{{ url_for('static', filename="images/knots.png")}}"/></td>
34+
<td></td>
35+
<td><img style="width: 160px; margin: auto;" src="{{ url_for('static', filename="images/core.png")}}"/></td>
36+
</tr>
37+
<tr>
38+
<tr style="font-size: 20px;">
39+
<td><b>Bitcoin Knots</b></td>
40+
<td></td>
41+
<td><b>Bitcoin Core</b></td>
42+
</tr>
43+
</tr>
44+
<tr>
45+
<td>
46+
<br/>
47+
<p>Focused on monetary propriety of Bitcoin</p>
48+
<p>Extensive control over node configuration</p>
49+
<br/>
50+
</td>
51+
<td></td>
52+
<td>
53+
<br/>
54+
<p>Most widely used implementation</p>
55+
<p>&nbsp;</p>
56+
<br/>
57+
</td>
58+
</tr>
59+
<tr>
60+
<td><a href="/settings/install-custom-bitcoin?version=latest-knots" style="width: 80%;" class="ui-button ui-widget ui-corner-all">Choose Bitcoin Knots</a></td>
61+
<td></td>
62+
<td><a href="/settings/install-custom-bitcoin?version=default" style="width: 80%;" class="ui-button ui-widget ui-corner-all">Choose Bitcoin Core</a></td>
63+
</tr>
64+
</table>
65+
66+
<br/>
67+
68+
<p><small><i>Note: This can be changed later on the settings page.</i></small></p>
69+
70+
</div>
71+
72+
<div style="height: 40px;">&nbsp;</div>
73+
{% include 'includes/footer.html' %}
74+
</body>
75+
</html>

rootfs/standard/var/www/mynode/templates/settings.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,7 @@
11091109
<option value="none" selected="selected">Choose...</option>
11101110
<option value="none">--- Recommended ---</option>
11111111
<option value="default">Default</option>
1112+
<option value="latest-knots" {% if debian_version < 12 %}disabled{% endif %}>Latest Bitcoin Knots</option>
11121113
<option value="knots_29_2" {% if debian_version < 12 %}disabled{% endif %}>Bitcoin Knots (v29.2)</option>
11131114
<option value="knots_29_1" {% if debian_version < 12 %}disabled{% endif %}>Bitcoin Knots (v29.1)</option>
11141115
<option value="none">--- Old / Not Recommended ---</option>

0 commit comments

Comments
 (0)