Author Topic: Where is the utility to create a json dump of public keys/balances ?  (Read 1648 times)

randpaulcoindev

  • Newbie
  • *
  • Posts: 39

This source code is well written but it seems intentionally to be missing any comments except the most minimal possible.

There should be code that will take a bitcoin style wallet and dump the json is somewhere within the toolkit but I'm not finding it.  I see things to postprocess that json file, but how is it being created initially ?


pc

  • Moderator
  • Jr. Member
  • *****
  • Posts: 218
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #1 on: November 11, 2014, 09:09:44 am »
This source code is well written but it seems intentionally to be missing any comments except the most minimal possible.

I think the code is a mess. Clean code looks different.

There should be code that will take a bitcoin style wallet and dump the json is somewhere within the toolkit but I'm not finding it.  I see things to postprocess that json file, but how is it being created initially ?

Not sure what you mean.
There's this tool http://ptsags.quisquis.de/ for example that monitors the (old) PTS blockchain and creates daily snapshots of PTS balances. It should work for any bitcoin-style blockchain, but requires a large database and lots of time.
Then there's libraries/bitcoin/* which can extract private keys from bitcoin wallets. These are used by the wallet_import_* commands I suppose.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de/
My PTS binary packages for CentOS, Fedora, openSUSE: http://software.opensuse.org/download.html?project=home%3Ap_conrad%3Abts&package=PTS
Please donate: pts:cyrano - thanks!

cube

  • CoreTeam
  • Jr. Member
  • *
  • Posts: 293
  • Bit by bit, we will get there!
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #2 on: November 11, 2014, 10:07:58 am »

I think the code is a mess. Clean code looks different.


I can't agree more.
Contribute to the PTS Development Program!
Please send your donation to ID: bitcube

randpaulcoindev

  • Newbie
  • *
  • Posts: 39
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #3 on: November 11, 2014, 07:24:52 pm »

I haven't really delved into the code but I did notice a distinct lack of comments. I have been accused of not commenting enough on projects, but this codebase has taken it to another level. That is why I am hesitant to offer up any features that required involved code changes.

I'm just trying to figure out what I3 used to dump PTS snapshots in the past. I've looked at the standard stuff in the bitshares_toolkit (or whatever fork) and have not seen anything that specifically takes snapshot dumps. Is it missing and elsewhere or if I am just overlooking it?

What do you guys think is so bad about the codebase beyond the distinct lack of comments?  I am suspecting they left out comments specifically as a defensive mechanism. Lame but it protects the interests of BTS holders.

randpaulcoindev

  • Newbie
  • *
  • Posts: 39
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #4 on: November 11, 2014, 07:34:48 pm »
Quote
Not sure what you mean.
There's this tool http://ptsags.quisquis.de/ for example that monitors the (old) PTS blockchain and creates daily snapshots of PTS balances. It should work for any bitcoin-style blockchain, but requires a large database and lots of time.
Then there's libraries/bitcoin/* which can extract private keys from bitcoin wallets. These are used by the wallet_import_* commands I suppose.

Yes the code that generates those snapshots is what I would like to acquire. I guess you guys never need the script because you can pull it straight off the website?

Is the source code to ptsags.quisquis.de anywhere on github or available? 

Thanks !  We third party devs need to help each other thats for sure.

pc

  • Moderator
  • Jr. Member
  • *****
  • Posts: 218
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #5 on: November 11, 2014, 08:09:27 pm »
Yes the code that generates those snapshots is what I would like to acquire. I guess you guys never need the script because you can pull it straight off the website?

Is the source code to ptsags.quisquis.de anywhere on github or available? 

Actually I created the site in response to this request: https://bitsharestalk.org/index.php?topic=2869.0
The source + instructions are available here: http://ptsags.quisquis.de/howto.html

Quote
What do you guys think is so bad about the codebase beyond the distinct lack of comments?

Classes are too big. Methods are too big. Too many levels of indentation within a single method.
These are not hard criteria, of course, but telltale signs of hard-to-read code. Hard to read code is a maintenance nightmare.
The lack of comments makes things worse, in this case.

Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de/
My PTS binary packages for CentOS, Fedora, openSUSE: http://software.opensuse.org/download.html?project=home%3Ap_conrad%3Abts&package=PTS
Please donate: pts:cyrano - thanks!

randpaulcoindev

  • Newbie
  • *
  • Posts: 39
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #6 on: November 21, 2014, 06:10:28 am »

So it works with PTS if I increase java memory although I have yet to find where the data is dumped.

There is a problem with RPC (Ron Paul Coin). On the first block where is more than 1 transaction it gets stuck on the block the same block.  Something about the DBCache is broken in regards to RPC and throws a null pointer exception later on.

FreeTrade did some snapshots on non-PTS coins. Did you have similar problems? Did you patch the code?  Would you wish to make it available if so?

pc

  • Moderator
  • Jr. Member
  • *****
  • Posts: 218
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #7 on: November 21, 2014, 02:34:01 pm »

So it works with PTS if I increase java memory although I have yet to find where the data is dumped.

> Run the script "bin/genindex.sh -r DATADIR" in regular intervals, replacing DATADIR with the full path to the directory for generated files.


There is a problem with RPC (Ron Paul Coin). On the first block where is more than 1 transaction it gets stuck on the block the same block.  Something about the DBCache is broken in regards to RPC and throws a null pointer exception later on.

FreeTrade did some snapshots on non-PTS coins. Did you have similar problems? Did you patch the code?  Would you wish to make it available if so?

PM me the exception, the json dump of the block where it happens and the json dumps of the transactions. I'll have to modify the code slightly for the final PTS snapshot anyway.

I don't know how ft made his snapshots.
Bitcoin - Perspektive oder Risiko? ISBN 978-3-8442-6568-2 http://bitcoin.quisquis.de/
My PTS binary packages for CentOS, Fedora, openSUSE: http://software.opensuse.org/download.html?project=home%3Ap_conrad%3Abts&package=PTS
Please donate: pts:cyrano - thanks!

freetrade

  • Newbie
  • *
  • Posts: 31
Re: Where is the utility to create a json dump of public keys/balances ?
« Reply #8 on: November 22, 2014, 05:44:19 am »
Here's the code to add to generate a hashmap of balances -

https://bitsharestalk.org/index.php?topic=1714.msg27320#msg27320