cryptocoinjs / coininfo

JavaScript component for crypto currency specific information.
116 stars 114 forks source link

fix the Peercoin network values #79

Closed nohea closed 5 years ago

nohea commented 5 years ago

The coins/ppc.js has incorrect values. i've corrected them, and filled in a lot more relevant values, based on the btc.js file.

I'm a Peercoin team contributor, and the team discussed fixing it.

fanatid commented 5 years ago

can you add link to code (with specific tag or hash) to PR code?

nohea commented 5 years ago

Hi this shows the diff: https://github.com/cryptocoinjs/coininfo/compare/master...nohea:fix-peercoin-network-values

fanatid commented 5 years ago

I asked about something like this: https://github.com/cryptocoinjs/coininfo/blob/299bf3b01a70c932772a7149837c1abe1acb2d41/lib/coins/btc.js#L1-L4

nohea commented 5 years ago

OK, got it. I added a comment:

/*
 info from:
   https://github.com/peercoin/peercoin/blob/master/src/protocol.cpp
*/
nohea commented 5 years ago

OK, i added reference comments for the Peercoin base58, bip44, bip32 values.

FYI - Peercoin v0.7.x (current) is rebased from Bitcoin 0.8.3, which is pre-HD wallet for the core node. So i made references to those sources.

fanatid commented 5 years ago

thank you for links, last question: where precision 1e6 located? I see on blockexplorers 1e8 (but last 2 digest always zero)

nohea commented 5 years ago
+  // from src/util.h:static const int64 COIN = 1000000;
   per1: 1e6,

The raw transactions need to have 1e6 satoshis per coin, well actually they just use a satoshi integer. So building txs need to know this translation value vs bitcoin 1e8.

However, most block explorer functions use the node's RPC interface, which reports in coins: 0.00000000 format. So no translation needed, but that explains 00 for the 7th and 8th decimal places.

I think there may be a page on block explorers where displaying the tx needs this translation. I modified Iquidus explorer for it before.

FYI- in the future, there may be a desire to also account for whether the coin has "Peercoin tx timestamp" (true/false). And also custom/fixed fee calculations (0.01/kb). But that's beyond the scope of this PR.

nohea commented 5 years ago

Thanks for the quick turnaround!

fanatid commented 5 years ago

sorry for delay, published as 4.4.0