Coder Social home page Coder Social logo

stratum-mining's Introduction

stratum-mining

Demo implementation of bitcoin mining pool using Stratum mining protocol.

For Stratum mining protocol specification, please visit http://mining.bitcoin.cz/stratum-mining.

Contact

This pool implementation is provided by http://mining.bitcoin.cz. You can contact me by email info(at)bitcoin.cz or on IRC #stratum on freenode.

stratum-mining's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stratum-mining's Issues

Possible feature: mining.submitfull() network message with full coinbase tx

I am working with a few pools to add a new feature to their pool system. I described a simplified version of this feature in my talk at Scaling Bitcoin:

http://toom.im/files/Jonathan_Toomim_BIP101_block_progapation_on_testnet.pdf page 23

https://www.youtube.com/watch?v=ivgxcEOyWNs&feature=youtu.be&t=2h46m00s

The basic idea is to use what is essentially a stratum proxy to cross the Great Firewall of China so that full blocks never have to cross the Firewall, at least not in the latency-critical path. Pools would operate bitcoind servers abroad which perform getblocktemplate, and send the summarized results to the poolserver via a slightly enhanced version of stratum.

The issue with this approach is that we don't trust the servers abroad to honestly enter the coinbase output address and the rest of the coinbase transaction. What we want to do is generate the whole coinbase transaction on the trusted poolserver in China. Currently we can do that, no problem, but we don't have an interface for submitting the new coinbase transaction back to our servers abroad when we submit the job via stratum.

What I would like to add is another function, say mining.submitfull(...) that includes the full coinbase tx instead of just the extranonce info. This extended interface should be disabled by default (lest a pool accept work that didn't pay the pool at all).

We can write the code for this on our own. The question I have for you is this: if we implemented this and submitted a pull request, do you think this is the kind of feature you would like to see in this project, or do you think it's better that we just maintain it as a fork?

finalize does not return true

def finalize(self, merkle_root_int, extranonce1_bin, extranonce2_bin, ntime, nonce):
'''Take all parameters required to compile block candidate.
self.is_valid() should return True then...'''

    self.hashMerkleRoot = merkle_root_int
    self.nTime = ntime
    self.nNonce = nonce
    self.vtx[0].set_extranonce(extranonce1_bin + extranonce2_bin)        
    self.sha256 = None # We changed block parameters, let's reset sha256 cache

in the code above, finalize does not return true. It seems it should?

Stratum Server Exception “[coin] is not connected”

When i running 'twistd -ny launcher.tac' i getting the following Exception. The connection okay. Please help me to fix this issue.

2017-01-30 19:33:43,094 INFO bitcoin_rpc # Checking for submitblock
2017-01-30 19:33:43,097 DEBUG bitcoin_rpc # submitblock detected.
017-01-30 19:33:43,097 INFO mining # Found submitblock
2017-01-30 19:33:43,101 ERROR mining # Coind Error: Guncoin is not connected!
Thanks, Your help will appreciated!

ERROR

hello people I have the following problem ...
Thanks x help :)

jlripoll@ubuntuServer:~/stratum-mining-master/litecoin_scrypt$ twistd -ny launcher_demo.tac
Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 652, in run
runApp(config)
File "/usr/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 23, in runApp
_SomeApplicationRunner(config).run()
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 386, in run
self.application = self.createOrGetApplication()
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 451, in createOrGetApplication
application = getApplication(self.config, passphrase)
--- ---
File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 462, in getApplication
application = service.loadApplication(filename, style, passphrase)
File "/usr/lib/python2.7/dist-packages/twisted/application/service.py", line 405, in loadApplication
application = sob.loadValueFromFile(filename, 'application', passphrase)
File "/usr/lib/python2.7/dist-packages/twisted/persisted/sob.py", line 203, in loadValueFromFile
fileObj = open(filename, mode)
exceptions.IOError: [Errno 2] No such file or directory: 'launcher_demo.tac'

Failed to load application: [Errno 2] No such file or directory: 'launcher_demo.tac'

Unhandled Error:- when running ' twistd -y launcher.tac '

When i running 'twistd -y launcher.tac' i got the following error. Please help me to fix this issue.

Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/application/app.py", line 648, in run
runApp(config)
File "/usr/local/lib/python2.7/dist-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/scripts/twistd.py", line 25, in runApp
_SomeApplicationRunner(config).run()
File "/usr/local/lib/python2.7/dist-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/application/app.py", line 379, in run
self.application = self.createOrGetApplication()
File "/usr/local/lib/python2.7/dist-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/application/app.py", line 444, in createOrGetApplication
application = getApplication(self.config, passphrase)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/application/app.py", line 455, in getApplication
application = service.loadApplication(filename, style, passphrase)
File "/usr/local/lib/python2.7/dist-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/application/service.py", line 411, in loadApplication
passphrase)
File "/usr/local/lib/python2.7/dist-packages/Twisted-16.7.0rc2-py2.7-linux-x86_64.egg/twisted/persisted/sob.py", line 223, in loadValueFromFile
eval(codeObj, d, d)
File "launcher.tac", line 15, in
import lib.settings as settings
exceptions.ImportError: No module named lib.settings
Failed to load application: No module named lib.settings

