This commit is contained in:
BitMaker 2024-05-25 22:55:37 +02:00
commit 858709679c
6 changed files with 44 additions and 19 deletions

View File

@ -143,9 +143,8 @@ Recommended low difficulty share pools:
| Pool URL | Port | Web URL | Status | | 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 | | 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.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.pyblock.xyz | 3333 | https://pool.pyblock.xyz/ | Mantained by curly60e |
| pool.sethforprivacy.com | 3333 | https://pool.sethforprivacy.com/ | Mantained by @sethforprivacy - public-pool fork | | pool.sethforprivacy.com | 3333 | https://pool.sethforprivacy.com/ | Mantained by @sethforprivacy - public-pool fork |

View File

@ -400,6 +400,13 @@ void saveStat() {
nvs_set_u64(stat_handle, "upTime", upTime + (esp_timer_get_time()/1000000)); 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) void runMonitor(void *name)
{ {

View File

@ -17,6 +17,8 @@ void runStratumWorker(void *name);
void runMiner(void *name); void runMiner(void *name);
String printLocalTime(void); String printLocalTime(void);
void resetStat();
typedef struct{ typedef struct{
uint8_t bytearray_target[32]; uint8_t bytearray_target[32];
uint8_t bytearray_pooltarget[32]; uint8_t bytearray_pooltarget[32];

View File

@ -12,8 +12,8 @@
//Time update period //Time update period
#define UPDATE_PERIOD_h 5 #define UPDATE_PERIOD_h 5
//API BTC price //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-USD" #define getBTCAPI "https://api.blockchain.com/v3/exchange/tickers/BTC-USDT"
#define UPDATE_BTC_min 1 #define UPDATE_BTC_min 1
//API Block height //API Block height

View File

@ -136,21 +136,37 @@ bool checkValid(unsigned char* hash, unsigned char* target) {
return valid; return valid;
} }
void getNextExtranonce2(int extranonce2_size, char *extranonce2) { /**
* 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); unsigned long extranonce2_number = strtoul(extranonce2, NULL, 10);
extranonce2_number++; extranonce2_number++;
memset(extranonce2, '0', 2 * extranonce2_size); char format[] = "%00x";
if (extranonce2_number > long(pow(10, 2 * extranonce2_size))) {
return;
}
char next_extranounce2[2 * extranonce2_size + 1]; sprintf(&format[1], "%02dx", extranonce2_size * 2);
memset(extranonce2, '0', 2 * extranonce2_size); sprintf(extranonce2, format, extranonce2_number);
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;
} }
miner_data init_miner_data(void){ miner_data init_miner_data(void){

View File

@ -13,6 +13,7 @@
#include "drivers/storage/SDCard.h" #include "drivers/storage/SDCard.h"
#include "drivers/storage/nvMemory.h" #include "drivers/storage/nvMemory.h"
#include "drivers/storage/storage.h" #include "drivers/storage/storage.h"
#include "mining.h"
#include "timeconst.h" #include "timeconst.h"
@ -62,6 +63,7 @@ void reset_configuration()
{ {
Serial.println("Erasing Config, restarting"); Serial.println("Erasing Config, restarting");
nvMem.deleteConfig(); nvMem.deleteConfig();
resetStat();
wm.resetSettings(); wm.resetSettings();
ESP.restart(); ESP.restart();
} }
@ -165,10 +167,9 @@ void init_WifiManager()
{ {
strcat(checkboxParams, " checked"); 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 // Text box (String) - 80 characters maximum
WiFiManagerParameter password_text_box("PoolpasswordOptionl", "Pool password (optional)", Settings.PoolPassword, 80); WiFiManagerParameter password_text_box("Poolpassword - Optionl", "Pool password", Settings.PoolPassword, 80);
// Add all defined parameters // Add all defined parameters
wm.addParameter(&pool_text_box); wm.addParameter(&pool_text_box);