satstack icon indicating copy to clipboard operation
satstack copied to clipboard

Auto-detect RPC server credentials

Open onyb opened this issue 5 years ago • 1 comments

If RPC credentials are not found in the config file, try locating the bitcoin.conf in standard paths, and read it from there.

See related issue: #35.

onyb avatar Oct 04 '20 00:10 onyb

Much better to take them from the `.cookie' file. In pyhton on Mac this would mean:

with open("/Users/username/Library/Application Support/Bitcoin/.cookie", "r") as creds:
    cookie = creds.read()
rpc_user = cookie.split(":")[0]
rpc_pass = cookie.split(":")[1]

Where of course /Users/username/Library/Application Support/Bitcoinis your -data-dir

gabridome avatar Nov 18 '20 08:11 gabridome