jtoomim / p2pool

Peer-to-peer Bitcoin mining pool
https://github.com/jtoomim/p2pool/
GNU General Public License v3.0
37 stars 45 forks source link

Allow for new AUX POW. #51

Closed rldleblanc closed 3 years ago

rldleblanc commented 4 years ago

getauxblock is being depreciated and replaced by createauxblock and submitauxblock. This allows for specifying a payment address when asking for an auxblock instead of getting a wallet address so you don't have to run a wallet where p2pool has access. Most coins support both methods, some only support the old method (Terricoin is an example) and some only support the new method (Myriadcoin is an example). Use --merged for the old style and --merged_addr for the new style.

rldleblanc commented 4 years ago

@jtoomim Since I don't have any hash power at the moment, I couldn't test that the submitting of aux work is working, but I think I should. If you have some testnet with aux, can you double check it?

jtoomim commented 4 years ago

I've never messed around with the auxpow stuff, unfortunately. Testing this would be harder for me than for you.

Perhaps you could rent some hashpower on nicehash?

silkroadnomad commented 3 years ago

@rldleblanc and @jtoomim I've tested p2pool with this pull request on our own altcoin fork on testnet. And I just received blocks on the configured address! Thanks for the good work!

The only thing which seems ugly is the % char between the address and the merged_addr url!. Makes some problems inside systemd for me.

rldleblanc commented 3 years ago

That's great news. What was the main coin and what was the aux coin(s)?

Sent from a mobile device, please excuse any typos.

On Sat, Sep 26, 2020, 11:14 PM Nico Krause notifications@github.com wrote:

@rldleblanc https://github.com/rldleblanc and @jtoomim https://github.com/jtoomim I've tested p2pool with this pull request on our own altcoin fork on testnet. And I just received blocks on the configured address! Thanks for the good work!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jtoomim/p2pool/pull/51#issuecomment-699586893, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACW6TV2QUASBEPRE3VAKVR3SH3C4JANCNFSM4PY7EDHQ .

jtoomim commented 3 years ago

Thanks for testing it, @inspiraluna. I'm willing to merge this either now or after the % issue has been changed. Do you have a suggestion for what to do instead of the %?

silkroadnomad commented 3 years ago

Well, I don't know if anything would speak against it; I'd suggest doing it that way:

Now: payout%http://ncuser:ncpass@127.0.0.1:port/

Later: http://ncuser:ncpass@127.0.0.1:port/payout

That would require testing the URL in a different way. I guess it would be not a problem. I am just not a python programmer yet otherwise I could do it by myself quickly. If somebody is faster then me with it, that would be it.

silkroadnomad commented 3 years ago

@rldleblanc Main blockchain was Bitcoin 0.20. and Aux-Coin was Doichain (DOI)

Doichain is a project which is aiming to record "Double Opt Ins" (DOIs) in order to track unforgeable email permissions on blockchain for preventing spam in email marketing businesses. Nice project but still long way to go!

rldleblanc commented 3 years ago

I tried using a delimiter that would not interfere with anything that could be a path (I'm not aware of any coins using a path, but you never know).

I have a shell script that launches p2pool with all the correct parameters and I call that from systemd.

/home/rleblanc/start_p2pool.sh:

#! /bin/sh

export PYTHONPATH=/usr/lib/python2.7/dist-packages/:/usr/local/lib/python2.7/dist-packages/

/usr/bin/pypy /home/rleblanc/p2pool/run_p2pool.py \
        --net litecoin \
        --web-static /home/rleblanc/p2pool-node-status \
        -w :::9327 \
        --address Leoj1iCoJ74Dk2mGDVw9MveW6cbRaYdAJX \
        --merged http://dogecoinrpc:rpc_pass@127.0.0.1:22555/ \
        --merged http://viauser:rpc_pass@127.0.0.1:5222/ \
        --merged http://pesetacoinrpc:rpc_pass@127.0.0.1:16638/ \
        --merged_addr 4skv9S1NYHB7huKUMitebwZWV7pygmsmgW%http://myriadrpc:rpc_pass@127.0.0.1:10889/ \                                                                                                                                    
        --logfile /dev/null

exit 0

/etc/systemd/system/p2pool.service:

[Unit]
Description=Litecoin P2Pool
After=litecoin.service

[Service]
Type=simple
LimutNOFILE=8192
User=rleblanc
WorkingDirectory=/home/rleblanc
Environment="LD_PRELOAD=libjemalloc.so.2"
ExecStart=/home/rleblanc/start_p2pool.sh
Restart=on-abort
#Nice=-10

[Install]
WantedBy=multi-user.target

Probably a lot easier than managing systemd and having to reload on every change.

silkroadnomad commented 3 years ago

@rldleblanc I ended up doing the same as you. Created another shell script which starts p2pool. But it seemed a bit of pain if you don't calculate with it, since it needs an additional research. What is the problem here with systemd etc? Which solutions are possible? Is it possible to escape the # in the string or not?

Regarding to your worries, that other coins would use a path for constructing the rpc url, I am still thinking about this possibility but generally don't really see it as a scenario since more or less all (well, I don't have the full overview) forked from bitcoin and use this simple rpc url. But if you really think so and other coins would do so, why not embrace this thought and use this:

http://ncuser:ncpass@127.0.0.1:port/?payout_addr=xyz

In such a way such coins (if such coins should exist) could still work and we just append a parameter.

ikolubr commented 3 years ago

I'm getting this error:

Traceback (most recent call last):
  File "/usr/local/lib/pypy2.7/dist-packages/Twisted-15.4.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 393, in callback
    self._startRunCallbacks(result)
  File "/usr/local/lib/pypy2.7/dist-packages/Twisted-15.4.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 501, in _startRunCallbacks
    self._runCallbacks()
  File "/usr/local/lib/pypy2.7/dist-packages/Twisted-15.4.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/pypy2.7/dist-packages/Twisted-15.4.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 1184, in gotResult
    _inlineCallbacks(r, g, deferred)
--- <exception caught here> ---
  File "/usr/local/lib/pypy2.7/dist-packages/Twisted-15.4.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py", line 1128, in _inlineCallbacks
    result = g.send(result)
  File "/opt/p2/p2pool/work.py", line 88, in set_merged_work
    target = auxblock['target'] if 'target' in auxblock else auxblock['_target']
exceptions.KeyError: '_target'

This is the createauxblock output of the bvault daemon:

{
  "hash": "ea8a73072d0dc067e1fb21f1ca6b523b6076173d4469b4e6f86641bd1745b18d",
  "chainid": 1638,
  "previousblockhash": "2022f9a528c1ea7a69e8a835906cd0eaea731a0ec1b73f396aea8464d675a1f5",
  "coinbasevalue": 12500017625,
  "bits": "18066b12",
  "height": 70057
}

So no target or _target

Mining BTC and trying to merge mine BTCV