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

Add ElectrumProxy app #293

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

webwarrior-ws
Copy link
Contributor

Add ElectrumProxy - application that acts as Electrum server redirecting requests to other servers using fault-tolerant parallel client.

Implemented Electrum API methods:

  • server.version
  • server.ping
  • blockchain.headers.subscribe
  • blockchain.block.header
  • blockchain.block.headers
  • blockchain.scripthash.get_history
  • blockchain.transaction.get
  • blockchain.transaction.broadcast

Created project and solution for ElectrumProxy.
Start implementing ElectrumProxy server. Implement
"server.version" and "server.ping" methods.
Add ElectrumProxy to excludes for printf check, as it uses
.NET 6.
Implement blockchain.block.header method both in Backend
and in ElectrumProxy.
Refactoring of JSON RPC server - made it into a class.
Implement blockchain.headers.subscribe method and subscription.

Implement "blockchain.block.headers",
"blockchain.scripthash.get_history", and
"blockchain.transaction.get" methods.
In ElectrumProxy only save server stats when exiting the
application to decrease load on CPU.
Instead of chceking for duplicates in server stats when
saving, keep the collection duplicate-free at all times
by checking for existing record when updating or insterting
new server stat. This way we can avoid running de-duplication
procedure each time the stats are updated.
Implement blockchain.transaction.broadcast method in
ElectrumProxy.
Implement BitCoreNode client and use Bitcore node server
in addition to Electrum for serving
"blockchain.scripthash.get_history" requests.

Had to restrict request rate to Bitcore to be 1 at a time with
0.1 secs interval. Otherwise the server would complain about
too many requests and fail.
Cache results of "blockchain.scripthash.get_history" requests.
This will drastically reduce average rescan time since Liana
tries to rescan every 30 seconds or so but new block is added
every ~10 min.
Made timeouts an argument that is passed to server's retrieval
function. When a full round of failures has happened, timeouts
are doubled. Reduced default timeouts because now we don't need
such large margins and smaller timeouts mean unresponsive
servers will be discarded quicker.
Add client for Blockbook (API used by Trezor). Extract
RestAPIClient abstract base class that with common
functionality fo REST API clients like BlockbookClient and
BitcoreNodeClient.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant