p2pool-drk hardfork how to for May 14th

Status
Not open for further replies.

chaeplin

Active Member
Core Developer
Mar 29, 2014
749
356
133
p2pool need hard fork.

As pchMessage switched, p2pool-drk need to change P2P_PREFIX of bitcoin/networks.py at 1400094580; //Wed, 14 May 2014 19:09:40 GMT.
https://github.com/darkcoinproject/darkcoin/blob/master/src/protocol.cpp#L16-L35
Code:
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ascii, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
// Public testnet message start
static unsigned char pchMessageStartTestOld[4] = { 0xfc, 0xc1, 0xb7, 0xdc };
static unsigned char pchMessageStartTestNew[4] = { 0xce, 0xe2, 0xca, 0xff };
static unsigned int nMessageStartTestSwitchTime = 1398869551+(60*5);
// Darkcoin message start (switch from Litecoin's)
static unsigned char pchMessageStartLitecoin[4] = { 0xfb, 0xc0, 0xb6, 0xdb };
static unsigned char pchMessageStartDarkcoin[4] = { 0xbf, 0x0c, 0x6b, 0xbd };
static unsigned int nMessageStartSwitchTime = 1400094580; //Wed, 14 May 2014 19:09:40 GMT
void GetMessageStart(unsigned char pchMessageStart[], bool fPersistent)
{
if (fTestNet)
memcpy(pchMessageStart, (fPersistent || GetAdjustedTime() > nMessageStartTestSwitchTime)? pchMessageStartTestNew : pchMessageStartTestOld, sizeof(pchMessageStartTestNew));
else
memcpy(pchMessageStart, (fPersistent || GetAdjustedTime() > nMessageStartSwitchTime)? pchMessageStartDarkcoin : pchMessageStartLitecoin, sizeof(pchMessageStartDarkcoin));
}

p2pool changes.
https://github.com/chaeplin/p2pool-drk/commit/3ffb8c55da6702cc0522f4d925ce13c03a7f45fe
https://github.com/chaeplin/p2pool-drk/commit/c27ef50ad6c2f68d224e92fd1077082269629115

Code:
https://github.com/chaeplin/p2pool-drk/blob/master/p2pool/bitcoin/networks.py#L23
from
        P2P_PREFIX='fbc0b6db'.decode('hex'),
to
        P2P_PREFIX='bf0c6bbd'.decode('hex'),

https://github.com/chaeplin/p2pool-drk/blob/master/p2pool/bitcoin/networks.py#L46
from
        P2P_PREFIX='fcc1b7dc'.decode('hex'),
to
        P2P_PREFIX='cee2caff'.decode('hex'),

and

https://github.com/chaeplin/p2pool-drk/blob/master/p2pool/networks.py
from
IDENTIFIER='496247d46a00c115'.decode('hex'),
PREFIX='5685a273806675db'.decode('hex'),

to
IDENTIFIER='492672d64a12c515'.decode('hex'),
PREFIX='4574a162705565bd'.decode('hex'),

EDIT)
How to update.
Code:
1) upgrade darkcoind before 1400094580; //Wed, 14 May 2014 19:09:40 GMT
    (compile, restart darkcoind)
Code:
2) update p2pool-drk, do not restart
git pull https://github.com/chaeplin/p2pool-drk
    - changes : p2pool/network.py, p2pool/bitcoin/network.py
    - do not restart p2pool-drk, after git pull, before  1400094580; //Wed, 14 May 2014 19:09:40 GMT
    - if you need to restart p2pool-drk, you should modify p2pool/network.py, p2pool/bitcoin/network.py
Code:
3) do restart p2pool-drk after 1400094580; //Wed, 14 May 2014 19:09:40 GMT
    choose a or b.
    (a) manual restart
    - stop p2pool-drk
    - remove data/darkcoin ( rm -rf data/darkcoin )
    - run p2pool-drk
    (b) auto restart using cron / use at your own risk
    - download https://gist.githubusercontent.com/chaeplin/e6157be59d5f9a94d580/raw/159d9b9bb327989e244bafae10da8fe772899992/p2pool_hardfork.py
    - rename to p2pool_hardfork.py, chmod 755  p2pool_hardfork.py
    - edit p2pool_hardfork.py: p2pool_directory, p2pool_pid, p2pool_runcmd
    - add to cron(use p2pool owner account) : */1 * * * * /pathto_scripts/p2pool_hardfork.py
    * if you need to restart p2pool-drk, first you should modify p2pool/network.py, p2pool/bitcoin/network.py, then restart.
       after restart, modify p2pool_pid of p2pool_hardfork.py.
(sad, Masternode payment is not patched yet)
 
Last edited by a moderator:

chaeplin

