Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hempcoin(THC) #111

Open
gblass opened this issue Mar 25, 2018 · 9 comments
Open

hempcoin(THC) #111

gblass opened this issue Mar 25, 2018 · 9 comments

Comments

@gblass
Copy link

gblass commented Mar 25, 2018

Can you add Hempcoin(THC). I have tried to create my own hempcoin.py files, but I have not been able to get them to work. Hoping someone will help.

@ikolubr
Copy link

ikolubr commented Mar 30, 2018

up @Rav3nPL could you help on this one!?

@ikolubr
Copy link

ikolubr commented Mar 30, 2018

Just to give you more info:
networks/HempCoin.py

from p2pool.bitcoin import networks

PARENT = networks.nets['HempCoin']
SHARE_PERIOD = 30 # seconds
CHAIN_LENGTH = 24*60*60//10 # shares
REAL_CHAIN_LENGTH = 24*60*60//10 # shares
TARGET_LOOKBEHIND = 5 # shares
SPREAD = 12 # blocks
IDENTIFIER = 'e037d5b8c9276410'.decode('hex')
PREFIX = '7208c1a53ef910b0'.decode('hex')
P2P_PORT = 21055
MIN_TARGET = 0
MAX_TARGET = 2**256//2**20 - 1
PERSIST = False
WORKER_PORT = 21056
BOOTSTRAP_ADDRS = ''.split(' ')
ANNOUNCE_CHANNEL = '#p2pool-thc'
VERSION_CHECK = lambda v: None if 100000 <= v else 'Litecoin version too old. Upgrade to 0.10.2.2 or newer!'
VERSION_WARNING = lambda v: None

bitcoin/networks/HempCoin.py

import os
import platform

from twisted.internet import defer

from .. import data, helper
from p2pool.util import pack

P2P_PREFIX = 'a5a5fd01'.decode('hex')
P2P_PORT = 21054
ADDRESS_VERSION = 40
RPC_PORT = 12055
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
            'hempcoinaddress' in (yield bitcoind.rpc_help()) and
            not (yield bitcoind.rpc_getinfo())['testnet']
        ))
