kyuupichan / electrumx

Alternative implementation of spesmilo/electrum-server
Other
720 stars 732 forks source link

Error trying to add Boxy to electrumx #329

Closed ghost closed 6 years ago

ghost commented 6 years ago

All other coins seem to work correctly when tested, is there another file where data is required to initiate boxycoin? Thanks in advance-

Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: Traceback (most recent call last): Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: File "/usr/local/lib/python3.6/dist-packages/electrumx-1.2.1-py3.6.egg/EGG-INFO/scripts/electrumx_server.py", line 24, in main Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: File "/usr/local/lib/python3.6/dist-packages/electrumx-1.2.1-py3.6.egg/server/env.py", line 38, in init Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: self.coin = Coin.lookup_coin_class(coin_name, network) Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: File "/usr/local/lib/python3.6/dist-packages/electrumx-1.2.1-py3.6.egg/lib/coins.py", line 94, in lookup_coin_class Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: .format(name, net)) Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: lib.coins.CoinError: unknown coin Boxycoin and network mainnet combination Dec 12 21:25:59 boxy54 electrumx_server.py[10918]: CRITICAL:root:ElectrumX server terminated abnormally

Params are here:

class Boxycoin(Coin): NAME = "Boxycoin" SHORTNAME = "BOXY" NET = "mainnet" XPUB_VERBYTES = bytes.fromhex("019d9cfe") XPRV_VERBYTES = bytes.fromhex("019da462") P2PKH_VERBYTE = bytes.fromhex("4B") P2SH_VERBYTES = bytes.fromhex("12") WIF_BYTE = bytes.fromhex("CB") GENESIS_HASH = ('d880c4e8db4427c936d8c759b4631026' '94366b3e2e512f7b62a946c0d39d50dd') ESTIMATE_FEE = 0.001 RELAY_FEE = 0.001 DAEMON = daemon.FakeEstimateFeeDaemon TX_COUNT = 1000 TX_COUNT_HEIGHT = 10000 TX_PER_BLOCK = 1 RPC_PORT = 21523 REORG_LIMIT = 1000

ghost commented 6 years ago

the electrum.conf file reads (user/pass withheld)

DB_DIRECTORY = /db DAEMON_URL = http://xxxxxx:xxxxxx@127.0.0.1:21523/ USERNAME = boxy COIN = Boxycoin DB_ENGINE = rocksdb SSL_CERTFILE=/etc/electrumx/server.crt SSL_KEYFILE=/etc/electrumx/server.key TCP_PORT=50001 SSL_PORT=50002 HOST = 176.62.201.47

kyuupichan commented 6 years ago

It should work. Are you sure you're running the code with that definition? For example, have you changed the files locally, but are actually running an installed version of e-x without the changes?

ghost commented 6 years ago

Thanks for the reply, I used the installer and have edited the files under /tmp/electrumx/lib/coins.py, /tmp/electrumx/build/lib/lib/coins.py and /etc/electrumx.conf . But same output error, does the node need to be inside /tmp/electrumx/wallet ?

ghost commented 6 years ago

I'm using sudo systemctl start electrumx to start and stop from bash but I am out of ideas.

Is there anyway I can point electrumx towards my coins.py to make sure it is reading the correct file?

ghost commented 6 years ago

Hey kyuupichan, I shot you an email to your gmail. Hope you might be able to help us out. Thanks again

kyuupichan commented 6 years ago

I'm sorry I don't have time to look at this at the moment, perhaps in a week or two. But the code is easy - it just looks in the file. If you've added the class it will just work.

ghost commented 6 years ago

Thanks, there must be another file to edit or is there a cache somewhere? - I note that if I change the class (in coins.py) and coin=(electrumx.conf) name to Bitcoin or another preset then it works but errors as the genesis block does not match. Is there anyway to reset the server? (This is a fresh install)

kyuupichan commented 6 years ago

There is no cache. You can run python3 from the command line in the top level source directory and type

from lib.coins import Coin Coin.lookup_coin_class('BitcoinCash', 'mainnet') <class 'lib.coins.BitcoinCash'>

If that works for yours then there is no problem, and you're running some other code.

ghost commented 6 years ago

from lib.coins import Coin Coin.lookup_coin_class('Boxycoin', 'mainnet') Traceback (most recent call last): File "", line 1, in File "/tmp/electrumx/lib/coins.py", line 99, in lookup_coin_class .format(name, net)) lib.coins.CoinError: unknown coin Boxycoin and network mainnet combination Error in sys.excepthook: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook from apport.fileutils import likely_packaged, get_recent_crashes File "/usr/lib/python3/dist-packages/apport/init.py", line 5, in from apport.report import Report File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in import apport.fileutils File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in from apport.packaging_impl import impl as packaging File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in import apt File "/usr/lib/python3/dist-packages/apt/init.py", line 23, in import apt_pkg ModuleNotFoundError: No module named 'apt_pkg'

Original exception was: Traceback (most recent call last): File "", line 1, in File "/tmp/electrumx/lib/coins.py", line 99, in lookup_coin_class .format(name, net)) lib.coins.CoinError: unknown coin Boxycoin and network mainnet combination

ghost commented 6 years ago

I've tried installing it on a fresh server under root but same error

ghost commented 6 years ago

Solved with the help of BadChoicesZ:

class Boxycoin(Coin): NAME = "Boxycoin" SHORTNAME = "BOXY" NET = "mainnet" XPUB_VERBYTES = bytes.fromhex("019d9cfe") XPRV_VERBYTES = bytes.fromhex("019da462") P2PKH_VERBYTE = bytes.fromhex("4B") P2SH_VERBYTES = [bytes.fromhex("12")] WIF_BYTE = bytes.fromhex("CB") GENESIS_HASH = ('d880c4e8db4427c936d8c759b4631026' '94366b3e2e512f7b62a946c0d39d50dd') ESTIMATE_FEE = 0.001 RELAY_FEE = 0.001 DAEMON = daemon.FakeEstimateFeeDaemon TX_COUNT = 1000 TX_COUNT_HEIGHT = 10000 TX_PER_BLOCK = 1 RPC_PORT = 21523 REORG_LIMIT = 1000

PEERS = [
    '138.68.174.82 s50012',
    '178.62.103.251 s50002',
    'boxy.online s21524',
    'boxycoin.org s21524',
    '159.203.161.244 s21524',
    '104.131.50.160 s21524',
    'boxycoin.ddns.net s21524',
     ]

and editing electrumx_rpc.py and wallet/env.py 👍 thanks everyone