Merge branch 'master' of https://github.com/BitMaker-hub/NerdMiner_v2
This commit is contained in:
commit
858709679c
@ -143,9 +143,8 @@ 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 |
|
||||
| pool.sethforprivacy.com | 3333 | https://pool.sethforprivacy.com/ | Mantained by @sethforprivacy - public-pool fork |
|
||||
|
||||
|
@ -400,6 +400,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)
|
||||
{
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -136,21 +136,37 @@ bool checkValid(unsigned char* hash, unsigned char* target) {
|
||||
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;
|
||||
|
||||
unsigned long extranonce2_number = strtoul(extranonce2, NULL, 10);
|
||||
extranonce2_number++;
|
||||
b0 = rand() % 256;
|
||||
b1 = rand() % 256;
|
||||
b2 = rand() % 256;
|
||||
b3 = rand() % 256;
|
||||
|
||||
memset(extranonce2, '0', 2 * extranonce2_size);
|
||||
if (extranonce2_number > long(pow(10, 2 * extranonce2_size))) {
|
||||
return;
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
/**
|
||||
* get linear extranonce2
|
||||
*/
|
||||
void getNextExtranonce2(int extranonce2_size, char *extranonce2) {
|
||||
unsigned long extranonce2_number = strtoul(extranonce2, NULL, 10);
|
||||
|
||||
extranonce2_number++;
|
||||
|
||||
char format[] = "%00x";
|
||||
|
||||
sprintf(&format[1], "%02dx", extranonce2_size * 2);
|
||||
sprintf(extranonce2, format, extranonce2_number);
|
||||
}
|
||||
|
||||
miner_data init_miner_data(void){
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "drivers/storage/SDCard.h"
|
||||
#include "drivers/storage/nvMemory.h"
|
||||
#include "drivers/storage/storage.h"
|
||||
#include "mining.h"
|
||||
#include "timeconst.h"
|
||||
|
||||
|
||||
@ -62,6 +63,7 @@ void reset_configuration()
|
||||
{
|
||||
Serial.println("Erasing Config, restarting");
|
||||
nvMem.deleteConfig();
|
||||
resetStat();
|
||||
wm.resetSettings();
|
||||
ESP.restart();
|
||||
}
|
||||
@ -165,10 +167,9 @@ 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("PoolpasswordOptionl", "Pool password (optional)", Settings.PoolPassword, 80);
|
||||
WiFiManagerParameter password_text_box("Poolpassword - Optionl", "Pool password", Settings.PoolPassword, 80);
|
||||
|
||||
// Add all defined parameters
|
||||
wm.addParameter(&pool_text_box);
|
||||
|
Loading…
Reference in New Issue
Block a user