satstack
satstack copied to clipboard
Auto-detect RPC server credentials
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.
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