different blocks count with stratum and real wallet transactions

Hi there!
First, thank you for this very helpful repo to start with. I've got a pool running with it, and we've ran into such a problem: stratum reports more blocks found than transactions (immature|generated|orphan) at the pool wallet. How could that happen?

ERROR template_registry

Hi, i have problem with stratum-mining

2013-07-02 13:08:37+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:38,174 INFO template_registry # target_info: 17668201048317171789435028337278314961968102597311964175491250976823
2013-07-02 13:08:38,174 INFO template_registry # hash_int: 7828964347598659544576338303256361750942983294788636737368951610161891
2013-07-02 13:08:38,174 INFO template_registry # job.target: 46824477683132239135561803058851965969788731792469148591448018386944
2013-07-02 13:08:39+0200 [-] Starting factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:39,097 INFO block_updater # New block! Prevhash: 000000013c8ec61561e6d307395909d475306657f17fba750cf845e2fa06a568
2013-07-02 13:08:39+0200 [HTTPPageGetter,client] Starting factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:39+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:08:39,099 ERROR template_registry # [Failure instance: Traceback: <class 'struct.error'>: unpack requires a string argument of length 4
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1126:gotResult
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:1113:_inlineCallbacks
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:380:callback
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:488:_startRunCallbacks
--- <exception caught here> ---
/usr/local/lib/python2.7/dist-packages/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py:575:_runCallbacks
/home/sannin/stratum/lib/template_registry.py:130:_update_block
/home/sannin/stratum/lib/block_template.py:64:fill_from_rpc
/home/sannin/stratum/lib/halfnode.py:141:deserialize
/home/sannin/stratum/lib/util.py:71:deser_vector
/home/sannin/stratum/lib/halfnode.py:107:deserialize
]
]
2013-07-02 13:19:00+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:19:01,640 INFO template_registry # target_info: 17668201048317171789435028337278314961968102597311964175491250976823
2013-07-02 13:19:01,640 INFO template_registry # hash_int: 26931581362785944347414155924451665936093937277250586439267436797026
2013-07-02 13:19:01,640 INFO template_registry # job.target: 48025696009976719546334930562118831838426128974381661891692502974464
2013-07-02 13:19:01,640 INFO template_registry # We found a block candidate! 00000000ffbb0c3a4e54a9e19125996c7b1471b91c1f41af3f09267a05b11c62
2013-07-02 13:19:01+0200 [Protocol,1,159.205.49.59] Starting factory <HTTPClientFactory: http://localhost:8385>
2013-07-02 13:19:01,641 INFO interfaces # 00000000ffbb0c3a4e54a9e19125996c7b1471b91c1f41af3f09267a05b11c62 valid rocker
2013-07-02 13:19:01+0200 [HTTPPageGetter,client] Unhandled error in Deferred:
2013-07-02 13:19:01+0200 [HTTPPageGetter,client] Unhandled Error
        Traceback (most recent call last):
        Failure: twisted.web.error.Error: 500 Internal Server Error

2013-07-02 13:19:01+0200 [HTTPPageGetter,client] Stopping factory <HTTPClientFactory: http://localhost:8385>

Thanks for help

PID file stored in tmpfs

This is a minor error, but according to FHS 2.3, PID files belong in /var/run.
If the PID file is stored in /tmp the system will automatically remove the PID file and the daemon would be slightly more difficult to close.

Furthermore it should be possible to pick the name of the PID file, as it currently is impossible to have 2 instances running with different configurations at the same time.

Cant connect to stratum

when i start server i write: livecoind -daemon and see " Livecoin server starting" after i check my adress: livecoind getaccountaddress "" and see "14p9ZYoWpiLT5idjHjVntP7aybkkmmFWpo" my /stratum-mining/conf/config.py is http://pastebin.com/SSYNWq4q my /var/www/MPOSpublic/include/config/global.inc.php is http://pastebin.com/XxmsvYTA my ~/.livecoin/livecoin.conf is http://pastebin.com/sjX4avy7 i go to stratum-mining and write twistd -ny launcher.tac and see next: http://pastebin.com/nc0h3KtE when i trying to connect: http://clip2net.com/s/6ziHko i think everything is normal, but it doesnt work,

Stratum Server Exception “[coin] is not connected”

When i running 'twistd -ny launcher.tac' i getting the following Exception. The connection okay. Please help me to fix this issue.

2017-01-30 19:33:43,094 INFO bitcoin_rpc # Checking for submitblock
2017-01-30 19:33:43,097 DEBUG bitcoin_rpc # submitblock detected.
017-01-30 19:33:43,097 INFO mining # Found submitblock
2017-01-30 19:33:43,101 ERROR mining # Coind Error: Guncoin is not connected!
Thanks, Your help will appreciated!

ntime out of range

