How to get the "BTC" abbreviation via command line? I'm writing a module that connects to multiple wallets at once and I would like to have a way I can simply query the coin daemon for its coins abbreviation (not the "microcoins" as asked in a comment below, just the 3 character currency identifier).

Since my module also reads the coins config file, my only solution thus far is to add a parameter in the coins config file:

abbr=BTC


But I was wondering if there was a cleaner way to do this. A simple rpc command that I can pull the abbr from?
I will post my solution, but I still think there should be a cleaner way of doing this.

You would first need to open up (or create) the conf file for the coin which you wish to connect with then add abbr=BTC (or replace 'BTC' with whatever coin abbr you want).

You would then need to open up and read that conf file with your script/module. Since I am working with Python, here a function that does that:



def readCfg(location):
    cfg ={}
    with open(location) as f:
        for line in f:
            line = line.strip()
            if line and not line.startswith("#") and '=' in line: cfg[line.split('=', 1)[0]] = line.split('=', 1)[1]
        return cfg

cfg = readCfg('/home/username/.bitcoin/bitcoin.conf')
print(cfg['abbr'])


I think maybe having a documentation of this method done in other languages would be beneficial to the Bitcoin community. Feel free to expand on my answer until Bitcoin devs decide to add 'BTC' to the output of an rpc call.