Active Member
Core Developer
Mar 29, 2014
749
356
133
Possible to delete data/darkcoin before that block, or will have to wait until exactly then?
Darkcoin's P2P_PREFIX wiil be changed at "nMessageStartSwitchTime = 1400094580; //Wed, 14 May 2014 19:09:40 GMT"
So p2pool's P2P_PREFIX need to be changed accordingly.

So have to wait until exactly then.
 

chaeplin

Active Member
Core Developer
Mar 29, 2014
749
356
133
I will use this python scripts and crotab to restart my p2pool node(auto restart)

really dirty and quick scripts. use at your own risk
https://gist.github.com/chaeplin/e6157be59d5f9a94d580

1) git pull p2pool-drk
p2pool/bitcoin/networks.py : make sure P2P_PREFIX changed
p2pool/networks.py : make sure both IDENTIFIER and PREFIX changed

2) add crontab
 
Last edited by a moderator:

HammerHedd

Member
Mar 10, 2014
182
34
88
I have the feeling this will be a bit bumpy :)

At least we get another 10 days to get the p2pool stratum working.
 

mattmct

Member
Mar 13, 2014
259
92
88
Cheers for this chaplin!
I'm going to go with option 3a, I'll be sitting on the comp at 19:00 ready to fire lol
 

n00b_miner

New Member
Mar 14, 2014
17
2
3
All set! Here's a BASH script I have running locally so I can't get sidetracked and miss it:
Code:
#!/bin/bash
echo "STARTING DARKCOIN HARDFORK ALARM!!!!! DO NOT CLOSE!!!!"
HARDFORKTIMESTAMP=1400094580
ALARMFILE="~/alarm.mp3"
while true; do
    NOW=$(date +%s)
    MINSLEFT=$(echo "($HARDFORKTIMESTAMP-$NOW)/60" | bc)
    if [ "$MINSLEFT" -eq "30" -o "$MINSLEFT" -le 15 ]; then
        echo "WARNING! $MINSLEFT MINUTES UNTIL THE HARDFORK!!!"
        vlc "$ALARMFILE"
    else
        echo -ne "Not yet... $MINSLEFT minutes to go\r"
    fi
    sleep 60
done
This will sit on a terminal on your local machine and then set the music file $ALARMFILE to play on repeat if there is less than 30 minutes until the hardfork occurs.
It'll only play once at 30 minutes, but as soon as 15 minutes hits if you haven't stopped the script by then it'll go nuts and just keep repeating the alarm every minute. Gotta keep you on your toes ;)
 
Last edited by a moderator:
  • Like
Reactions: chaeplin

mattmct

Member
Mar 13, 2014
259
92
88
I tlooks like yours is working... I'm getting a bunch of

Code:
 stratum_recv_line failed
messages when I try to connect with miners. Do I need to change up the miners as well?
Cool cheers.

Don't have to change anything with the miners. Did you remember to delete the data folder?
 

mattmct

Member
Mar 13, 2014
259
92
88
I guess the version numbers didn't change at all? Just wondering if there is a way for people to see on the node scanner which pools have updated or note.
 

mattmct

Member
Mar 13, 2014
259
92
88
ah crap, I see that I"m not on the list either, even though my p2pool IS working and on the correct fork.

Guess I shoulda done a git pull rather than manually changed. Thats my best solution right now?

Edit: Did a git clone, now version number is also updated :). Hopefully this time my domain will show rather than my server ip address!! :) Cheers :)
http://x11p2p.com:7903/
 
Last edited by a moderator:

HammerHedd

Member
Mar 10, 2014
182
34
88
Well, it seems that libboost broke somehow...

Any thoughts on why this might be occurring?

