An alternative approach for implementing the Template Provider was suggested during review.
Rather than having Bitcoin Core accept incoming network connections, deal with Noise encryption and stratum messages, an external tool would do this. This tool would get its information from the node via ZMQ and RPC:
- a new zmq publisher, e.g. -zmqpubtemplate, which publishes block templates as soon as they become available.
- a new RPC
updatetemplatepub to configure the template publisher, e.g. for setting the coinbase output data size
- a new RPC
submitsolution
The external tool should probably be part of SRI, e.g. by adding roles/template_provider.
However, in this scenario it may not make sense to have that role in the first place. It just needs to be code shared by the The Job Declarator Client and the Pool roles.
It has similar implications as the idea of making bitcoind a Job Declarator Client, discussed in stratum-mining/sv2-spec#85. Except in that scenario we had to keep the Template Provider role around because the pool needs it, whereas here that role could disappear entirely.
I could look into adding those two things in a new Bitcoin Core branch. But someone else would have to take on the SRI side.
There are a few downsides to this approach:
- It limits the number of connected stratum clients to 1, since there's only one ZMQ template feed. That's probably fine for the standard suggested workflows.
- It means users have to install two pieces of software. That's already the case, but it removes any prospect of avoiding that such as `bitcoind` as a JDC (without making it into a proxy) sv2-spec#85.
- It precludes the ability to make the template provider public facing, even with an external tool (though from the Bitcoin Core perspective, this is already very challenging to do safely)
The advantage is that it (significantly) decreases the complexity added to Bitcoin Core.
Not sure if we actually want to go this route, but we can the discuss the pros and cons here.
An alternative approach for implementing the Template Provider was suggested during review.
Rather than having Bitcoin Core accept incoming network connections, deal with Noise encryption and stratum messages, an external tool would do this. This tool would get its information from the node via ZMQ and RPC:
updatetemplatepubto configure the template publisher, e.g. for setting the coinbase output data sizesubmitsolutionThe external tool should probably be part of SRI, e.g. by adding
roles/template_provider.However, in this scenario it may not make sense to have that role in the first place. It just needs to be code shared by the The Job Declarator Client and the Pool roles.
It has similar implications as the idea of making bitcoind a Job Declarator Client, discussed in stratum-mining/sv2-spec#85. Except in that scenario we had to keep the Template Provider role around because the pool needs it, whereas here that role could disappear entirely.
I could look into adding those two things in a new Bitcoin Core branch. But someone else would have to take on the SRI side.
There are a few downsides to this approach:
The advantage is that it (significantly) decreases the complexity added to Bitcoin Core.
Not sure if we actually want to go this route, but we can the discuss the pros and cons here.