Bitcoin Forum
April 26, 2024, 06:08:11 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: electrum server/protocol vs. stratum server/protocol - please clarify confusion  (Read 5654 times)
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
September 20, 2012, 11:43:18 AM
 #1

There is this: https://bitcointalk.org/index.php?topic=55842.0
that somehow suggests that "electrum" and "stratum" are actually the same thing or "stratum" is the new name for "electrum"

Then there quite a lot of postings or answers along the lines of this (for example): https://bitcointalk.org/index.php?topic=91939.msg1013281#msg1013281
that come up when googling for "electrum protocol" or "electrum stratum" that claim that electrum is actually using the stratum protocol or that there is no need to reverse engineer the electrum protocol because there is the stratum protocol documentation.

There is this: http://stratum.bitcoin.cz/
not very informative and mentioning exactly one running stratum server (and nothing about electrum)

    california.stratum.bitcoin.cz (Ports 3333 TCP, 8000 HTTP, 8001 HTTPS, 8002 Websocket, 8003 Websocket SSL, California US, hosted by BitVPS.com).

and there is this: http://electrum-desktop.com/
mentioning nothing about the used protocol, the servers and especially no reference to stratum at all. The client when started present a short list of servers:

ecdsa.org
uncle-enzo.info
electrum.bytesized-hosting.com
electrum.novit.ro

and when trying to use the california.stratum.bitcoin.cz in electrum I get only error messages like [-3, u"Method 'subscribe' not found for service 'server.peers'", None] and a few more which suggest that the electrum and the stratum protocols are not the same thing.

Now here come the questions:
* how are stratum and electrum related?
* if not related then does there exist an electrum-like client for stratum?
* how many electrum servers are there?
* how many stratum servers are there?
* which *existing* protocol should be chosen when implementing an electrum-like client?
* if the answer to the last question is electrum then where is the protocol documentation (if such a thing exists at all)?

Maybe it would also be nice if both (the stratum and the electrum) websites clearly state that they are *not* related (or if they are related somehow then maybe explain in which way they are related or if there exist other "stratums" or "electrums" with the same names that are not related, etc).


1714111691
Hero Member
*
Offline Offline

Posts: 1714111691

View Profile Personal Message (Offline)

Ignore
1714111691
Reply with quote  #2

1714111691
Report to moderator
"Bitcoin: mining our own business since 2009" -- Pieter Wuille
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
JompinDox
Member
**
Offline Offline

Activity: 107
Merit: 10


View Profile
September 20, 2012, 11:57:11 AM
 #2

Stratrum is being used both by Electrum and some mining software.

Hopefully this link will answer some of your questions:
 https://mining.bitcoin.cz/stratum-mining#stratum

There IS official documentation for the protocol but I'm not sure of its current location.
EDIT: here's a  technical draft I've been able to find - but I don't know if it's the most recent one.

I can't elaborate much further... To my knowledge, the top Stratum experts are
slush (author of the Stratum protocol), ThomasV (author of Electrum) and genjix (who is on a
well-deserved break following the London conference.)

I'm sure they will help clarify a lot of things.

Tips? 1ELECeJompinDox61L73eAUyaWpe3Q5HZB
Down with socks!
prof7bit (OP)
Hero Member
*****
Offline Offline

Activity: 938
Merit: 500


https://youengine.io/


View Profile WWW
September 20, 2012, 12:10:01 PM
 #3

Stratrum is being used both by Electrum and some mining software.

But why are the stratum servers not listed in the electrum servers list and also trying to manually add the only existing stratum server I could find only results in error messages? Or are we talking about a different stratum or a different electrum here?

slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
September 20, 2012, 01:29:07 PM
Last edit: September 24, 2012, 09:02:35 PM by slush
Merited by bones261 (1)
 #4

Well, I'll try to explain it.

Stratum is just a protocol, like HTTP/FTP/Jabber/whatever. Stratum has been designed for Electrum to replace it's original wire protocol which had some drawbacks and current Electrum client/servers uses Stratum protocol to talk each other.

Stratum is based on JSON-RPC and you can read the basic concept on http://stratum.bitcoin.cz - that Google document there is probably the best summary to start with.

Stratum protocol allows servers to expose services. For example, Electrum servers are exposing blockchain-related services, so Electrum clients can ask for address history and so on.

Now about confusion with Electrum and Stratum mining protocol; Stratum mining is just a service exposed by some mining pools, giving the opportunity to connected clients to mine bitcoins over very lightweight protocol. Usage of Stratum wire format is the only relation between Electrum and Stratum mining.

Thanks to this concept, it's quite possible that some Electrum backend servers will expose Stratum mining service as well, so lightweight clients using Stratum protocol will be able to request address balance and mine bitcoins over the same connection at the same time...

slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
September 20, 2012, 01:31:51 PM
 #5

