Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authentication in example outdated? #94

Open
ghost opened this issue Jun 23, 2019 · 1 comment
Open

authentication in example outdated? #94

ghost opened this issue Jun 23, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 23, 2019

Authentication in the example did not work for me:
# rpc_user and rpc_password are set in the bitcoin.conf file
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332"%(rpc_user, rpc_password))

Instead I followed this source:
https://github.com/bitcoin/bitcoin/blob/master/doc/JSON-RPC-interface.md#json-rpc-interface

Secure authentication: By default, Bitcoin Core generates unique login credentials each time it restarts and puts them into a file readable only by the user that started Bitcoin Core, allowing any of that user's RPC clients with read access to the file to login automatically. The file is .cookie in the Bitcoin Core configuration directory, and using these credentials is the preferred RPC authentication method. If you need to generate static login credentials for your programs, you can use the script in the share/rpcauth directory in the Bitcoin Core source tree. As a final fallback, you can directly use manually-chosen rpcuser and rpcpassword configuration parameters---but you must ensure that you choose a strong and unique passphrase (and still don't use insecure networks, as mentioned above).

The cookie-method worked for me. With the this mehtod, the example would look like this::
#The file .cookie in the Bitcoin Core configuration directory specifies your login credentials each time bitcoin core is started
rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332"%("__cookie__", "yourpassword")

@s-tikhomirov
Copy link

I'm facing the same issue but don't need cookie-based authentication for local experiments on regtest... But I also don't see any .cookie file in ~/.bitcoin (if that's what is meant by configuration directory).

Is there a way to force authentication based on static credentials?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant