Skip to content

Conversation

@STSMiner1
Copy link
Contributor

Stratum V1 Protocol Test Tool with client.reconnect Trigger

This tool models the Stratum V1 protocol as used for SHA256-based coins (e.g., Bitcoin). It simulates a minimalist pool that demonstrates core protocol behavior, and now includes a "reconnect storm" after 5 job notifications.

Stratum V1 Protocol Test Tool with client.reconnect Trigger

This tool models the Stratum V1 protocol as used for SHA256-based coins (e.g., Bitcoin).
It simulates a minimalist pool that demonstrates core protocol behavior,
and now includes a "reconnect storm" after 5 job notifications.
@STSMiner1 STSMiner1 changed the title Add files via upload Stratum V1 Protocol Test Tool Jun 26, 2025
Copy link
Collaborator

@johnny9 johnny9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK.
My experience with tooling like this is that it is placed into a "contrib/" folder which is where dev/user optional utilities are contributed to the project. I think it would be good to move it into that folder or something similar for clarity/organization. I have some ideas for other dev tools as well that could go there (code formatting tooling for example).

The tool itself looks solid and very useful. I especially appreciate that it only uses standard python modules.

await server.serve_forever()

if __name__ == "__main__":
asyncio.run(main()) No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line at the end of the file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thoughtful feedback—makes sense.

I originally placed the script in the root to keep it visible during early development and discussion, but I agree that "contrib/" is a better long-term home for tools like this, feel free to move it there if that helps with organization.

The tool itself is a lightweight Stratum server simulator. I built it to test "mining.extranonce.subscribe" and "mining.set_extranonce" behaviors—just a basic sandbox pool stripped of unnecessary parts. Python made that easy and portable. It helps catch miner edge cases and protocol assumptions that might not show up with a typical pool setup.

Also comes in handy for testing the Bitaxe fallback mechanism.

@mutatrum mutatrum added documentation Improvements or additions to documentation unit_tests labels Jun 27, 2025
Now includes share submit validation from the miner.
# Push extranonce update if we're in Nicehash mode
if personality == "nicehash":
await asyncio.sleep(0.5)
new_extra = random_extranonce(9)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why length 9?
extranonce length would be made with *2 so 18 hex, 18 hex i believe is unsupported in stratum
i think 8 bytes ~ 16 hex is max for most pools

I think its useful to have this feature but, controlled via command line options

like --extranonce2_length x

@STSMiner1
Copy link
Contributor Author

STSMiner1 commented Jul 23, 2025

It was done as a test tool, so should not really matter with that, the tool is a passive test harness, nothing more.

Psst .... there are two version of this test tool here.

@STSMiner1 STSMiner1 closed this Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation unit_tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants