Bitcoin Forum
May 09, 2024, 09:17:47 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: [WIP] My opensource Node.js Stratum server and client + RPC interface  (Read 5554 times)
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
July 26, 2013, 02:20:35 PM
Last edit: September 09, 2013, 06:59:50 AM by pocesar
 #1

It's built from scratch using dependency injection, D.R.Y. paradigm, event emitters and deferred/promises.

https://github.com/pocesar/node-stratum

  • Defer and promise based code instead of callbacks (avoid callback hell)
  • Simple but powerful API for managing both server and client
  • Build-in support for spawn coins daemons (bitcoind, litecoind, etc) process and accept RPC calls
  • Easy for you to add your own procedures do the RPC server (using expose)
  • No need to worry about .conf files for the daemons, everything is passed through command line the best way possible (but you may override arguments)
  • Optimized code reuse with class methods and dependency injection
  • All classes based on EventEmitter by default (through the Base class)
  • The client part make it easy, along with an RPC server, to setup your own farming pool for coins
  • You can create a proxy from it using the Client interface, mix up Stratum with your own RPC definition and commands
  • It's up to you to choose the logging module (like winston)

It's currently on active development, only missing the bitcoind control from the code, and then creation of the automated mocha tests, and should be ready to go. Preliminar tests showed it to be working well (with cpuminer and bfgminer, for example)

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
1715246267
Hero Member
*
Offline Offline

Posts: 1715246267

View Profile Personal Message (Offline)

Ignore
1715246267
Reply with quote  #2

1715246267
Report to moderator
1715246267
Hero Member
*
Offline Offline

Posts: 1715246267

View Profile Personal Message (Offline)

Ignore
1715246267
Reply with quote  #2

1715246267
Report to moderator
Transactions must be included in a block to be properly completed. When you send a transaction, it is broadcast to miners. Miners can then optionally include it in their next blocks. Miners will be more inclined to include your transaction if it has a higher transaction fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715246267
Hero Member
*
Offline Offline

Posts: 1715246267

View Profile Personal Message (Offline)

Ignore
1715246267
Reply with quote  #2

1715246267
Report to moderator
1715246267
Hero Member
*
Offline Offline

Posts: 1715246267

View Profile Personal Message (Offline)

Ignore
1715246267
Reply with quote  #2

1715246267
Report to moderator
Saturn7
Full Member
***
Offline Offline

Activity: 147
Merit: 100



View Profile
July 26, 2013, 09:04:24 PM
 #2

Thank you! Been waiting for this for a while. 1 BTC tip sent!

First there was Fire, then Electricity, and now Bitcoins Wink
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
July 26, 2013, 09:22:16 PM
 #3

Thank you! Been waiting for this for a while. 1 BTC tip sent!

thanks man, really appreciate it. I should finish the coind part by this weekend I think (along with forking the process with the proper command line parameters).
after that, I will focus on testing every part of the server, using mocha and sinon (for mocks and stubs), and then try converting some python code for the stratum mine pool from slush to see how well it performs and add a benchmark to it as well. AFAIK, node is pretty good at handling connections, so I'm confident it will handle a large amount of data and connections per 'cluster'

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
jgarzik
Legendary
*
Offline Offline

Activity: 1596
Merit: 1091


View Profile
July 28, 2013, 01:34:19 PM
 #4

Nice to see some further node.js work!  Good show.

Check these out,
https://github.com/gasteve/node-base58  ('base58-native' in npm)
https://github.com/gasteve/node-libcoin

We are cleaning up bitcoinjs-server into a nice library, and fixing many bugs found (including buffer overflows and memory leaks).

And watch
https://github.com/jgarzik/txtool
https://github.com/jgarzik/wally

for other node.js work.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
July 28, 2013, 01:50:24 PM
 #5

hey jgarzik, I'm already following you on github Wink

thanks for the links, they are pretty important, mainly for the base58 that I didn't find in npm earlier! I'm at the moment finishing a hash address detector, simple quick and dirty way to detect which addresses belong.

I've learned a lot from reading the bitcoinjs-server source, but couldn't make it work on Windows, unfortunately.

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
jgarzik
Legendary
*
Offline Offline

Activity: 1596
Merit: 1091


View Profile
July 28, 2013, 03:38:25 PM
 #6

I've learned a lot from reading the bitcoinjs-server source, but couldn't make it work on Windows, unfortunately.

Hopefully node-libcoin will be a full replacement for bitcoinjs-server... Smiley


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
July 28, 2013, 04:27:51 PM
 #7

I've learned a lot from reading the bitcoinjs-server source, but couldn't make it work on Windows, unfortunately.

Hopefully node-libcoin will be a full replacement for bitcoinjs-server... Smiley



nice! the more light weight, the merrier. should focusing in making it modular and independent, but that work well together.

I've created a pull request for the gyp binding to build base58 on windows.

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
July 29, 2013, 01:06:21 PM
 #8

done, finished my hacky detect cryption library (using base58-native) for node.js Smiley

https://github.com/pocesar/node-detect-cryptocoin

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
July 31, 2013, 02:34:05 AM
 #9

Improved the docs a bit. The main server part is completly functional. Only missing the automated tests!

https://github.com/pocesar/node-stratum

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
Saturn7
Full Member
***
Offline Offline

Activity: 147
Merit: 100



View Profile
July 31, 2013, 01:23:23 PM
 #10

Nice work, gonning to try it out over the weekend.

First there was Fire, then Electricity, and now Bitcoins Wink
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
September 09, 2013, 06:58:22 AM
 #11

Worked a bit on the project on this weekend, after a long pause working on it because of work  Embarrassed

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
erk
Hero Member
*****
Offline Offline

Activity: 826
Merit: 500



View Profile
January 17, 2014, 10:49:11 AM
 #12

Anyone using it on a pool yet?
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
January 27, 2014, 05:53:22 AM
 #13

just updated it, when I have more spare time, I'll make 100% test coverage, only 2 parts to go.

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
flangefrog
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile WWW
January 27, 2014, 11:02:42 AM
 #14

Hi pocesar

Could you tell me what the difference is between your project and https://npmjs.org/package/stratum-pool ?
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
January 28, 2014, 01:15:57 AM
Last edit: January 28, 2014, 02:18:38 AM by pocesar
 #15

hey flangefrog, no idea, didn't even knew the existance of that repo. seems pretty new (first commit 21 days ago), so I'll check it out and report back

EDIT: It is a full fledged stratum pool, instead of stratum server and client module (my library have no pool funcionality whatsoever, its up to the developer to implement them). "stratum-pool" is more of a framework that is focused on building work to deliver to miners. although there are no tests or test coverage data for that library yet.

With my library, you can build pools, proxies, network endpoints for miners, etc, and implement in other types of libraries/frameworks, that aim to provide stratum support along with other functionalities, like a web interface, or other protocols, like X-Pushthrough. And I take stability and code congruence really seriously, along with tests and code coverage.

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
flangefrog
Newbie
*
Offline Offline

Activity: 56
Merit: 0


View Profile WWW
January 28, 2014, 05:31:32 AM
Last edit: January 28, 2014, 05:44:51 AM by flangefrog
 #16

Thanks for your reply. I am going to start building a pool in a week or two. I am wanting to have multiple nodes in different locations to reduce latency to the miners. I assume I would run your code on each node, but would they be able to work together to solve the same block (so I would get a block more often with a lower hashrate)? I'm still learning how mining works.

I am going to be using CPPSRB for payments and build a custom frontend. Besides stuff like logging shares and making payments is there anything else cryptocoin related that I would need to build the pool? Basicly, can your project allow miners to connect, give me a way to log shares, and solve blocks. I'm a bit too busy right at the moment to try it out.
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
April 09, 2014, 11:38:48 PM
 #17

Soon I'm going to resume my work on the Proof of Concept using a really high performance solo mining endpoint using
https://github.com/pocesar/node-stratum as the building block. the project is in
https://github.com/pocesar/node-stratum-solo
you'll be able to create your own auto profit switching pool for example, or point all your ASICs to just one computer in the network, distributing correct unique work for your miners (and not dupe extra nonce, for example)

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
arruah
Legendary
*
Offline Offline

Activity: 1357
Merit: 1004



View Profile WWW
April 10, 2014, 01:01:23 PM
 #18

is it good to replace eloipool on my pool? Smiley

BCH
pocesar (OP)
Member
**
Offline Offline

Activity: 105
Merit: 10


View Profile WWW
April 12, 2014, 01:52:33 AM
 #19

you could, but you would have to implement the users, shares, etc by yourself. I'm focusing on quality, well tested, stable code instead of feature rich but unstable code. downtime, instability, security and exploitable bugs are my main concerns, see how many exchanges and pools were hacked lately.

https://github.com/pocesar - BTC 1KLRAFHGGhE2WiRASkASatvMR1vALmkB9L
soulreafer
Full Member
***
Offline Offline

Activity: 219
Merit: 100

CryptoCombat - Realtime NPC Fight Faucet


View Profile WWW
April 17, 2014, 04:05:22 PM
 #20

possible that someone can explain how to build up a proxy with the client example. i tryed some with the net lib but i cant get it to work well

Pages: [1] 2 »  All
  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!