I'm running stratum connected to mpos with new Rock Miners that when connected together are about 2 GH/s. for long periods of time I will repeatedly get :
[terracoin](Thread 1) Share rejected: {"job":"291","ip":"nn.nn.nn.nn","worker":"ninja.block1","difficulty":256,"error":"ntime out of range"}

it will eventually recover - this is an sha256 coin. MY stratum works fine for srcypt coins (I run many) and I have found that if I set : RollNtime[s] in the rock miner setup to a value like 390 it helps - If I set to the default of about 230 it never recovers - but eventually (within a few minutes) it goes back to repeated ntime out of range errors when rejecting shares

any ideas as to why? clues - things to change/modify?

Multiple ports for different difficulties

Just want to double check the following set up is correct.

To support different difficulties I've made four copies of stratum-mining, all point to the same database and have the same coinbase address but have different difficulties.

Is this the correct way to offer different difficulties on one pool?

ERROR block_updater # UpdateWatchdog.run failed

I found similar issues like:
![https://github.com/Crypto-Expert/stratum-mining/issues/68]
![https://github.com/viacoin/viacoin/issues/2]

My error:

ERROR block_updater # UpdatedWatchdog.run failed.
    Traceback (most recent call last):
    File "C\etc\etc\lib\block_updater.py, line 47, in run
    prevash  = util.reverse_hash((yield self.bitcoin_rpc.prevhash()))

Looking the file, i see that is calling getwork, wich I understand is not working anymore.
I've tried to play with the getblocktemplate but still no luck.

@defer.inlineCallbacks
def prevhash(self):
    resp = (yield self._call('getwork', []))
    try:
        defer.returnValue(json.loads(resp)['result']['data'][8:72])
    except Exception as e:
        log.exception("Cannot decode prevhash %s" % str(e))
        raise

INFO template_registry # Job id 'c3a6' not found

Has anyone come across this issue?

Works well for days normally though today it died after 12 hours, then the stratum.log adjusts difficulty and then comes up invalid as shown below.

2017-10-02 14:18:05,241 DEBUG interfaces # 3918d52af820e52b5a0454adf31e67e30d5893a481c636505d269ad0604469d0 (1887) valid kakala.kakala
2017-10-02 14:18:05,242 DEBUG DB_Mysql # Finding user with id or username of oso.1
2017-10-02 14:18:05,243 DEBUG mining # oso.1 (1981, 4, False, False, 1506967990) 0.20% work_id(c3a6) job_id(c3a6) diff(1024.000000)
2017-10-02 14:18:05,245 DEBUG BasicShareLimiter # Checking Retarget for oso.1 (1024) avg. 0 target 15+-4
2017-10-02 14:18:05,246 WARNING BasicShareLimiter # Reseting avg = 1 since it's SOOO low
2017-10-02 14:18:05,247 DEBUG BasicShareLimiter # Retarget for oso.1 1 old: 1024 new: 1024
2017-10-02 14:18:05,247 DEBUG template_registry # Getting Laat Template
2017-10-02 14:18:05,249 DEBUG BasicShareLimiter # Notified of New Difficulty
2017-10-02 14:18:05,250 DEBUG BasicShareLimiter # Sent new work
2017-10-02 14:18:05,252 INFO DBInterface # Inserting 50 Share Records
2017-10-02 14:18:05,252 DEBUG DB_Mysql # Importing Shares
2017-10-02 14:18:05,251 DEBUG DB_Mysql # Setting difficulty for oso.1 to 1024
2017-10-02 14:18:05,255 INFO template_registry # Job id 'c3a6' not found
2017-10-02 14:18:05,255 DEBUG interfaces # False (0) INVALID oso.1
2017-10-02 14:18:05,257 DEBUG DB_Mysql # Finding user with id or username of oso.1
2017-10-02 14:18:05,283 DEBUG mining # oso.1 (1981, 5, False, False, 1506967990) 0.25% work_id(c3a6) job_id(c3a6) diff(1024.000000)
2017-10-02 14:18:05,283 INFO template_registry # Job id 'c3a6' not found

Further along in the log we get these errors and no miners can connect.

2017-10-02 14:52:46,019 DEBUG template_registry # Getting Unique Extranonce
2017-10-02 14:52:46,019 DEBUG template_registry # Getting Laat Template
2017-10-02 14:52:46,019 DEBUG template_registry # Getting Unique Extranonce
2017-10-02 14:52:46,019 DEBUG template_registry # Getting Laat Template
2017-10-02 14:52:46,022 ERROR bitcoin_rpc_manager # Check Height -- Pool 0 Down!
2017-10-02 14:52:47,023 ERROR bitcoin_rpc_manager # Problem with Pool 0 -- NO ALTERNATE POOLS!!!
2017-10-02 14:52:51,030 ERROR bitcoin_rpc_manager # Check Height -- Pool 0 Down!
2017-10-02 14:52:52,031 ERROR bitcoin_rpc_manager # Problem with Pool 0 -- NO ALTERNATE POOLS!!!
2017-10-02 14:52:56,087 ERROR bitcoin_rpc_manager # Check Height -- Pool 0 Down!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.