Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: Rux on December 28, 2020, 07:30:40 PM



Title: Insight Explorer Address has mismatched network type
Post by: Rux on December 28, 2020, 07:30:40 PM
Hello Community!

I forked Dash's code to start a Community project, with learning in mind.

We managed to get all figured out, but this Insight explorer is killing us, and we want to learn basics.

When we start Insight node, it starts ok, we can see explorer website and even blocks with connection.

But if we click on any block or anything else, we get error and all node goes down.

Error that we get on console is

"error: uncaught exception: TypeError: Address has mismatched network type."

 error: uncaught exception: TypeError: Address has mismatched network type.
    at Function.Address._transformBuffer (/home/rxc/dashcore-node/mynode/node_modules/@dashevo/dashcore-lib/lib/address.js:217:11)
    at Function.Address._transformString (/home/rxc/dashcore-node/mynode/node_modules/@dashevo/dashcore-lib/lib/address.js:296:22)
    at Address._classifyArguments (/home/rxc/dashcore-node/mynode/node_modules/@dashevo/dashcore-lib/lib/address.js:116:20)
    at new Address (/home/rxc/dashcore-node/mynode/node_modules/@dashevo/dashcore-lib/lib/address.js:76:19)
    at Object.Address (/home/rxc/dashcore-node/mynode/node_modules/@dashevo/dashcore-lib/lib/address.js:54:12)
    at TxController.transformOutput (/home/rxc/dashcore-node/mynode/node_modules/@dashevo/insight-api/lib/transactions.js:183:28)
    at Array.map (<anonymous>)
    at TxController.transformTransaction (/home/rxc/dashcore-node/mynode/node_modules/@dashevo/insight-api/lib/transactions.js:86:42)
    at /home/rxc/dashcore-node/mynode/node_modules/@dashevo/insight-api/lib/transactions.js:280:16
    at /home/rxc/dashcore-node/node_modules/async/dist/async.js:4617:26

As i understand that has something with networks.js file, where we define networkMagic to match our network.
File is located at /dashcore-node/mynode/node_modules/@dashevo/dashcore-lib/lib/networks.js

From our source code we have this information

pchMessageStart[0] = 0xd6;
pchMessageStart[1] = 0x93;
pchMessageStart[2] = 0xf3;
pchMessageStart[3] = 0x43;
vAlertPubKey = ParseHex("04e807f1caf222eb75de194e8b83c065c89fbce06b60d0968cdc832bd1ce17ef264362b43df7fd9 7cc7a1a38d69d6b7aab3c16cf7a3a9988fa8816c69a6a3016e1");
nDefaultPort = 23506;
nPruneAfterHeight = 100000;

So we changed networkMagic to 0x4693f343, and p2p port 23506

Should we change anything else from here?

addNetwork({
  name: 'livenet',
  alias: 'mainnet',
  pubkeyhash: 0x4c,
  privatekey: 0xcc,
  scripthash: 0x10,
  xpubkey: 0x488b21e,    // 'xpub' (Bitcoin Default)
  xprivkey: 0x488ade4,   // 'xprv' (Bitcoin Default)
  networkMagic: 0xd693f343,
  port: 23506,

Our source code chainparams.cpp for reference
https://github.com/Ruxiol/ruxcryptoRXC/blob/master/src/chainparams.cpp

When i read error again, it says TypeError: Address has mismatched network type, could that be problem somewhere else, some other file?

If someone could help us understand we would be grateful

Rux, Crypto.ba Community



Title: Re: Insight Explorer Address has mismatched network type
Post by: Rux on December 28, 2020, 07:43:20 PM
From here only logical solution is that we didn't modified these three entries

pubkeyhash: 0x4c,
privatekey: 0xcc,
scripthash: 0x10,

But in source code, we cannot find direct link with those three entries, there is similar line but with long string.




 


Title: Re: Insight Explorer Address has mismatched network type
Post by: Bitcoin_Arena on December 28, 2020, 08:32:14 PM
This kind of problem could easily be identified and solved by people who are more familiar with Dash and insight explorer and not here so I suggest you would try contacting the dash community or Devs.
Have you tried checking out their issues explorer; https://github.com/dashevo/insight-ui/issues



Title: Re: Insight Explorer Address has mismatched network type
Post by: Rux on December 28, 2020, 08:52:03 PM
I'm sorry i posted here, believe me i tried to figure out via Dash community, but nobody answered the question.

I have found something similar but no luck so far, and i have found this lines in codes

if (!bufferVersion.network || (network && network !== bufferVersion.network)) {
    throw new TypeError('Address has mismatched network type.');
  }

https://github.com/dashevo/dashcore-lib/blob/v0.19-dev/lib/address.js#L198

Thanks for the link, will search there.