Skip to content
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

BIP40: Stratum wire protocol #1557

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft

Conversation

ben221199
Copy link

The Stratum wire protocol has a long history since @slush0 introduced it. However, the protocol never got standardized in a formal way, so many implementations have been based on incomplete documents or on other implementations. With this document I finally want to give Stratum its place between the other BIPs, so that developers can just read this document and don't have to search through years of code or dead pages that need to be revived with Wayback Machine.

@ben221199 ben221199 marked this pull request as draft March 7, 2024 15:46
@ben221199
Copy link
Author

Yesterday, I sent two registration requests to IANA to get some information officially egistered. The registries are:

Today, I got a response that for both registrations some things have to be done first, before IANA can add these records to their registry. In case of the Media Types, this is process is a little bit more difficult. For the WebSocket Subprotocol Name Registry it is just letting them know when this pull request is merged and I have a permalink to the specification.

Also, it is possible that I will send more registration requests for other IANA registries too. For example, the Service Name and Transport Protocol Port Number Registry (https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml) is a possible candidate. In that case, I will post new comments about that too.

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Some editorial feedback.

bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
@jonatack
Copy link
Member

jonatack commented May 6, 2024

This BIP refers to BIP41, The Stratum mining protocol, for which a BIP number was assigned and an entry exists in the README, but there doesn't seem to be pull request to add the BIP draft -- any update on that?

@ben221199
Copy link
Author

Hi @jonatack, thank you for feedback. I will take a look at it. I didn't have time to work on BIP 40 lately. Yes, both BIP 40 and BIP 41 are already assigned by the README and BIP 41 is also mentioned in this BIP 40. The goal is to finish BIP 40 (Stratum wire protocol) first and then start working on BIP 41 (Stratum mining protocol), referring back to BIP 40, because the mining protocol is based on the wire protocol.

Signed-off-by: Ben van Hartingsveldt <[email protected]>
@ben221199
Copy link
Author

