I've recently tried to port p2pool to some newer alt coins and have been hitting a brick wall. I'm pretty sure this going beyond basic network.py values but I wanted to get some opinions.
I've tried setting this up for grandcoin, lottocoin, luckycoin and earthcoin. The one I'm most interested in getting to work is earthcoin, so let's take that one for example. This is the error I receive when running it.
Testing bitcoind RPC connection to 'http://127.0.0.1:5555/' with username 'user'...
2013-12-30 00:24:16.668394 > Error getting work from bitcoind:
2013-12-30 00:24:16.668474 > Traceback (most recent call last):
2013-12-30 00:24:16.668509 > File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 545, in _runCallbacks
2013-12-30 00:24:16.668538 > current.result = callback(current.result, *args, **kw)
2013-12-30 00:24:16.668566 > File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1095, in gotResult
2013-12-30 00:24:16.668598 > _inlineCallbacks(r, g, deferred)
2013-12-30 00:24:16.668626 > File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1037, in _inlineCallbacks
2013-12-30 00:24:16.668675 > result = result.throwExceptionIntoGenerator(g)
2013-12-30 00:24:16.668704 > File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 382, in throwExceptionIntoGenerator
2013-12-30 00:24:16.668732 > return g.throw(self.type, self.value, self.tb)
2013-12-30 00:24:16.668759 > --- ---
2013-12-30 00:24:16.668785 > File "/home/x/p2pool-eac/p2pool/util/deferral.py", line 41, in f
2013-12-30 00:24:16.668812 > result = yield func(*args, **kwargs)
2013-12-30 00:24:16.668838 > File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1039, in _inlineCallbacks
2013-12-30 00:24:16.668866 > result = g.send(result)
2013-12-30 00:24:16.668892 > File "/home/x/p2pool-eac/p2pool/bitcoin/helper.py", line 49, in getwork
2013-12-30 00:24:16.668919 > transactions=map(bitcoin_data.tx_type.unpack, packed_transactions),
2013-12-30 00:24:16.668945 > File "/home/x/p2pool-eac/p2pool/util/pack.py", line 63, in unpack
2013-12-30 00:24:16.668972 > obj = self._unpack(data, ignore_trailing)
2013-12-30 00:24:16.668998 > File "/home/x/p2pool-eac/p2pool/util/pack.py", line 47, in _unpack
2013-12-30 00:24:16.669024 > raise LateEnd()
2013-12-30 00:24:16.669050 > p2pool.util.pack.LateEnd:
Now, what I noticed is in the pack.py file, the functions
def _unpack(self, data, ignore_trailing=False):
obj, (data2, pos) = self.read((data, 0))
assert data2 is data
if pos != len(data) and not ignore_trailing:
raise LateEnd()
return obj
def unpack(self, data, ignore_trailing=False):
obj = self._unpack(data, ignore_trailing)
if p2pool.DEBUG:
packed = self._pack(obj)
good = data.startswith(packed) if ignore_trailing else data == packed
if not good:
raise AssertionError()
return obj
is where the error is being thrown. The pos is always 1 character bigger then len(data) when the error is thrown. So setting the ignore_trailing=True eliminates the error, but when testing it against earthcoin, we hashed overnight and found a few blocks. However, none of them were actually committed to the blockchain and nothing was paid out. So I assume that is messing with the blocks submitted and they're not valid.
If you don't change that variable, the error that was mentioned is thrown for a while. Eventually it will connect to the wallet daemon, and you can actually hash in the pool, however the connection to the wallet will go unstable and the errors will start again. The connection to the wallet never really stabilizes.
Just for reference here are my earthcoin network.py values.
earthcoin=math.Object(
PARENT=networks.nets['earthcoin'],
SHARE_PERIOD=10, # seconds
CHAIN_LENGTH=3*60*60//5, # shares
REAL_CHAIN_LENGTH=3*60*60//5, # shares
TARGET_LOOKBEHIND=120, # shares
SPREAD=30, # blocks
IDENTIFIER='e137d5b8c6923410'.decode('hex'),
PREFIX='7218c1a53ef629b0'.decode('hex'),
P2P_PORT=9338,
MIN_TARGET=0,
MAX_TARGET=2**256//2**20 - 1,
PERSIST=False,
WORKER_PORT=19330,
BOOTSTRAP_ADDRS=''.split(' '),
ANNOUNCE_CHANNEL='#spool',
VERSION_CHECK=lambda v: True,
),
earthcoin=math.Object(
P2P_PREFIX='c0dbf1fd'.decode('hex'),
P2P_PORT=15677,
ADDRESS_VERSION=93,
RPC_PORT=15678,
RPC_CHECK=defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
'earthcoinaddress' in (yield bitcoind.rpc_help()) and
not (yield bitcoind.rpc_getinfo())['testnet']
)),
SUBSIDY_FUNC=lambda height: 10000*100000000 >> (height + 1)//525600,
POW_FUNC=lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data)),
BLOCK_PERIOD=60, # s
SYMBOL='EAC',
CONF_FILE_FUNC=lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'earthcoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/earthcoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.earthcoin'), 'earthcoin.conf'),
BLOCK_EXPLORER_URL_PREFIX='http://earthchain.info/block/',
ADDRESS_EXPLORER_URL_PREFIX='http://earthchain.info/address/',
TX_EXPLORER_URL_PREFIX='http://earthchain.info/tx/',
SANE_TARGET_RANGE=(2**256//1000000000 - 1, 2**256//1000 - 1),
DUMB_SCRYPT_DIFF=2**16,
DUST_THRESHOLD=1e8,
),
If anyone that has better python skills than me, and a better knowledge of how p2pool works cares to help, I'd greatly appreciate it. Like I said, I don't think this is isolated to earthcoin as I've seen this behavior with several new alt coins. Also, I've posted a
bug report on the official p2pool github in case anyone wants to contribute.
error error error error................