Bitcoin Forum
October 14, 2025, 04:32:16 PM *
News: Latest Bitcoin Core release: 30.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: ElectrumKit - A native Swift library for Electrum clients on iOS/macOS  (Read 28 times)
askii (OP)
Jr. Member
*
Offline Offline

Activity: 51
Merit: 160

better with code than with words


View Profile WWW
Today at 05:29:56 AM
Merited by ABCbits (5)
 #1

Hello,

Recently I was looking for a low-level Swift library to interact with Electrum servers, but I couldn’t find anything that felt reliable enough for actual production use.
Over the past couple of weeks, I’ve been working on my own implementation, and I figured it might be useful to some people. Smiley

https://github.com/AskiiDev/ElectrumKit

It's still in progress, and I'm working on writing some tests for it.
My goal is to eventually have full parity with Electrum's interface.py.

Main features:
  • Make Electrum requests and subscriptions
  • Minimal dependencies, only uses Apple's system frameworks
  • TOFU pinning for self signed certificates
  • Packet buffering and padding for privacy
  • Automatic reconnection with backoff/jitter

Contributions and pull requests are very much welcome. Grin

proofofwork.gg (https://proofofwork.gg)   |  Bitcointalk Topic (https://bitcointalk.org/index.php?topic=5538065.0)
ABCbits
Legendary
*
Offline Offline

Activity: 3388
Merit: 9249



View Profile
Today at 09:10:45 AM
 #2

I'm not programmer, but thanks for sharing. But since Electrum server have multiple version for it's communication protocol[1], you may want to mention which version supported by your kit/library.

[1] https://electrumx.readthedocs.io/en/latest/protocol-changes.html

askii (OP)
Jr. Member
*
Offline Offline

Activity: 51
Merit: 160

better with code than with words


View Profile WWW
Today at 12:29:41 PM
 #3

But since Electrum server have multiple version for it's communication protocol[1], you may want to mention which version supported by your kit/library.

[1] https://electrumx.readthedocs.io/en/latest/protocol-changes.html

Yep, for sure.
You can use any version of the Electrum protocol with the library (as long as the server you connect to supports the version you desire).

The library implements the transport/request layer for Electrum servers (with JSON-RPC 2.0). The public API exposed is:
Code:
start()
stop()
request(method, params, timeout) -> callback
subscribe(method, params) -> handler
unsubscribe(method, params)

It's designed to give you full control, so as a developer using the library, you can negotiate version with the server by requesting server.version (https://electrum-protocol.readthedocs.io/en/latest/protocol-methods.html#server.version).
By default, it expects at least Version 1.2 (for server.ping). I'm pretty sure most Electrum servers support 1.2, but it won't fail or drop the connection if not. I'll see towards adding a fallback to the code to address this for full robustness.

proofofwork.gg (https://proofofwork.gg)   |  Bitcointalk Topic (https://bitcointalk.org/index.php?topic=5538065.0)
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!