3

I need to get the merkle branch quickly for a known TX.

I have connected to various stratum servers, but whenever I send the method below I get "HTTP code 405 - Method not allowed".

{ \"id\": 1, \"method\": \"blockchain.transaction.get_merkle\", \"params\": [ \"967d009ee103340d6762819ebf452107561423fe97b04fbf501594f231e212c4\", \"369863\" ] }

I'm using the HTTP post version of the Stratum protocol and content type "application/stratum".

The question is how do I make this work?

2
+50

I'm using the HTTP post version of the Stratum protocol and content type "application/stratum".

The HTTP version of stratum isn't supported in the later server versions, it's unlikely you'll be able to use them in any sort of capacity in the future. When connecting to the TCP+SSL version of electrum-server your command works perfectly, though the block height field in your example should be an integer and not a string.

telnet electrum.be 50001
Trying 88.198.241.196...
Connected to electrum.be.
Escape character is '^]'.
{ "id": 1, "method": "blockchain.transaction.get_merkle", "params": [ "967d009ee103340d6762819ebf452107561423fe97b04fbf501594f231e212c4", 369863 ] }
{"id": 1, "result": {"merkle": ["d844420b0f01398953b809b844bc9a5987f41d1373dab3180b6b4fe4de8633c4", "3c1f63dae13e84aaba94d6ee12c7b48fa7b470eacfbe6e183ba008b7cbc3725c", "0c5141f62f1ad58a6ebcee98868451ff392bc49bfb6daa5e4f492b6d175812cf", "e414fd7ee39a83b7bd524f98ed09efa279a97fecbeeca68087de384eda71fc31", "47fbf181989f2549d0d7a9fee2337ea60295059df0c0267cca173fd43b8e8596", "bc441c955a6d9bc629e3a8e428aa7670d2bf631a9d11887bb4ad6b534fcf4817", "1985800e12a150e6196ac07119278ea84ad296f1d8b2c88b2c85f61035f6a7cd", "fc02dfab3083ca9185bce4e8b9357b5aacacce2172c969ac543da04eaa1c0c1d", "6a36f10f34da6d66fdf75d4d97e0796106e7594409d354b8419a248231ab6935", "cbc02af67b294fe7bad08a69f9435b520f8f89fa221583e0a84c8d9c9dc469a0", "1043c7a6b9b4c42243e84a49a1f40476692b5d36d2f64dfb14409490ca3dfad2", "fbbaec1ca9d29ba9ee6a89214428556827b4e5a254de59de5adabbabb2621f54"], "pos": 2917, "block_height": 369863}}
  • If I may ask, how do you know this? I'm having a hell of a time finding information/documentation, so many dead links and everything is 2+ years old! – Martin Clemens Bloch Sep 19 '15 at 12:48
  • It's fairly similar to the stratum mining protocol, the whole thing is just JSON commands stuffed through TCP with a newline delimiter. You can play around with the Electrum client and wireshark to get an idea of what it is doing, and it's simple enough that you can interact with the servers using telnet or nc. Browsing the electrum-server source is very useful as well, even if you don't have a deep familiarity with Python. – Anonymous Sep 19 '15 at 13:17
  • Right.. if you know you need to use telnet! Anyway thanks I verified your answer works. – Martin Clemens Bloch Sep 19 '15 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.