Hello All, could you help, please?
The problem: I try to run a `curl` request but get "401 Unauthorized error"
curl --user testuser --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getrawtransaction", "params": ["e0cee...47ac5", true]}' -H 'content-type: text/plain;' http://127.0.0.1:8332/ -D -
Enter host password for user 'testuser':
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="jsonrpc"
Date: Sat, 02 Sep 2023 18:12:46 GMT
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1
The messages in the debug log of the daemon:
2023-09-02T15:59:44Z ThreadRPCServer incorrect password attempt from 127.0.0.1:36472
I run `bitcoind` this way:
/mnt/bitcoin/bin/bitcoind -conf=/mnt/bitcoin/bitcoin.conf
Also, I have a symlink for this config:
ll ~/.bitcoin/bitcoin.conf
lrwxrwxrwx 1 user user 25 Sep 1 18:42 /home/user/.bitcoin/bitcoin.conf -> /mnt/bitcoin/bitcoin.conf
Config:
grep -v "#" /mnt/bitcoin/bitcoin.conf | grep -v "^$" daemon=1
daemonwait=1
...
rest=1
rpcallowip=192.168.0.128/25
rpcallowip=127.0.0.1
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
server=1
[main]
[test]
[signet]
[regtest]
`rpcauth` was created this way, and then inserted in the config:
python3 bitcoin/share/rpcauth/rpcauth.py testuser testpasst String to be appended to bitcoin.conf:
rpcauth=testuser:3ad8c2e058a161304a911bcc60c208d2$a364136d41edda037d267e909f9f0355537aefee08b6fd29da2eee59559cf084
Your password:
testpasst
Also, I tried to replace `rpcauth` with
rpcuser=testuser
rpcpassword=testpasst
And did
kill -HUP `cat /mnt/btc_data/bitcoind.pid`
after every config change (idk wether it's needed or not)
Yes, I have "t" at the end of pass everywhere (I'm too frustrated to re-do all this solely to remove the typo, but the password was copy-pasted many times so I 100% sure there's no mistype answering curl)
I tried:
https://bitcoin.stackexchange.com/questions/115668/401-unauthorized-connection-using-python-bitcoinrpchttps://bitcoin.stackexchange.com/questions/106395/bitcoinrpc-authproxy-jsonrpcexception-342-non-json-http-response-with-401-uhttps://bitcoin.stackexchange.com/questions/36433/bitcoin-rpc-works-in-bitcoin-cli-but-not-in-python-bitcoinrpc-no-json-objecthttps://bitcoin.stackexchange.com/questions/77214/bitcoin-rpc-returning-401Bitcoin Core ver 25.0
What am I doing wrong?
Thank you.