Code:
2014-05-14 20:06:45.526626 p2pool (version 765195f-dirty)
2014-05-14 20:06:45.526685 
2014-05-14 20:06:45.526739 Testing bitcoind RPC connection to 'http://127.0.0.1:9998/' with username 'darkcoinrpc'...
2014-05-14 20:06:45.535260     ...success!
2014-05-14 20:06:45.535326     Current block hash: 515184227d4e33a7135dff71af47f27c8cb479729daac73005852
2014-05-14 20:06:45.535363     Current block height: 68671
2014-05-14 20:06:45.535419 
2014-05-14 20:06:45.535454 Testing bitcoind P2P connection to '127.0.0.1:9999'...
2014-05-14 20:06:45.594981     ...success!
2014-05-14 20:06:45.595060 
2014-05-14 20:06:45.595118 Determining payout address...
2014-05-14 20:06:45.595257     ...success! Payout address: XnPtDvfChzJZxbBXk87HFoD7X92xQWSGXb
2014-05-14 20:06:45.595305 
2014-05-14 20:06:45.595334 Loading shares...
2014-05-14 20:06:46.295997     1000
2014-05-14 20:06:46.717311     ...done loading 1606 shares (1606 verified)!
2014-05-14 20:06:46.717395 
2014-05-14 20:06:46.717425 Initializing work...
2014-05-14 20:06:46.923127     ...success!
2014-05-14 20:06:46.923222 
2014-05-14 20:06:46.923257 Joining p2pool network using port 7902...
2014-05-14 20:06:47.137125     ...success!
2014-05-14 20:06:47.137171 
2014-05-14 20:06:47.137199 Listening for workers on '' port 7903...
2014-05-14 20:06:47.700102     ...success!
2014-05-14 20:06:47.700168 
2014-05-14 20:06:47.700213 Started successfully!
2014-05-14 20:06:47.700270 Go to http://127.0.0.1:7903/ to view graphs and statistics!
2014-05-14 20:06:47.700327 Donating 0.0% of work towards P2Pool's development. Please donate to encourage further development of P2Pool!
2014-05-14 20:06:47.700366 
2014-05-14 20:06:47.897229 > Unhandled Error
2014-05-14 20:06:47.897284 > Traceback (most recent call last):
2014-05-14 20:06:47.897304 >   File "/usr/local/src/p2pool-drk/p2pool/main.py", line 579, in run
2014-05-14 20:06:47.897323 >     reactor.run()
2014-05-14 20:06:47.897340 >   File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1192, in run
2014-05-14 20:06:47.897357 >     self.mainLoop()
2014-05-14 20:06:47.897374 >   File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 1201, in mainLoop
2014-05-14 20:06:47.897391 >     self.runUntilCurrent()
2014-05-14 20:06:47.897407 >   File "/usr/lib/python2.7/dist-packages/twisted/internet/base.py", line 824, in runUntilCurrent
2014-05-14 20:06:47.897424 >     call.func(*call.args, **call.kw)
2014-05-14 20:06:47.897441 > --- <exception caught here> ---
2014-05-14 20:06:47.897457 >   File "/usr/local/src/p2pool-drk/p2pool/bitcoin/stratum.py", line 38, in _send_work
2014-05-14 20:06:47.897474 >     x, got_response = self.wb.get_work(*self.wb.preprocess_request('' if self.username is None else self.username))
2014-05-14 20:06:47.897492 >   File "/usr/local/src/p2pool-drk/p2pool/bitcoin/worker_interface.py", line 129, in get_work
2014-05-14 20:06:47.897509 >     x, handler = self._inner.get_work(*args)
2014-05-14 20:06:47.897525 >   File "/usr/local/src/p2pool-drk/p2pool/work.py", line 296, in get_work
2014-05-14 20:06:47.897542 >     base_subsidy=self.node.net.PARENT.SUBSIDY_FUNC(self.current_work.value['bits'].bits, self.current_work.value['height']),
2014-05-14 20:06:47.897559 >   File "/usr/local/src/p2pool-drk/p2pool/bitcoin/networks.py", line 32, in <lambda>
2014-05-14 20:06:47.897576 >     SUBSIDY_FUNC=lambda nBits, height: __import__('darkcoin_subsidy').GetBlockBaseValue(nBits, height),
2014-05-14 20:06:47.897594 > exceptions.ImportError: libboost_python-py27.so.1.53.0: cannot open shared object file: No such file or directory
2014-05-14 20:06:48.138913 Outgoing connection to peer 112.175.123.82:7902 established. p2pool version: 1300 '72d5988-dirty'
2014-05-14 20:06:48.143204 Peer sent entire transaction 3340bf966f6cd628b36989c924e2b5164aa6efab3ecdf2cacab3679b753634d8 that was already received
2014-05-14 20:06:48.368763 Requesting parent share e5ae77c4 from 112.175.123.82:7902
I suspect something is not working with libboost-python.
I tried
Code:
apt-get install libboost-all-dev
apt-get install libboost-python-dev
and both tell me they are already installed with the latest version.

help!
 

Propulsion

The buck stops here.
Feb 26, 2014
1,008
468
183
Dash Address
XerHCGryyfZttUc6mnuRY3FNJzU1Jm9u5L
You were already running a p2pool right? The git pull command shouldn't of affected anything that needed new dependencies.
 

HammerHedd

Member
Mar 10, 2014
182
34
88
You were already running a p2pool right? The git pull command shouldn't of affected anything that needed new dependencies.
yes, I thought that as well

And yet..... there it is.

I may delete the whole enchilada and re-clone it.

EDIT: Yup, recloning it made everything work fine.... Go figure :)
 
Last edited by a moderator:

chaeplin

Active Member
Core Developer
Mar 29, 2014
749
356
133
ah crap, I see that I"m not on the list either, even though my p2pool IS working and on the correct fork.

Guess I shoulda done a git pull rather than manually changed. Thats my best solution right now?

Edit: Did a git clone, now version number is also updated :). Hopefully this time my domain will show rather than my server ip address!! :) Cheers :)
http://x11p2p.com:7903/
done.
 
  • Like
Reactions: mattmct
Status
Not open for further replies.