SUBSIDY_FUNC = lambda height: 125*100000000 >> (height + 1)//500000
POW_FUNC = lambda data: pack.IntType(256).unpack(__import__('ltc_scrypt').getPoWHash(data))
BLOCK_PERIOD = 60 # s
SYMBOL = 'THC'
CONF_FILE_FUNC = lambda: os.path.join(os.path.join(os.environ['APPDATA'], 'Hempcoin') if platform.system() == 'Windows' else os.path.expanduser('~/Library/Application Support/Hempcoin/') if platform.system() == 'Darwin' else os.path.expanduser('~/.Hempcoin'), 'Hempcoin.conf')
BLOCK_EXPLORER_URL_PREFIX = 'http://explorer.litecoin.net/block/'
ADDRESS_EXPLORER_URL_PREFIX = 'http://explorer.litecoin.net/address/'
TX_EXPLORER_URL_PREFIX = 'http://explorer.litecoin.net/tx/'
SANE_TARGET_RANGE = (2**256//1000000000 - 1, 2**256//1000 - 1)
DUMB_SCRYPT_DIFF = 2**16
DUST_THRESHOLD = 0.03e8

When we run it, we get some errors like:

2018-03-30 08:52:10.953807 RECV tx 010000001e5dbe5a03af98ee24fb81fd14af86a9243ba83d52b757310db0a3607982db6c76232a1fa50000000049483045022100b04ce8c2631b62fc322dcad163c0d29f09bf315aaabaf0c666db393df059a28a02201f1fc1807fd77e2a6956b8f1b657...
2018-03-30 08:52:10.956182 > Error handling message: (see RECV line)
2018-03-30 08:52:10.956274 > Traceback (most recent call last):
2018-03-30 08:52:10.956306 >   File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 214, in doRead
2018-03-30 08:52:10.956327 >     return self._dataReceived(data)
2018-03-30 08:52:10.956351 >   File "/usr/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 220, in _dataReceived
2018-03-30 08:52:10.956370 >     rval = self.protocol.dataReceived(data)
2018-03-30 08:52:10.956395 >   File "/root/HCp2pool/p2pool/util/p2protocol.py", line 27, in dataReceived
2018-03-30 08:52:10.956419 >     self.dataReceived2(data)
2018-03-30 08:52:10.956436 >   File "/root/HCp2pool/p2pool/util/datachunker.py", line 40, in _DataChunker
2018-03-30 08:52:10.956452 >     wants = receiver.send(buf.get(wants))
2018-03-30 08:52:10.956476 > --- <exception caught here> ---
2018-03-30 08:52:10.956492 >   File "/root/HCp2pool/p2pool/util/p2protocol.py", line 57, in dataReceiver
2018-03-30 08:52:10.956508 >     self.packetReceived(command, type_.unpack(payload, self.ignore_trailing_payload))
2018-03-30 08:52:10.956525 >   File "/root/HCp2pool/p2pool/util/pack.py", line 63, in unpack
2018-03-30 08:52:10.956545 >     obj = self._unpack(data, ignore_trailing)
2018-03-30 08:52:10.956562 >   File "/root/HCp2pool/p2pool/util/pack.py", line 42, in _unpack
2018-03-30 08:52:10.956585 >     obj, (data2, pos) = self.read((data, 0))
2018-03-30 08:52:10.956602 >   File "/root/HCp2pool/p2pool/util/pack.py", line 295, in read
2018-03-30 08:52:10.956617 >     item[key], file = type_.read(file)
2018-03-30 08:52:10.956632 >   File "/root/HCp2pool/p2pool/util/pack.py", line 295, in read
2018-03-30 08:52:10.956711 >     item[key], file = type_.read(file)
2018-03-30 08:52:10.956731 >   File "/root/HCp2pool/p2pool/util/pack.py", line 171, in read
2018-03-30 08:52:10.956746 >     res[i], file = self.type.read(file)
2018-03-30 08:52:10.956761 >   File "/root/HCp2pool/p2pool/util/pack.py", line 295, in read
2018-03-30 08:52:10.956776 >     item[key], file = type_.read(file)
2018-03-30 08:52:10.956791 >   File "/root/HCp2pool/p2pool/util/pack.py", line 132, in read
2018-03-30 08:52:10.956813 >     return read(file, length)
2018-03-30 08:52:10.956830 >   File "/root/HCp2pool/p2pool/util/pack.py", line 16, in read
2018-03-30 08:52:10.956853 >     raise EarlyEnd()
2018-03-30 08:52:10.956875 > p2pool.util.pack.EarlyEnd:

But we still can run the pool and find blocks... but something is strange as we don't receive the coins. also the amount of coins showing up as a block reward is lower than the actually amount. The correct amount is 7.8125 and it shows 0.078125. The blocks seem validated. Here is a getblockbynumber from block 2160359 we found:

{
    "hash" : "00000000004fd7dca89455a213b580e43e83ae2776f4f38c23fe55dd85aa3986",
    "confirmations" : 904,
    "size" : 288,
    "height" : 2160359,
    "version" : 6,
    "merkleroot" : "b3d917e9cb78a2d9153a16f0ee9ab13f24c95153c1d76c78ccc050e708656fb1",
    "mint" : 7.81250000,
    "time" : 1522389401,
    "nonce" : 1885767893,
    "bits" : "1b50da69",
    "difficulty" : 810.54341243,
    "blocktrust" : "1dbb4740ca4",
    "chaintrust" : "f7ed110ca727ce34",
    "previousblockhash" : "000000000019d6b9c893dc1d911376ac58a55aa165a9319ea54e9d9a5cd64a63",
    "nextblockhash" : "7c4690c50d6a3587d92266c0094a38cf245421516f8910a318802b470fc88fe7",
    "flags" : "proof-of-work",
    "proofhash" : "00000000004fd7dca89455a213b580e43e83ae2776f4f38c23fe55dd85aa3986",
    "entropybit" : 0,
    "modifier" : "58122aaec1d29a82",
    "modifierchecksum" : "bca7821d",
    "tx" : [
        "b3d917e9cb78a2d9153a16f0ee9ab13f24c95153c1d76c78ccc050e708656fb1"
    ]
}

Really hope someone could help us.

Thank you,

@Rav3nPL
Copy link
Owner

Rav3nPL commented Mar 30, 2018

It is kind of old coin code, let me start a node and take a look...

@ikolubr
Copy link

ikolubr commented Mar 30, 2018

Yes... freaking old code.
BlockChain download for you here: http://23.179.0.17:21059/static/hempcoinbc.zip

Thank you,

@Rav3nPL
Copy link
Owner

Rav3nPL commented Mar 31, 2018

Added data that connect to daemon, but looks like there is some major change in getblocktemplate and stuff
https://github.com/Rav3nPL/p2pool-rav/tree/thc
Getting errorrs:

Error getting work from bitcoind:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1184, in gotResult
    _inlineCallbacks(r, g, deferred)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
--- <exception caught here> ---
  File "/home/tester/p2pool-rav/p2pool/util/deferral.py", line 41, in f
    result = yield func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1128, in _inlineCallbacks
    result = g.send(result)
  File "/home/tester/p2pool-rav/p2pool/bitcoin/helper.py", line 52, in getwork
    transactions=map(bitcoin_data.tx_type.unpack, packed_transactions),
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 63, in unpack
    obj = self._unpack(data, ignore_trailing)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 42, in _unpack
    obj, (data2, pos) = self.read((data, 0))
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 171, in read
    res[i], file = self.type.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 310, in read
    value, file = self.inner.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 218, in read
    data, file = read(file, self.bytes)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 16, in read
    raise EarlyEnd()
p2pool.util.pack.EarlyEnd:

Error getting work from bitcoind:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1184, in gotResult
    _inlineCallbacks(r, g, deferred)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/local/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
--- <exception caught here> ---
  File "/home/tester/p2pool-rav/p2pool/util/deferral.py", line 41, in f
    result = yield func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1128, in _inlineCallbacks
    result = g.send(result)
  File "/home/tester/p2pool-rav/p2pool/bitcoin/helper.py", line 52, in getwork
    transactions=map(bitcoin_data.tx_type.unpack, packed_transactions),
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 63, in unpack
    obj = self._unpack(data, ignore_trailing)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 42, in _unpack
    obj, (data2, pos) = self.read((data, 0))
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 171, in read
    res[i], file = self.type.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 310, in read
    value, file = self.inner.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 218, in read
    data, file = read(file, self.bytes)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 16, in read
    raise EarlyEnd()
p2pool.util.pack.EarlyEnd:

2018-03-31 20:59:35.059789 RECV tx 010000007ddabf5a0732783bfe41d5c93ef60915f3828dcb95508a41b302b50ab79c2a0fec972501720000000048473044022014f79082e6d2cc2453fe8df14b7b738d567eae3bb972549ea0670b4e993ef40c02202dc192de0de05a86418b364e80dd95...
Error handling message: (see RECV line)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 209, in doRead
    return self._dataReceived(data)
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 215, in _dataReceived
    rval = self.protocol.dataReceived(data)
  File "/home/tester/p2pool-rav/p2pool/util/p2protocol.py", line 27, in dataReceived
    self.dataReceived2(data)
  File "/home/tester/p2pool-rav/p2pool/util/datachunker.py", line 40, in _DataChunker
    wants = receiver.send(buf.get(wants))
--- <exception caught here> ---
  File "/home/tester/p2pool-rav/p2pool/util/p2protocol.py", line 57, in dataReceiver
    self.packetReceived(command, type_.unpack(payload, self.ignore_trailing_payload))
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 63, in unpack
    obj = self._unpack(data, ignore_trailing)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 42, in _unpack
    obj, (data2, pos) = self.read((data, 0))
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 171, in read
    res[i], file = self.type.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 310, in read
    value, file = self.inner.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 295, in read
    item[key], file = type_.read(file)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 218, in read
    data, file = read(file, self.bytes)
  File "/home/tester/p2pool-rav/p2pool/util/pack.py", line 16, in read
    raise EarlyEnd()
p2pool.util.pack.EarlyEnd:

Unhandled error in Deferred:


Traceback (most recent call last):
Failure: twisted.internet.defer.TimeoutError: in ReplyMatcher

@gblass
Copy link
Author

gblass commented Mar 31, 2018

we are getting similar errors

@gblass
Copy link
Author

gblass commented Apr 2, 2018

@Rav3nPL is there any hope for this?

@gblass
Copy link
Author

gblass commented Apr 3, 2018

@Rav3nPL what you think?

@gblass
Copy link
Author

gblass commented Apr 19, 2018

any update or more tests on this fork?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants