bitcoin: Unable to call an rpc method via curl with no authentication
My config: ~/.bitcoin/bitcoin.conf
daemon=1
prune=600
maxconnections=12
maxuploadtarget=20
server=1
Version:
$ bitcoind --version
Bitcoin Core Daemon version v0.14.0.0-g43a987c1c
Copyright (C) 2009-2017 The Bitcoin Core developers
Why doesn’t this work and require authentication?
$ curl -v --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8332 (#0)
> POST / HTTP/1.1
> Host: 127.0.0.1:8332
> User-Agent: curl/7.47.0
> Accept: */*
> content-type: text/plain;
> Content-Length: 71
>
* upload completely sent off: 71 out of 71 bytes
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Basic realm="jsonrpc"
< Date: Sun, 16 Apr 2017 05:09:10 GMT
< Content-Length: 0
< Content-Type: text/html; charset=ISO-8859-1
<
* Connection #0 to host 127.0.0.1 left intact
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 23 (14 by maintainers)
You have three options:
@GildedHonour Authentication is not optional. Configuring it yourself is optional, but bitcoind never accepts RPC connections without explicitly or implicitly configured username/password.
__cookie__
is the username.3784b8eb00726c09b275aff93882b7859cf482b8f714931343fds32431234gaa
is the password.Note that the 3rd method isn’t really intended to be used that way. If you need extra work to support it from your client code, it’s much easier to just configure a password with rpcpassword or rpcauth.