Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: ZeWaren on May 22, 2014, 09:03:30 AM



Title: Extracting currency names from wallets or using RPC
Post by: ZeWaren on May 22, 2014, 09:03:30 AM
Hi all,

I've written a simple script to extract the amount of coins in all my cryptocurrency wallets.

My problem now is that amounts alone won't help me much. What I need would be to match them with their currency name.

Does anyone know, given a wallet data directory and a cryptocoin binary (*-qt.exe), how to extract the associated currency unit (BTC, LTC, DOGE, DRK, etc.)?

I didn't see this information anywhere in the RPC endpoints, and I don't think the wallet database files are self-aware enough to tell me.

Thanks for any help,


Title: Re: Extracting currency names from wallets or using RPC
Post by: Benson Samuel on May 22, 2014, 09:52:34 AM
Hi all,

I've written a simple script to extract the amount of coins in all my cryptocurrency wallets.

My problem now is that amounts alone won't help me much. What I need would be to match them with their currency name.

Does anyone know, given a wallet data directory and a cryptocoin binary (*-qt.exe), how to extract the associated currency unit (BTC, LTC, DOGE, DRK, etc.)?

I didn't see this information anywhere in the RPC endpoints, and I don't think the wallet database files are self-aware enough to tell me.

Thanks for any help,

Two quick ways that I could think of are:
- Maintain a manual input field to allow the user to enter the coin name.
- Maintain a list of addresses of each coin and validate each one till you get a match.


Title: Re: Extracting currency names from wallets or using RPC
Post by: ZeWaren on May 22, 2014, 11:40:22 AM
Two quick ways that I could think of are:
- Maintain a manual input field to allow the user to enter the coin name.
- Maintain a list of addresses of each coin and validate each one till you get a match.
The idea here is that you should not have to enter any information. The goal of the script is to give you a list of your wallet amounts completely automatically.


Title: Re: Extracting currency names from wallets or using RPC
Post by: Benson Samuel on May 22, 2014, 12:18:26 PM
Two quick ways that I could think of are:
- Maintain a manual input field to allow the user to enter the coin name.
- Maintain a list of addresses of each coin and validate each one till you get a match.
The idea here is that you should not have to enter any information. The goal of the script is to give you a list of your wallet amounts completely automatically.

Extract the daemon name?


Title: Re: Extracting currency names from wallets or using RPC
Post by: ZeWaren on May 22, 2014, 01:13:17 PM
Extract the daemon name?
Won't give the currency unit (BTC, LTC, DOGE, etc).


Title: Re: Extracting currency names from wallets or using RPC
Post by: cr1776 on May 22, 2014, 02:05:35 PM
Extract the daemon name?
Won't give the currency unit (BTC, LTC, DOGE, etc).

Why?

bitcoind
litecoind
dogecoind
etc

all shows the name based on the name of the daemon you are querying (or bitcoin-qt etc).  Or if you know the wallet data directory, it will include something unique that most likely includes the name.



Title: Re: Extracting currency names from wallets or using RPC
Post by: fbueller on May 22, 2014, 02:08:02 PM
Seemingly everyone here has forgotten about the version byte used in addresses!

Create a new address over RPC, decode the base58 into hex, and the first byte will indicate what network you are on. https://en.bitcoin.it/wiki/List_of_address_prefixes If the item isn't on this list, just follow this procedure with your whatevercoin, and you'll get the address byte.


Title: Re: Extracting currency names from wallets or using RPC
Post by: ZeWaren on May 22, 2014, 03:22:35 PM
Seemingly everyone here has forgotten about the version byte used in addresses!

Create a new address over RPC, decode the base58 into hex, and the first byte will indicate what network you are on. https://en.bitcoin.it/wiki/List_of_address_prefixes If the item isn't on this list, just follow this procedure with your whatevercoin, and you'll get the address byte.
Clever.

I think I missed an important information: I'd like the process to be done automatically in a script.

The ideal think would be that if I add a new coin wallet in my wallet directory, the script would be able to extract the wallet amount and its unit.

For example, if I create a Darkcoin wallet there and mine some coins, I would get from the script something like: "234.56 QRK".


Title: Re: Extracting currency names from wallets or using RPC
Post by: Benson Samuel on May 22, 2014, 07:18:29 PM
Seemingly everyone here has forgotten about the version byte used in addresses!

Create a new address over RPC, decode the base58 into hex, and the first byte will indicate what network you are on. https://en.bitcoin.it/wiki/List_of_address_prefixes If the item isn't on this list, just follow this procedure with your whatevercoin, and you'll get the address byte.

+1

If your hacking this on PHP, PHPCoinaddress is a good direction to go towards.
https://bitcointalk.org/index.php?topic=200042.0

But if you are looking at extracting this info from a daemon, can't see how that can be done without customizing the daemon itself.


Title: Re: Extracting currency names from wallets or using RPC
Post by: beachparty on May 22, 2014, 08:23:49 PM
As someone said here use something to parse daemon name - remove coind and here u go :D