Quote
and when trying to use the california.stratum.bitcoin.cz in electrum I get only error messages like [-3, u"Method 'subscribe' not found for service 'server.peers'", None] and a few more which suggest that the electrum and the stratum protocols are not the same thing.

That stratum node running on california.stratum.bitcoin.cz is mostly my playground for testing new things and it is likely misconfigured. I'll try to repair Electrum services there.

slush
Legendary
*
Offline Offline

Activity: 1386
Merit: 1097



View Profile WWW
September 22, 2012, 11:53:49 PM
 #6

I just fixed the issue on Electrum server, so california.stratum.bitcoin.cz is operating again.

marcus_of_augustus
Legendary
*
Offline Offline

Activity: 3920
Merit: 2348


Eadem mutata resurgo


View Profile
September 24, 2012, 11:44:52 PM
 #7


As simple as I can state it;

- Stratum is the network layer (built on top of bitcoin p2p network) that uses the stratum protocol

- Electrum clients and Electrum servers are the reference implementation of the stratum layer (i.e. they communicate using the stratum protocol)

- other client, server or miner implementations (e.g. call them aurum or plumbum) when they come along and use stratum protocol will become part of Stratum (network overlay)

alberthendriks
Member
**
Offline Offline

Activity: 86
Merit: 10


View Profile
April 14, 2013, 02:25:06 AM
Last edit: April 14, 2013, 03:39:32 AM by alberthendriks
 #8

For anyone who might be interested, I figured out the protocol between electrum (i.e. client) and electrum-server.

OT: For the sake of colored bitcoins, my teammates and me are changing vision by the hour. My current vision is that we should adjust the electrum server (and extend the below protocol) and use a js client.

The google doc mentioned in this thread mentions other methods as well, such as 'blockchain.address.get_balance'. These methods actually don't exist in electrum nor in electrum-server.

Here's my document:
----------------------------------
Electrum server/client message specs

The information below was gathered by looking at the source code that generates the messages. This may have lead to errors.

protocol uses json format.


CLIENT TO SERVER (requests)

general format:

[
  {'method':"method",'id':"id",'params':[...]},
  {'method':"method",'id':"id",'params':[...]},
  {'method':"method",'id':"id",'params':[...]},
  {'method':"method",'id':"id",'params':[...]},
  ...
]

(edit: Note that the above is a single http / scp / whatever request, but I also use the term request for any one entry inside it. Same for response.)

where "id" is a message_id which is just a counter that's increased after each message.

example:

[{'method':'blockchain.transaction.get','id':5,'params':['aec13bHASH43',3700000]}]

used values for 'method': see below.


SERVER TO CLIENT (responses)

general format:

[
  {'id': "id", 'result': "result"},
  {'id': "id", 'result': "result"},
  {'id': "id", 'error': "error"},
  {'id': "id", 'result': "result"},
  ...
]

where an entry with id=5 is a response to a request with id=5


REQUEST / RESPONSE SCENARIO'S

below are the possible values for 'method' (in a request from client) and the corresponding (simplified) statement for the value of 'result' in the response. (method -> result).
Note that instead of the 'result'-key we could have the 'error'-key. Those cases are not specified here.
Note that params is part of the request.
Note that the filenames (.py) are files in the client where the calls can be found
Note that "/" (single) stands for "or" (as in "either .. or" but not both). No division is used below.

wallet.py:
'blockchain.transaction.broadcast' * -> urlopen(bitcoind_url, {'method': 'sendrawtransaction', 'params': params, 'id': 'jsonrpc'}).get('result')
//* note: blockchain.transaction.broadcast will not return key 'error'. Instead, the error message would be in the result
'blockchain.transaction.get' -> urlopen(bitcoind_url, {'method': 'getrawtransaction', 'params': [tx_hash=params[0], 0, height=params[1]], 'id': 'jsonrpc'}).get('result')
'blockchain.address.get_history' -> BlockchainProcessor.get_history(addr=params[0], FALSE/true)
'blockchain.address.subscribe' -> BlockchainProcessor.get_status(addr=params[0], FALSE/true)

verifier.py:
'blockchain.headers.subscribe' -> BlockchainProcessor.header
'blockchain.block.get_chunk' -> -1 / BlockchainProcessor.get_chunk(index=params[0])
'blockchain.transaction.get_merkle' -> BlockchainProcessor.get_merkle(tx_hash=params[0], tx_height=params[1])
'blockchain.block.get_header' -> -1 / BlockchainProcessor.get_header(height=params[0])

merchant.py:
'blockchain.numblocks.subscribe' -> BlockchainProcessor.height

unused server-accepted values for 'method':
'server.version' -> version.VERSION  (also sets the version)
'blockchain.address.unsubscribe' -> 'ok' / 'authentication error'
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!