Send server.version as first message to interact with Electrumx server#504
Open
worldwideward wants to merge 1 commit into
Open
Send server.version as first message to interact with Electrumx server#504worldwideward wants to merge 1 commit into
worldwideward wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We are using bitcoinlib for our project.
I had installed up a bitcoin-core node + electrumx server, locally in regtest mode.
I had configured bitcoinlib's provider.json to connect to the electrumx server
However, when executing wallet.scan(), bitcoinlib would throw an error:
2026/04/17 17:39:18 DEBUG _provider_execute(221) Error Extra data: line 2 column 1 (char 1024) on provider bitcoin.electrumx 2026/04/17 17:39:18 ERROR __init__(40) No successful response from any serviceprovider: ['bitcoin.electrumx']The electrumx server complained:
After reading the protocol docs (https://electrumx.readthedocs.io/en/latest/protocol-methods.html#server-version) it became clear the electrumx provider in bitcoinlib wasn't sending this required message.
I could see the second message being crafted:
I realized that before sending blockcount() or other methods, the server.version message should be sent. But I wasn't completely sure how to implement this. As a last resort I shared the codebase with an AI model from Mistral, and asked for help. The result is this PR.
I am happy because now electrumx responds the way I expect it to:
Now, if there is feedback on the implementation it is certainly welcome! But hopefully this can get merged 🙂