• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

p2pool-drk hardfork how to for May 14th

Status
Not open for further replies.

chaeplin

Well-known member
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:
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.
 
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:
I have the feeling this will be a bit bumpy :)

At least we get another 10 days to get the p2pool stratum working.
 
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
 
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:
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?
 
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.
 
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:
Status
Not open for further replies.
Back
Top