22 Commits

Author SHA1 Message Date
zxq9 c6ab147d97 Move to gmhive_client-0.9.3 2025-10-25 17:28:45 +09:00
zxq9 c421ee1785 Update gmhive_client 2025-10-25 09:31:01 +09:00
zxq9 a5dea54919 usort additional keys list 2025-10-15 21:01:25 +09:00
zxq9 159d522522 Deps update + patch verup 2025-10-15 20:56:35 +09:00
zxq9 97c546610d Verup deps, and start listening for gproc messages at startup 2025-10-15 15:52:46 +09:00
zxq9 cb1d879b99 Handle whitespace around account ID 2025-10-14 21:55:04 +09:00
zxq9 66a06480d5 Merge pull request 'Match on more messages, verup dependencies/' (#11) from deps-0.3.1 into master
Reviewed-on: #11
Reviewed-by: Jarvis Carroll <jarviscarrol@qpq.swiss>
2025-09-24 15:46:18 +09:00
zxq9 33d6edaa42 Updating gmhive_client one more time... 2025-09-24 15:45:41 +09:00
zxq9 86ac9be07d Match on more messages, verup dependencies/ 2025-09-23 19:24:57 +09:00
zxq9 9b88ac7a90 Add autostart argument 2025-08-14 11:11:00 +09:00
zxq9 ff538018c5 verup 2025-08-14 10:47:51 +09:00
zxq9 56be96c4f3 Update system arch discovery method 2025-08-14 10:41:52 +09:00
zxq9 5e3e8c9eae Make version update stick 2025-08-12 09:54:47 +09:00
zxq9 ecf597eed2 Update cuckoo_cpu dep 2025-08-12 09:48:31 +09:00
zxq9 0ec8109684 Merge pull request 'Fix mac path' (#9) from mac-path into master
Reviewed-on: #9
2025-08-12 08:22:18 +09:00
zxq9 ca0d48b498 Fix mac path 2025-08-12 08:17:08 +09:00
zxq9 7eaacaddce Patch fix to make Windows use generic until we fix AVX2 2025-08-11 17:43:08 +09:00
zxq9 be63fe141b Merge pull request 'naive-arch2' (#8) from naive-arch2 into master
Reviewed-on: #8
Reviewed-by: Jarvis Carroll <jarviscarrol@qpq.swiss>
2025-08-11 15:18:03 +09:00
zxq9 06907a6c8b Update deps 2025-08-11 14:44:10 +09:00
zxq9 7feea1421b make init more robust 2025-08-11 14:34:51 +09:00
zxq9 5d4fd6a2ab Merge pull request 'Add Mac arch detection (relatively naive)' (#7) from naive-arch2 into master
Reviewed-on: #7
Reviewed-by: Jarvis Carroll <jarviscarrol@qpq.swiss>
2025-08-11 12:19:21 +09:00
zxq9 35842b8ac7 Add Mac arch detection (relatively naive) 2025-08-08 13:00:00 +09:00
7 changed files with 95 additions and 40 deletions
+1 -1
View File
@@ -3,6 +3,6 @@
{registered,[]},
{included_applications,[]},
{applications,[stdlib,kernel]},
{vsn,"0.2.5"},
{vsn,"0.3.6"},
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
{mod,{gajumine,[]}}]}.
+2 -1
View File
@@ -3,7 +3,7 @@
%%% @end
-module(gajumine).
-vsn("0.2.5").
-vsn("0.3.6").
-behavior(application).
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
@@ -29,6 +29,7 @@ start(normal, _Args) ->
{ok, _} = application:ensure_all_started(ssl),
ok = application:ensure_started(hakuzaru),
ok = application:ensure_started(zxwidgets),
ok = application:ensure_started(gproc),
gmc_sup:start_link().
+33 -8
View File
@@ -3,7 +3,7 @@
%%% @end
-module(gmc_con).
-vsn("0.2.5").
-vsn("0.3.6").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later").
@@ -101,16 +101,28 @@ start_link() ->
init(none) ->
ok = log(info, "Starting"),
{AProcs, AMem} = proc_mem(),
TwoMaps = default_spec(mem) * 2,
RProcs =
case AProcs >= 2 of
true -> 2;
false -> 1
end,
RMem =
case AMem >= TwoMaps of
true -> TwoMaps;
false -> default_spec(mem)
end,
{Acc, Keys, Network, MaxCores, MaxMem} =
case read_conf() of
{ok, C} ->
{maps:get(account, C, none),
maps:get(keys, C, []),
maps:get(network, C, <<"mainnet">>),
maps:get(max_cores, C, 2),
maps:get(max_mem, C, 3550722201)};
maps:get(max_cores, C, RProcs),
maps:get(max_mem, C, RMem)};
none ->
{none, [], <<"mainnet">>, 2, 3550722201}
{none, [], <<"mainnet">>, RProcs, RMem}
end,
State = #s{network = Network, acc = Acc, keys = Keys, max_cores = MaxCores, max_mem = MaxMem},
{ok, start_gui(State)}.
@@ -124,6 +136,11 @@ start_gui(State = #s{acc = none}) ->
start_gui(State = #s{acc = AccID}) ->
Window = gmc_gui:start_link(#{}),
ok = gmc_gui:set_account(AccID),
ok =
case lists:member("autostart", zx_daemon:argv()) of
false -> ok;
true -> gmc_gui:start_stop()
end,
State#s{window = Window}.
@@ -217,7 +234,8 @@ do_start_stop(#s{acc = PubKey, keys = Keys, network = Network, max_cores = MaxCo
% Check avx2.
% Both should be provided by the F# start program
case Network of
<<"mainnet">> -> {"mean", "avx2.exe"};
% <<"mainnet">> -> {"mean", "avx2.exe"};
<<"mainnet">> -> {"mean", "generic.exe"};
<<"testnet">> -> {"mean", "generic.exe"}
end
end,
@@ -252,7 +270,7 @@ optimize_count(MaxC, MaxM) ->
MaxMem = max(MapSize, MaxM),
{Procs, Memory} = proc_mem(),
MeanMaps = min(MaxMem, Memory) div MapSize,
Recommended = min(MaxCores, max(min(Procs, MeanMaps) - 1, 1)),
Recommended = min(MaxCores, min(Procs, MeanMaps)),
Notice = fun(F, A) -> gmc_gui:message({notice, io_lib:format(F, A)}) end,
ok = Notice("Physical Processors: ~p", [Procs]),
ok = Notice("Physical Memory: ~p", [Memory]),
@@ -270,8 +288,15 @@ platform_dir() ->
{unix, linux} ->
"linux_x86_64";
{unix, darwin} ->
% TODO: Check M2 vs x86
"mac_m2";
case string:trim(os:cmd("uname -m")) of
"arm64" ->
"mac_arm64";
"x86_64" ->
"mac_x86_64";
Other ->
ok = log(info, "uname -m: ~p", [Other]),
"mac_x86_64"
end;
{win32, nt} ->
"win_x86_64"
end,
+19 -19
View File
@@ -3,7 +3,7 @@
%%% @end
-module(gmc_conf).
-vsn("0.2.5").
-vsn("0.3.6").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later").
@@ -18,15 +18,15 @@
-record(s,
{wx = none :: none | wx:wx_object(),
frame = none :: none | wx:wx_object(),
lang = en :: en | jp,
j = none :: none | fun(),
net = none :: none | wx:wx_object(),
acc = none :: none | wx:wx_object(),
keys = none :: none | wx:wx_object(),
cores = none :: none | wx:wx_object(),
memory = none :: none | wx:wx_object()}).
{wx = none :: none | wx:wx_object(),
frame = none :: none | wx:wx_object(),
lang = en :: en | jp,
j = none :: none | fun(),
net = none :: none | wx:wx_object(),
acc = none :: none | wx:wx_object(),
keys = none :: none | wx:wx_object(),
cores = 2 :: pos_integer(),
memory = 3550722201 :: pos_integer()}).
@@ -97,9 +97,9 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
ok = wxFrame:center(Frame),
true = wxFrame:show(Frame),
State =
#s{wx = WX, frame = Frame,
lang = Lang, j = J,
net = Network, acc = AccTx, keys = KeysTx,
#s{wx = WX, frame = Frame,
lang = Lang, j = J,
net = Network, acc = AccTx, keys = KeysTx,
cores = CoresTx, memory = MemoryTx},
{Frame, State}.
@@ -205,7 +205,7 @@ done(State = #s{net = Network, acc = AccTx, keys = KeysTx, cores = CoresTx, memo
1 -> <<"testnet">>;
_ -> <<"mainnet">>
end,
AccID = wxTextCtrl:getValue(AccTx),
AccID = string:trim(wxTextCtrl:getValue(AccTx)),
MOAR_IDs = wxTextCtrl:getValue(KeysTx),
CoreS = wxTextCtrl:getValue(CoresTx),
GigsS = wxTextCtrl:getValue(MemTx),
@@ -213,16 +213,16 @@ done(State = #s{net = Network, acc = AccTx, keys = KeysTx, cores = CoresTx, memo
buh_bye(State).
cores("") ->
none;
2;
cores(CoreS) ->
try
list_to_integer(CoreS)
catch
_:_ -> none
_:_ -> 2
end.
bytes("") ->
none;
3550722201;
bytes(GigsS) ->
try
list_to_integer(GigsS) * gig()
@@ -231,14 +231,14 @@ bytes(GigsS) ->
try
trunc(list_to_float(GigsS) * gig())
catch
_:_ -> none
_:_ -> 3550722201
end
end.
% NOTE: 32 is space, 12288 is full-width space.
binify_keys(MOAR) ->
[list_to_binary(K) || K <- string:lexemes(MOAR, [$\r, $\n, 32, 12288, $\t, $,, $;])].
lists:usort([list_to_binary(K) || K <- string:lexemes(MOAR, [$\r, $\n, 32, 12288, $\t, $,, $;])]).
acc(none) -> "";
+32 -3
View File
@@ -3,14 +3,14 @@
%%% @end
-module(gmc_gui).
-vsn("0.2.5").
-vsn("0.3.6").
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later").
-behavior(wx_object).
-include_lib("wx/include/wx.hrl").
-export([ask_conf/0, set_account/1, difficulty/1, speed/1, candidate/1, message/1]).
-export([ask_conf/0, set_account/1, difficulty/1, speed/1, candidate/1, message/1, start_stop/0]).
-export([start_link/1]).
-export([init/1, terminate/2, code_change/3,
handle_call/3, handle_cast/2, handle_info/2, handle_event/2]).
@@ -79,6 +79,10 @@ message(Terms) ->
wx_object:cast(?MODULE, {message, Terms}).
start_stop() ->
wx_object:cast(?MODULE, start_stop).
%%% Startup Functions
@@ -187,6 +191,9 @@ handle_cast({candidate, Block}, State) ->
handle_cast({message, Terms}, State) ->
NewState = do_message(Terms, State),
{noreply, NewState};
handle_cast(start_stop, State) ->
NewState = start_stop(State),
{noreply, NewState};
handle_cast(Unexpected, State) ->
ok = log(warning, "Unexpected cast: ~tp~n", [Unexpected]),
{noreply, State}.
@@ -277,7 +284,7 @@ do_message({pool_notification, #{info := #{msg := MSG}}}, State = #s{height = He
ok = wxStaticText:setLabel(CandT, Candidate),
State;
#{solution_accepted := #{seq := Seq}} ->
Entry = io_lib:format("~nSolution Accepted! You solved one! Sequence: ~w", [Seq]),
Entry = io_lib:format("~nThe hive has produced a solution! Sequence: ~w", [Seq]),
do_message2(Entry, State);
Other ->
Entry = io_lib:format("~nUnexpected 'pool_notification': ~tp", [Other]),
@@ -289,6 +296,28 @@ do_message({connected, _}, State) ->
do_message({disconnected, _}, State) ->
Entry = "\nDisconnected!",
do_message2(Entry, State);
do_message({error, #{info := #{info := #{error := get_failed, data := {error, #{code := 404}}, url := URL}}}}, State) ->
ID =
case uri_string:parse(URL) of
#{path := Path} ->
lists:last(string:split(Path, "/", trailing));
{error, Reason, Info} ->
ok = log(warning, "uri_string:parse/1 failed with: ~p: ~p", [Reason, Info]),
"UNKNOWN"
end,
Format =
"\nLookup for mining ID ~s failed."
"\nCheck that you have joined the hive and have your account ID configured correctly.",
Entry = io_lib:format(Format, [ID]),
do_message2(Entry, State);
do_message({error, #{info := #{info := #{error := get_failed, data := {error, #{code := 443}}}}}}, State) ->
Entry =
"\nThis system is not providing the needed TLS CA Certificate."
"\nlease contact the support community and let them know you have a 443 error with GajuMine.",
do_message2(Entry, State);
do_message({error, #{info := #{info := #{error := connect_failure, data := {error, failed}}, module := gmhc_eureka}}}, State) ->
Entry = "\nConnection terminated. Retrying.",
do_message2(Entry, State);
do_message(Terms, State) ->
tell(info, "~p", [Terms]),
Entry = io_lib:format("~n~tp", [Terms]),
+1 -1
View File
@@ -12,7 +12,7 @@
%%% @end
-module(gmc_sup).
-vsn("0.2.5").
-vsn("0.3.6").
-behaviour(supervisor).
-author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>").
+7 -7
View File
@@ -2,16 +2,16 @@
{type,gui}.
{modules,[]}.
{prefix,"gmc"}.
{author,"Craig Everett"}.
{desc,"Mining client for the Gajumaru Root"}.
{package_id,{"qpq","gajumine",{0,2,5}}}.
{deps,[{"uwiger","gmhive_client",{0,4,4}},
{"uwiger","gmcuckoo",{1,2,3}},
{"qpq","cuckoo_cpu",{0,3,0}},
{"uwiger","gmhive_worker",{0,3,0}},
{author,"Craig Everett"}.
{package_id,{"qpq","gajumine",{0,3,6}}}.
{deps,[{"uwiger","gmhive_client",{0,9,3}},
{"uwiger","gmhive_protocol",{0,2,0}},
{"uwiger","gmcuckoo",{1,2,4}},
{"uwiger","gmhive_worker",{0,5,1}},
{"qpq","cuckoo_cpu",{0,3,2}},
{"uwiger","gmconfig",{0,1,2}},
{"uwiger","gproc",{1,0,1}},
{"uwiger","gmhive_protocol",{0,1,1}},
{"uwiger","enoise",{1,3,0}},
{"uwiger","setup",{2,2,4}},
{"otpr","hakuzaru",{0,6,1}},