upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/main/stratum_proxy.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2026-05-19 04:07:16 +0530
committerYour Name <you@example.com>2026-05-19 04:07:16 +0530
commitc75230e551a778408b2e370b208aff76b74c6560 (patch)
tree0cf51ecae1c469b7e10272d44b37f69ff4cb611f /main/stratum_proxy.h
parentabee221b0f0e5a4513ab126afbdfddc2728df6be (diff)
feat(mining): add new mining source files and unit tests
- mining_payment.c/h: hashprice calc, share validation, per-client hashrate - stratum_client.c/h: SV1 upstream pool connection - stratum_proxy.c/h: local SV1 TCP server for downstream miners - sw_miner.c/h: software SHA256d miner using mbedtls - asic_miner.c/h: ASIC detection stub (software fallback) - test_mining_payment.c: 23 unit tests for mining payment module
Diffstat (limited to 'main/stratum_proxy.h')
-rw-r--r--main/stratum_proxy.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/main/stratum_proxy.h b/main/stratum_proxy.h
new file mode 100644
index 0000000..b940640
--- /dev/null
+++ b/main/stratum_proxy.h
@@ -0,0 +1,39 @@
1#ifndef STRATUM_PROXY_H
2#define STRATUM_PROXY_H
3
4#include "esp_err.h"
5#include <stdint.h>
6#include <stdbool.h>
7
8#define STRATUM_MAX_JOB_ID_LEN 32
9#define STRATUM_MAX_JOBS 4
10
11typedef struct {
12 uint32_t job_id;
13 uint8_t prevhash[32];
14 uint8_t merkle_root[32];
15 uint32_t ntime;
16 uint32_t nbits;
17 uint32_t version;
18 uint8_t target[32];
19 int target_len;
20 bool valid;
21} stratum_job_t;
22
23typedef struct {
24 double hashrate_ghs;
25 uint32_t nbits;
26 uint64_t total_shares;
27 uint64_t total_accepted;
28 uint64_t total_rejected;
29 double current_hashprice;
30 int active_miners;
31} stratum_proxy_stats_t;
32
33esp_err_t stratum_proxy_init(uint16_t port);
34void stratum_proxy_set_job(const stratum_job_t *job);
35const stratum_job_t *stratum_proxy_get_current_job(void);
36void stratum_proxy_get_stats(stratum_proxy_stats_t *stats);
37void stratum_proxy_stop(void);
38
39#endif