spesmilo / electrumx

Alternative implementation of spesmilo/electrum-server
MIT License
445 stars 354 forks source link

I have a PIVX frok that does not work! #268

Closed Animal-Economy closed 2 months ago

Animal-Economy commented 3 months ago

link to the coin code https://github.com/Animal-Economy/ANEY

here is my setting:


class aney(Coin): NAME = "ANEY" SHORTNAME = "ANEY" NET = "mainnet" XPUB_VERBYTES = bytes.fromhex("222e3513") XPRV_VERBYTES = bytes.fromhex("52f1e11B") GENESIS_HASH = '000003379033d182e2c18040823ff53c5c0eef4aee26782fac4ce7a4dd82dd15' P2PKH_VERBYTE = bytes.fromhex("17") P2SH_VERBYTE = bytes.fromhex("3F") WIF_BYTE = bytes.fromhex("D2") DESERIALIZER = lib_tx.DeserializerPIVX TX_COUNT_HEIGHT = 1 TX_COUNT = 1 TX_PER_BLOCK = 1 STATIC_BLOCK_HEADERS = False RPC_PORT = 51470 REORG_LIMIT = 100 EXPANDED_HEADER = 112

@classmethod
def static_header_len(cls, height):
    '''Given a header height return its length.'''
    return cls.BASIC_HEADER_SIZE

@classmethod
def header_hash(cls, header):
    '''Given a header return the hash.'''
    import quark_hash
    return quark_hash.getPoWHash(header)

**** and here is the error code ****

ERROR:Prefetcher:ignoring unexpected exception raceback (most recent call last): File "/home/sim/electrumx/electrumx/server/block_processor.py", line 71, in main_loop if not await self._prefetch_blocks(): File "/home/sim/electrumx/electrumx/server/block_processor.py", line 141, in _prefetch_blocks blocks[0] = self.coin.genesis_block(blocks[0]) File "/home/sim/electrumx/electrumx/lib/coins.py", line 164, in genesis_block header_hex_hash = hash_to_hex_str(cls.header_hash(header)) File "/home/sim/electrumx/electrumx/lib/coins.py", line 1791, in header_hash import quark_hash ModuleNotFoundError: No module named 'quark_hash'


Big Thanks for help!

cipig commented 3 months ago

you need to install the quark_hash python module https://pypi.org/project/quark_hash/

Animal-Economy commented 3 months ago

thanks help me but, how can I fix this?

WARNING:BlockProcessor:daemon blocks do not form a chain; resetting the prefetcher


sudo journalctl -u electrumx -f

-- Logs begin at Thu 2024-08-01 02:26:38 BST. -- INFO:DB:tip: 0000000000000000000000000000000000000000000000000000000000000000 INFO:DB:tx count: 0 INFO:DB:flushing DB cache at 500 MB INFO:DB:sync time so far: 00s INFO:History:history DB version: 1 INFO:History:flush count: 0 INFO:SessionManager:RPC server listening on 0.0.0.0:8000 INFO:Prefetcher:catching up to daemon height 754,097 (754,098 blocks behind) INFO:Prefetcher:verified genesis block with hash 000003379033d182e2c18040823ff53c5c0eef4aee26782fac4ce7a4dd82dd15

WARNING:BlockProcessor:daemon blocks do not form a chain; resetting the prefetcher

INFO:Prefetcher:catching up to daemon height 754,097 (754,098 blocks behind) INFO:Prefetcher:verified genesis block with hash 000003379033d182e2c18040823ff53c5c0eef4aee26782fac4ce7a4dd82dd15

WARNING:BlockProcessor:daemon blocks do not form a chain; resetting the prefetcher

INFO:Prefetcher:catching up to daemon height 754,097 (754,098 blocks behind) INFO:Prefetcher:verified genesis block with hash 000003379033d182e2c18040823ff53c5c0eef4aee26782fac4ce7a4dd82dd15


cipig commented 3 months ago

that is from your settings, they don't match with the chain not an expert, but take a look at the @classmethod from PIVX itself it has something like if (height >= cls.ZEROCOIN_START_HEIGHT and height < cls.ZEROCOIN_END_HEIGHT), so looks like there was a hardfork with changes... did your fork inherit those changes from PIVX? if so, you will have to do the same on your fork. you can also try and inherit PIVX settings completely into your class and just change what's needed, like with class aney(Coin,Pivx)

Animal-Economy commented 3 months ago

I have managed to get the blocks fully loaded and synced but I can make a deposit but not withdraw, I get the error ( electrumx error sending transaction: TX decide failed ) how can I fix this?

thanks @cipig

INFO:DB:flush #2,773 took 0.0s. Height 756,613 txs: 1,561,044 (+38) INFO:BlockProcessor:processed 19 blocks size 0.01 MB in 0.0s INFO:MemPool:0 txs 0.00 MB touching 0 addresses INFO:Prefetcher:new block height 756,614 hash 9e420b46437795b010290bbf642001be3c58008f68159caa8aec7ab9ce2c2777 INFO:DB:flush #2,774 took 0.0s. Height 756,614 txs: 1,561,046 (+2) INFO:BlockProcessor:processed 1 block size 0.00 MB in 0.0s INFO:MemPool:0 txs 0.00 MB touching 0 addresses INFO:SessionManager:ID Flags Client Proto Cost XCost Reqs Txs Subs Recv Recv KB Sent Sent KB Time Peer INFO:SessionManager:{"coin": "aney", "daemon": "127.0.0.1:33500/", "daemon height": 756614, "db height": 756614, "db_flush_count": 2774, "groups": 23, "history cache": "12 lookups 9 hits 1 entries", "merkle cache": "0 lookups 0 hits 0 entries", "pid": 11178, "peers": {"bad": 0, "good": 0, "never": 0, "stale": 0, "total": 0}, "request counts": {"server.version": 9, "blockchain.headers.subscribe": 1271, "server.ping": 126, "blockchain.scripthash.get_balance": 244, "blockchain.scripthash.get_history": 12, "blockchain.transaction.get": 10, "blockchain.scripthash.listunspent": 3, "blockchain.transaction.broadcast": 2, "invalid method": 4}, "request total": 1681, "sessions": {"count": 0, "count with subs": 0, "errors": 0, "logged": 0, "pending requests": 0, "subs": 0}, "tx hashes cache": "0 lookups 0 hits 0 entries", "txs sent": 0, "uptime": "20h 00m 00s", "version": "ElectrumX 1.16.0"} Prefetcher:new block height 756,615 hash 8798d394c7bba8c22da04302918bf10d9142c7da10490cd2de0ea6ab74b87297 INFO:DB:flush #2,775 took 0.0s. Height 756,615 txs: 1,561,048 (+2) INFO:BlockProcessor:processed 1 block size 0.00 MB in 0.0s INFO:MemPool:0 txs 0.00 MB touching 0 addresses

Animal-Economy commented 2 months ago

please help me, i have this error

electrumx error sending transaction: TX decide failed

cipig commented 2 months ago

not sure, but i guess that means that the TX sent by the client can't be decoded, so either that client doing something wrong when it constructs the tx or server is wrong... what client is that?

Animal-Economy commented 2 months ago

Client: https://github.com/Animal-Economy/ANEY/releases/tag/v2.0

Animal-Economy commented 2 months ago

Client fork: https://github.com/peercoin/peercoin_flutter

cipig commented 2 months ago

Client fork: https://github.com/peercoin/peercoin_flutter

It' likely related to how that client constructs the tx. I guess it needs to be adapted for your coin. But idk that wallet, so i can't help.

Animal-Economy commented 2 months ago

and when i test it with a komodo fork i get the same error

electrumx error sending transaction: TX decide failed

cipig commented 2 months ago

and when i test it with a komodo fork i get the same error

what do you mean? https://github.com/KomodoPlatform/komodo-wallet-desktop ? that needs specific settings for each coin, see https://github.com/KomodoPlatform/coins/blob/master/coins#L9965-L9982 ... in this case i would try the setting "isPoS": 1

Animal-Economy commented 2 months ago

ok i check thanks

SomberNight commented 2 months ago

Help for creating new shitcoins is out of scope.