From b84372676aa1cba8f40a230a1642366bd4fc0c8c Mon Sep 17 00:00:00 2001 From: Lucas Campos Date: Mon, 8 Jan 2024 08:42:16 -0300 Subject: [PATCH 1/5] improvement getNextExtranonce2 and create getRandomExtranonce2 --- src/utils.cpp | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/src/utils.cpp b/src/utils.cpp index 58df0ca..20120be 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -136,21 +136,37 @@ bool checkValid(unsigned char* hash, unsigned char* target) { return valid; } +/** + * get random extranonce2 +*/ +void getRandomExtranonce2(int extranonce2_size, char *extranonce2) { + uint8_t b0, b1, b2, b3; + + b0 = rand() % 256; + b1 = rand() % 256; + b2 = rand() % 256; + b3 = rand() % 256; + + unsigned long extranonce2_number = b3 << 24 | b2 << 16 | b1 << 8 | b0; + + char format[] = "%00x"; + + sprintf(&format[1], "%02dx", extranonce2_size * 2); + sprintf(extranonce2, format, extranonce2_number); +} + +/** + * get linear extranonce2 +*/ void getNextExtranonce2(int extranonce2_size, char *extranonce2) { - unsigned long extranonce2_number = strtoul(extranonce2, NULL, 10); + extranonce2_number++; - - memset(extranonce2, '0', 2 * extranonce2_size); - if (extranonce2_number > long(pow(10, 2 * extranonce2_size))) { - return; - } - - char next_extranounce2[2 * extranonce2_size + 1]; - memset(extranonce2, '0', 2 * extranonce2_size); - ultoa(extranonce2_number, next_extranounce2, 10); - memcpy(extranonce2 + (2 * extranonce2_size) - long(log10(extranonce2_number)) - 1 , next_extranounce2, strlen(next_extranounce2)); - extranonce2[2 * extranonce2_size] = 0; + + char format[] = "%00x"; + + sprintf(&format[1], "%02dx", extranonce2_size * 2); + sprintf(extranonce2, format, extranonce2_number); } miner_data init_miner_data(void){ From 8eb1e3cc5b30b16d7363325355a11ad9c7ba4377 Mon Sep 17 00:00:00 2001 From: dwightmulcahy Date: Thu, 14 Mar 2024 14:18:35 -0500 Subject: [PATCH 2/5] zero out stats now when a reset is done --- .gitignore | 1 + src/mining.cpp | 9 ++++++++- src/mining.h | 2 ++ src/wManager.cpp | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f7eadc5..5db995f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea/ .pio .vscode .vs diff --git a/src/mining.cpp b/src/mining.cpp index f292edf..6190110 100644 --- a/src/mining.cpp +++ b/src/mining.cpp @@ -43,7 +43,7 @@ monitor_data mMonitor; bool isMinerSuscribed = false; unsigned long mLastTXtoPool = millis(); -int saveIntervals[7] = {5 * 60, 15 * 60, 30 * 60, 1 * 360, 3 * 360, 6 * 360, 12 * 360}; +int saveIntervals[8] = {1 * 60, 5 * 60, 15 * 60, 30 * 60, 1 * 360, 3 * 360, 6 * 360, 12 * 360}; int saveIntervalsSize = sizeof(saveIntervals)/sizeof(saveIntervals[0]); int currentIntervalIndex = 0; @@ -399,6 +399,13 @@ void saveStat() { nvs_set_u64(stat_handle, "upTime", upTime + (esp_timer_get_time()/1000000)); } +void resetStat() { + Serial.printf("[MONITOR] Resetting NVS stats\n"); + templates = hashes = Mhashes = totalKHashes = elapsedKHs = upTime = shares = valids = 0; + best_diff = 0.0; + saveStat(); +} + void runMonitor(void *name) { diff --git a/src/mining.h b/src/mining.h index 2eff707..a1adf14 100644 --- a/src/mining.h +++ b/src/mining.h @@ -17,6 +17,8 @@ void runStratumWorker(void *name); void runMiner(void *name); String printLocalTime(void); +void resetStat(); + typedef struct{ uint8_t bytearray_target[32]; uint8_t bytearray_pooltarget[32]; diff --git a/src/wManager.cpp b/src/wManager.cpp index 6b7e98f..5b947a6 100644 --- a/src/wManager.cpp +++ b/src/wManager.cpp @@ -13,6 +13,7 @@ #include "drivers/storage/SDCard.h" #include "drivers/storage/nvMemory.h" #include "drivers/storage/storage.h" +#include "mining.h" // Flag for saving data @@ -53,6 +54,7 @@ void reset_configuration() { Serial.println("Erasing Config, restarting"); nvMem.deleteConfig(); + resetStat(); wm.resetSettings(); ESP.restart(); } @@ -149,7 +151,7 @@ void init_WifiManager() { strcat(checkboxParams, " checked"); } - WiFiManagerParameter save_stats_to_nvs("SaveStatsToNVS", "Track Uptime, Best Diff, Total Hashes in device Flash memory. (Experimental)", "T", 2, checkboxParams, WFM_LABEL_AFTER); + WiFiManagerParameter save_stats_to_nvs("SaveStatsToNVS", "Save mining statistics to flash memory.", "T", 2, checkboxParams, WFM_LABEL_AFTER); // Text box (String) - 80 characters maximum WiFiManagerParameter password_text_box("Poolpassword - Optionl", "Pool password", Settings.PoolPassword, 80); From c4ece6a0b107ae40b744664ce3b9398724a2744b Mon Sep 17 00:00:00 2001 From: Junior 3GS <99301931+Junior3gs@users.noreply.github.com> Date: Sun, 31 Mar 2024 17:10:58 -0300 Subject: [PATCH 3/5] Update monitor.h Change the par to USDT. is correntle more liquidity price update --- src/monitor.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/monitor.h b/src/monitor.h index f835cb4..31f8450 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -12,8 +12,8 @@ //Time update period #define UPDATE_PERIOD_h 5 -//API BTC price -#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USD" +//API BTC price (Update to USDT cus it's more liquidity and flow price updade) +#define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USDT" #define UPDATE_BTC_min 1 //API Block height From f105767da7a592e7540e09992a0ff418c6bbfebf Mon Sep 17 00:00:00 2001 From: Jeremy Chabernaud Date: Wed, 22 May 2024 20:49:43 +0200 Subject: [PATCH 4/5] Remove vkbit.com pool --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 3d30a3c..c0e9809 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,6 @@ Recommended low difficulty share pools: | public-pool.io | 21496 | https://web.public-pool.io | Open Source Solo Bitcoin Mining Pool supporting open source miners | | nerdminers.org | | https://nerdminers.org | Team domain for future pool - Currently pointing to public-pool.io | | pool.nerdminer.io | 3333 | https://nerdminer.io | Mantained by CHMEX | -| pool.vkbit.com | 3333 | https://vkbit.com/ | Mantained by djerfy - public-pool fork | | pool.pyblock.xyz | 3333 | https://pool.pyblock.xyz/ | Mantained by curly60e | | pool.sethforprivacy.com | 3333 | https://pool.sethforprivacy.com/ | Mantained by @sethforprivacy - public-pool fork | From c00428553d8a47b4582e9f30b989397db0da406c Mon Sep 17 00:00:00 2001 From: Andrea Draghetti Date: Fri, 24 May 2024 01:29:28 +0200 Subject: [PATCH 5/5] Details of Pool nerdminers.org I have listed in the table the correct domain, port and also who is currently maintaining the project. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3d30a3c..bad5afd 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Recommended low difficulty share pools: | Pool URL | Port | Web URL | Status | | ----------------- | ----- | -------------------------- | ------------------------------------------------------------------ | | public-pool.io | 21496 | https://web.public-pool.io | Open Source Solo Bitcoin Mining Pool supporting open source miners | -| nerdminers.org | | https://nerdminers.org | Team domain for future pool - Currently pointing to public-pool.io | +| pool.nerdminers.org | 3333 | https://nerdminers.org | The official Nerdminer pool site - Mantained by @golden-guy | | pool.nerdminer.io | 3333 | https://nerdminer.io | Mantained by CHMEX | | pool.vkbit.com | 3333 | https://vkbit.com/ | Mantained by djerfy - public-pool fork | | pool.pyblock.xyz | 3333 | https://pool.pyblock.xyz/ | Mantained by curly60e |