We’ve been quiet for awhile here at Amentum, but we’ve continually been working in the background to bring new innovations either directly, or by proxy, swiftly to the now expansive Handshake community in every way we can.
The explosion in interest in this new decentralized digital namespace has been nothing short of extraordinary. We believe this is due to the community’s ethos of diversity of mind, perspective, and intellectual contribution — which is in direct alignment with the core of Amentum’s purpose. In order to continue to grow the community, we have to make it easy for new entrants to bridge their networks and economies of scale with our rapidly evolving mining economy.
Today we are introducing HandyStratum: A segwit-capable Proof of Work mining stratum server built on top of hsd (the core reference daemon/client for Handshake).
This hsd plugin will run a stratum server in the same process as a hsd fullnode, and quickly enable any existing major Bitcoin mining operation to spin up a parallel operation to start providing security to the greater Handshake network.
HandyStratum implements header generation from hsd.getBlockTemplate as well as the native mask feature which was engineered to prevent what is known as a “block-witholding attack” that is present in Bitcoin mining.
Read more about mask in detail here: ./docs/README.md
Stratum Usage
HandyStratum can be used directly as a hsd plugin.
Simply npm install handystratum
within your hsd directory and run it as:
$ hsd --plugins HandyStratum \ --stratum-host :: \ --stratum-port 3008 \ --stratum-public-host pool.example.com \ --stratum-public-port 3008 \ --stratum-max-inbound 1000 \ --stratum-difficulty 8 \ --stratum-dynamic \ --stratum-password=admin-pass --daemon
Additional notes on running/configuration can be found in ./docs/README.md and an example shell script is in ./run.sh.
Official HandyStratum: NPM Package: https://www.npmjs.com/package/handystratum
Cutting Out More Middlemen
While having a stratum+fullnode marriage violates separation of concerns, it provides a benefit to large competitive miners: because it sits in the same process, there is no overhead of hitting or long-polling a JSON-RPC API to submit or be notified of new blocks. It has direct in-memory access to all of the data it needs. No getwork or getblocktemplate required, and is one of the “cleanest” ways to produce blocks efficiently and safely for the network.
It can also broadcast submitted blocks before verifying and saving them to disk (since we created the block and know it's going to be valid ahead of time).
Single Point of Failure?
There's nothing to say you can't have multiple hsd-nodes/stratum-servers behind a reverse/failover proxy still. It's only a single point of failure if you treat it that way. Miners are adept at making their operations more efficient, and HandyStratum combined with their industry best-practices should produce a more resilient mining ecosystem for this very important piece of the decentralized web (DWeb).
Mining Payouts
Shares are currently tracked by username and will be dumped to ~/.hsd/stratum/shares/[height]-[hash].json
when a block is found. A script can parse through these later and either add the user's balance to a separate webserver, or payout directly to an address. Users are stored in a line-separated json file in ~/.hsd/stratum/users.json
.
Mining Administration
HandyStratum exposes some custom stratum calls: mining.authorize_admin('password')
to auth as an admin and mining.add_user('username', 'password')
to create a user during runtime.
Moving the Community Forward
Recently, there was a change made to hsd’s getwork in order to make it more compliant with how miners were working to add support for Handshake. This method miners were employing we believe is suboptimal, and to ensure that future entrants are utilizing the full breadth of Handshake’s technical capability, we sought to quickly release this to ensure an even playing field.
It is our hope that present and future miners utilize HandyStratum by forking it or submitting PRs to make it the ecosystem more fair, so that additional security can come online quickly as the Handshake public blockchain becomes an integral part of the emerging dWeb.
Special thanks and all the flowers go to Alex Smith, Lead Developer and computational physicist of HandyOSS, for his steadfast and unyielding dedication to ensuring Handshake mining is egalitarian and fair — which began at block #1 itself.
Currently most miners make mask as all 0, which makes it impossible to prevent "block-witholding attack" from working.