The media type application/stratum has been registered by IANA at Media Types (https://www.iana.org/assignments/media-types/media-types.xhtml).

Copy link
Member

@jonatack jonatack left a comment

Choose a reason for hiding this comment

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

Thanks for updating. Took a look at the new additions.

bip-0040.mediawiki Show resolved Hide resolved
bip-0040.mediawiki Show resolved Hide resolved
bip-0040.mediawiki Show resolved Hide resolved
bip-0040.mediawiki Show resolved Hide resolved
bip-0040/service-example.mediawiki Outdated Show resolved Hide resolved
bip-0040/service-example.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Outdated Show resolved Hide resolved
bip-0040.mediawiki Show resolved Hide resolved
@jonatack
Copy link
Member

@ben221199 This draft might be missing the following:

- [ ] Backwards compatibility section describing incompatibilities, severity, and suggest mitigations
- [ ] Reference implementation (necessary before status "Final", but not necessary to be accepted)

@ben221199
Copy link
Author

Where should I place that?

@jonatack jonatack changed the title Add draft of BIP 40 BIP40: Stratum wire protocol May 21, 2024
@jonatack
Copy link
Member

Where should I place that?

They are generally the last two sections in other BIPs.

@murchandamus murchandamus added the PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author label May 31, 2024
@plebhash
Copy link

plebhash commented Jun 16, 2024

It seems BIP41 doesn't have any PR yet, so I'll write a comment on this one.

My goal is to inform BIP41 authors (@ben221199 or whoever else volunteers) that the Stratum Reference Implementation community is aiming for a similar effort for Stratum V2

@ben221199
Copy link
Author

Hi @plebhash, thanks for commenting. You are correct that there is no BIP 41 pull request yet. This is because BIP 41 is an implementation of BIP 40 specifically for mining. I will start working on that one when BIP 40 is finished.

As far as I'm aware, Stratum V2 is specifically for mining. When people want to make improvements on Stratum V1, I think that is solely a BIP 41 improvement, because BIP 40 only describes the wire protocol (the basics) and the Electrum implementation, not the mining one.

I think there are some things that could be done:

  • Create a BIP for Stratum V2.
  • Make a decision if you want to create a new BIP for the V1 improvements, or if you want those improvements merged into BIP 41.

Also, can you give me some examples on what those improvments could be?

Thanks

@plebhash
Copy link

plebhash commented Jun 18, 2024

Create a BIP for Stratum V2.

that is an interesting idea!

@plebhash
Copy link

@ben221199 on the context of BIP40, could you provide some wayback machine link for the original (non-mining) stratum wire protocol?

this is a very interesting unknown fact in the mining community, and everyone I tell about this is surprised about this historical fact

@Davidson-Souza
Copy link

Hi @ben221199. Thank you for taking time to document the stratum protocol. However, I have some comments about your description of the electrum flavor of stratum. I'm not sure some of the specified endpoints are actually part of their protocol, for example: blockchain.address is long deprecated in favor of blockchain.scripthash. They also don't have any method to get a full block.

Here is a doc of the latest protocol and all methods they currently support.

@ben221199
Copy link
Author

Hi @plebhash, the second message on https://bitcointalk.org/?topic=557866 is one of the source I have used. There are some other sources too, but I think this is the most important one.

@ben221199
Copy link
Author

Hi @Davidson-Souza, Stratum is invented by @slush0 especially for Electrum. Stratum wouldn't be here without Electrum and Electrum would possibly not have been a success without Stratum. I think it is okay to have Electrum commands specified next to the more general commands like discovery.

I'm aware of the fact that blockchain.address has been deprecated by blockchain.scripthash. However, the Electrum commands specify also a versioning system (where Stratum itself does not), so I think it is also good to have every version documented. Technically, it is possible to write a client and/or server that implements the Stratum protocol with Electrum commands and support multiple protocol versions. Removing deprecated commands seems to be a bad practice in my eyes.

@Davidson-Souza
Copy link

Hi @Davidson-Souza, Stratum is invented by @slush0 especially for Electrum. Stratum wouldn't be here without Electrum and Electrum would possibly not have been a success without Stratum. I think it is okay to have Electrum commands specified next to the more general commands like discovery.

I'm aware of the fact that blockchain.address has been deprecated by blockchain.scripthash. However, the Electrum commands specify also a versioning system (where Stratum itself does not), so I think it is also good to have every version documented. Technically, it is possible to write a client and/or server that implements the Stratum protocol with Electrum commands and support multiple protocol versions. Removing deprecated commands seems to be a bad practice in my eyes.

Hi, thank you for your reply. I do agree with the general direction you propose, I was a bit confused that this is not clear in the text. My understanding after reading it is that it defines the currently used commands by wallets and servers, but this is not the case.

@ben221199
Copy link
Author

@Davidson-Souza If you see improvements in text, don't hesitate to give suggestions. GitHub makes it possible to make comments on code lines. 😄

@ben221199
Copy link
Author

Okay, I have to pick up this task again.

@ben221199
Copy link
Author

Some information about old commits...

Oldest commits with same server code:

Server code removed from client repository:

First appearance of Stratum in Electrum source code:

All commits where protocol versions changed:

@ben221199
Copy link
Author

And for the ElectrumX server...

Protocol Minimum:

Protocol Maximum:

@murchandamus
Copy link
Contributor

murchandamus commented Nov 26, 2024

Hey @ben221199, this proposal has been emitting a lot of notifications recently without actually requiring editor input. I’m going to temporarily unsubscribe from this pull request while the document is taking shape. Please feel free to mention my handle when it is ready for an editor review. In the future, please consider opening early drafts of proposals against a personal fork of the BIPs repository instead of against the main BIPs repository.

@ben221199
Copy link
Author

Hey, @murchandamus. Thank you for letting me know. I will mention you when the draft is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New BIP PR Author action required Needs updates, has unaddressed review comments, or is otherwise waiting for PR author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants