Skip to content

Commit bdd2f0b

Browse files
committed
add datum
1 parent 4163623 commit bdd2f0b

File tree

13 files changed

+292
-0
lines changed

13 files changed

+292
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
### Datum for mynodebtc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"name": "DATUM",
3+
"short_name": "datum",
4+
"author": {
5+
"name": "OCEAN",
6+
"link": "https://ocean.xyz"
7+
},
8+
"website": {
9+
"name": "GitHub",
10+
"link": "https://github.com/OCEAN-xyz/datum_gateway"
11+
},
12+
"category": "bitcoin_app",
13+
"short_description": "Self-sovereign Bitcoin mining",
14+
"description": [
15+
"DATUM (Decentralized Alternative Templates for Universal Mining) is a brand new bitcoin mining protocol that allows you to create your own block templates using your own Bitcoin node."
16+
],
17+
"latest_version": "v0.2.2",
18+
"supported_archs": ["aarch64","x86_64"],
19+
"download_skip": true,
20+
"download_type": "source",
21+
"download_source_url": "https://github.com/OCEAN-xyz/datum_gateway/archive/refs/tags/v0.2.2beta.tar.gz",
22+
"download_binary_url": {
23+
"aarch64": "https://github.com/Retropex/datum_gateway/releases/download/v0.2.2beta/datum-0.2.2-linux-aarch64.tar.gz",
24+
"x86_64": "https://github.com/Retropex/datum_gateway/releases/download/v0.2.2beta/datum-0.2.2-linux-x86_64.tar.gz"
25+
},
26+
"install_env_vars": {},
27+
"supports_app_page": true,
28+
"supports_testnet": false,
29+
"http_port": 21000,
30+
"https_port": 21001,
31+
"requires_bitcoin": true,
32+
"requires_docker_image_installation": false,
33+
"requires_electrs": false,
34+
"requires_lightning": false,
35+
"show_on_application_page": true,
36+
"show_on_homepage": true,
37+
"show_on_status_page": true,
38+
"hide_status_icon": false,
39+
"app_tile_name": "Datum",
40+
"app_tile_running_status_text": "Running",
41+
"app_tile_button_text": "Info",
42+
"app_tile_button_href": "/app/datum/info",
43+
"app_page_show_open_button": true,
44+
"app_page_content": [
45+
{
46+
"heading": "Instructions",
47+
"content": [
48+
"Add general usage instructions here. You can open the app with the Open button on the left (if web based).",
49+
"For more custom content, update the template and python files under the 'www' folder.",
50+
"Paragraph 3",
51+
"Paragraph 4",
52+
"Enjoy!"
53+
]
54+
}
55+
],
56+
"can_uninstall": true,
57+
"can_reinstall": false,
58+
"can_enable_disable": true,
59+
"is_beta": false,
60+
"is_premium": false,
61+
"homepage_section": "apps",
62+
"homepage_order": 91,
63+
"app_type": "custom",
64+
"sdk_version": 2
65+
}
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# datum service
2+
# /etc/systemd/system/datum.service
3+
4+
[Unit]
5+
Description=datum
6+
Wants=www.service docker_images.service
7+
After=www.service docker_images.service
8+
9+
[Service]
10+
WorkingDirectory=/opt/mynode/datum
11+
12+
ExecStartPre=/usr/bin/is_not_shutting_down.sh
13+
ExecStartPre=/bin/bash -c 'if [ -f /usr/bin/service_scripts/pre_datum.sh ]; then /bin/bash /usr/bin/service_scripts/pre_datum.sh; fi'
14+
ExecStart=/opt/mynode/datum/datum_gateway -c /opt/mynode/datum/datum_config.json
15+
ExecStartPost=/bin/bash -c 'if [ -f /usr/bin/service_scripts/post_datum.sh ]; then /bin/bash /usr/bin/service_scripts/post_datum.sh; fi'
16+
#ExecStop=FILL_IN_EXECSTOP_AND_UNCOMMENT_IF_NEEDED
17+
18+
User=bitcoin
19+
Group=bitcoin
20+
Type=simple
21+
TimeoutSec=120
22+
Restart=always
23+
RestartSec=60
24+
StandardOutput=syslog
25+
StandardError=syslog
26+
SyslogIdentifier=datum
27+
28+
LimitNOFILE=4096
29+
30+
[Install]
31+
WantedBy=multi-user.target
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
server {
2+
listen 21001 ssl;
3+
server_name datum;
4+
5+
include /etc/nginx/mynode/mynode_ssl_params.conf;
6+
include /etc/nginx/mynode/mynode_ssl_cert_key.conf;
7+
8+
access_log /var/log/nginx/access_datum.log;
9+
error_log /var/log/nginx/error_datum.log;
10+
11+
location / {
12+
proxy_pass http://127.0.0.1:21000;
13+
14+
include /etc/nginx/mynode/mynode_ssl_proxy_params.conf;
15+
}
16+
17+
}
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
source /usr/share/mynode/mynode_device_info.sh
4+
source /usr/share/mynode/mynode_app_versions.sh
5+
6+
set -x
7+
set -e
8+
9+
echo \"==================== INSTALLING APP ====================\"
10+
11+
# export bitcoin password
12+
BTCPSW=$(cat /mnt/hdd/mynode/settings/.btcrpcpw)
13+
14+
# git clone datum repo
15+
git clone https://github.com/OCEAN-xyz/datum_gateway.git .
16+
17+
# verify datum
18+
curl -L "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1a3e761f19d2cc7785c5502ea291a2c45d0c504a" | gpg --import
19+
git verify-tag v0.2.2beta
20+
21+
# build datum
22+
cmake . && make
23+
24+
# install datum
25+
touch /opt/mynode/datum/datum_config.json
26+
echo "{
27+
\"bitcoind\": {
28+
\"rpcuser\": \"mynode\",
29+
\"rpcpassword\": \"auto-config\",
30+
\"rpcurl\": \"127.0.0.1:8332\",
31+
\"work_update_seconds\": 40
32+
},
33+
\"api\": {
34+
\"listen_port\": 21000
35+
},
36+
\"mining\": {
37+
\"pool_address\": \"enter your bitcoin address if you solo mine\",
38+
\"coinbase_tag_primary\": \"DATUM on mynode\",
39+
\"coinbase_tag_secondary\": \"DATUM on mynode\",
40+
\"coinbase_unique_id\": 120
41+
},
42+
\"stratum\": {
43+
\"listen_port\": 23334,
44+
\"max_clients_per_thread\": 1000,
45+
\"max_threads\": 8,
46+
\"max_clients\": 2048,
47+
\"vardiff_min\": 16384,
48+
\"vardiff_target_shares_min\": 8,
49+
\"vardiff_quickdiff_count\": 8,
50+
\"vardiff_quickdiff_delta\": 8,
51+
\"share_stale_seconds\": 120,
52+
\"fingerprint_miners\": true
53+
},
54+
\"logger\": {
55+
\"log_level_console\": 2
56+
},
57+
\"datum\": {
58+
\"pool_host\": \"datum-beta1.mine.ocean.xyz\",
59+
\"pool_port\": 28915,
60+
\"pool_pubkey\": \"f21f2f0ef0aa1970468f22bad9bb7f4535146f8e4a8f646bebc93da3d89b1406f40d032f09a417d94dc068055df654937922d2c89522e3e8f6f0e649de473003\",
61+
\"pool_pass_workers\": true,
62+
\"pool_pass_full_users\": true,
63+
\"always_pay_self\": true,
64+
\"pooled_mining_only\": true
65+
}
66+
}
67+
" >> /opt/mynode/datum/datum_config.json
68+
69+
jq --arg BTCPSW "$BTCPSW" '.bitcoind.rpcpassword = $BTCPSW' /opt/mynode/datum/datum_config.json > /opt/mynode/datum/datum_config.json.tmp && mv /opt/mynode/datum/datum_config.json.tmp /opt/mynode/datum/datum_config.json
70+
71+
72+
echo \"================== DONE INSTALLING APP =================\"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
# This will run after launching the application
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
# This will run prior to launching the application
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
source /usr/share/mynode/mynode_device_info.sh
4+
source /usr/share/mynode/mynode_app_versions.sh
5+
6+
echo "==================== UNINSTALLING APP ===================="
7+
8+
rm -rf /opt/mynode/datum/
9+
rm -rf /mnt/hdd/mynode/datum/
10+
11+
echo "================== DONE UNINSTALLING APP ================="
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from flask import Blueprint, render_template, redirect
2+
from user_management import check_logged_in
3+
from enable_disable_functions import *
4+
from device_info import *
5+
from application_info import *
6+
from systemctl_info import *
7+
import subprocess
8+
import os
9+
10+
11+
mynode_datum = Blueprint('mynode_datum',__name__)
12+
13+
14+
### Page functions (have prefix /app/<app name/)
15+
@mynode_datum.route("/info")
16+
def datum_page():
17+
check_logged_in()
18+
19+
app = get_application("datum")
20+
app_status = get_application_status("datum")
21+
app_status_color = get_application_status_color("datum")
22+
23+
# Load page
24+
templateData = {
25+
"title": "myNode - " + app["name"],
26+
"ui_settings": read_ui_settings(),
27+
"app_status": app_status,
28+
"app_status_color": app_status_color,
29+
"app": app
30+
}
31+
return render_template('/app/generic_app.html', **templateData)
32+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Custom Jinja templates (HTML files) can be added here for unique application pages
2+
3+
Templates will be available under applications/<short_name>/xyz.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!DOCTYPE html lang="en">
2+
<head>
3+
<title>{{ title }}</title>
4+
{% include 'includes/head.html' %}
5+
</head>
6+
<body>
7+
{% include 'includes/logo_header.html' %}
8+
<div class="mynode_top_left_div">
9+
<a href="/"><img class="mynode_nav_icon" src="{{ url_for('static', filename="images/home.png")}}"/></a>
10+
</div>
11+
12+
<div class="main_header">{{app.name}} (custom page - remove)</div>
13+
<br/>
14+
15+
<div class="app_tile_row">
16+
<div class="info_tile">
17+
<div class="info_tile_header">Status</div>
18+
<div class="info_tile_contents">
19+
<table class="info_table">
20+
<tr>
21+
<th>Status</th>
22+
<td>{{app_status}}</td>
23+
</tr>
24+
<tr>
25+
<th>Actions</th>
26+
<td>
27+
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="#">Open</a>
28+
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="#">Button A</a>
29+
<a class="ui-button ui-widget ui-corner-all mynode_button_small" style="width: 100px;" href="#">Button B</a>
30+
</td>
31+
</tr>
32+
</table>
33+
</div>
34+
</div>
35+
</div>
36+
37+
38+
<div class="instructions">
39+
<div class="instructions-header">Instructions</div>
40+
<ol class="instructions-steps">
41+
<li>Custom instructions?</li>
42+
</ol>
43+
</div>
44+
45+
<div id="confirm-dialog"></div>
46+
47+
<div id="loading_spinner_overlay" class="loading_spinner_overlay" style="display:none;">
48+
<img id="loading_spinner" class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
49+
<br/>
50+
<span id="loading_spinner_message">Loading...</span>
51+
</div>
52+
53+
</body>
54+
</html>

0 commit comments

Comments
 (0)