Skip to content

feat: Enhance result handling and UI for found keys#124

Merged
garnizeh merged 2 commits into
mainfrom
chore/win-situation
Feb 22, 2026
Merged

feat: Enhance result handling and UI for found keys#124
garnizeh merged 2 commits into
mainfrom
chore/win-situation

Conversation

@garnizeh

Copy link
Copy Markdown
Owner

This pull request introduces a "Win Scenario" feature for EthScanner, enabling deterministic testing by ensuring workers are assigned a job where the winning Ethereum key is guaranteed to be found. The implementation includes updates to the mock API, master server logic, and database handling to support this mode, along with improvements for idempotent result recording and enhanced dashboard result visibility.

Win Scenario and Testing Improvements:

  • Added a standardized key derivation strategy and documentation explaining how the "Win Scenario" works, including mock API usage and the guaranteed winning address. (README.md)
  • Introduced the MASTER_WIN_SCENARIO configuration and logic in the master server to always allocate a job with a zero prefix and nonce range containing the winning key (0x1). (go/Makefile, go/internal/config/config.go, go/internal/server/jobs.go) [1] [2] [3] [4] [5] [6] [7]
  • Enhanced the mock API (esp-mock-api) to support a -win flag, returning a job that guarantees a match, and properly handles completion and job exhaustion. (go/cmd/esp-mock-api/main.go) [1] [2] [3] [4] [5] [6]

Database and Result Handling:

  • Made result recording idempotent by updating the InsertResult SQL to use ON CONFLICT for duplicate keys, allowing multiple workers to report the same key without error. (go/internal/database/sql/queries.sql, go/internal/database/queries.sql.go) [1] [2] [3]
  • Added SQL queries and methods to reset jobs and prefixes for the win scenario, ensuring the correct job is always available and preventing nonce exhaustion. (go/internal/database/sql/queries.sql, go/internal/database/queries.sql.go, go/internal/server/jobs.go) [1] [2] [3]

Dashboard and Monitoring Enhancements:

  • Implemented a new query and logic to provide detailed result records (including job details) for dashboard display and included these in the stats broadcast. (go/internal/database/sql/queries.sql, go/internal/database/queries.sql.go, go/internal/server/hub.go) [1] [2] [3] [4] [5]

Key Derivation Consistency:

  • Corrected the nonce encoding in the buffer to use big-endian order, ensuring consistent key construction across platforms. (esp32/include/eth_crypto.h)

Encoded references:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24]

- Added idempotent insert for results with ON CONFLICT handling in SQL.
- Introduced new SQL queries for resetting win scenarios and fetching detailed results.
- Updated server logic to handle win scenarios, ensuring proper job leasing and target address management.
- Enhanced result submission with detailed logging for failures.
- Created new UI templates for displaying found results and integrated them into existing dashboard.
- Improved data handling in the dashboard to normalize key counts and throughput values.
- Updated worker logic to correctly process and submit found results, including nonce handling.
- Adjusted tests to reflect changes in result submission and processing logic.
@garnizeh
garnizeh merged commit 2662820 into main Feb 22, 2026
1 check passed
@garnizeh
garnizeh deleted the chore/win-situation branch February 22, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant