-
Notifications
You must be signed in to change notification settings - Fork 307
Stratum V1 Protocol Test Tool #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stratum V1 Protocol Test Tool #1071
Conversation
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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) |
There was a problem hiding this comment.
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
|
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. |
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.