Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: orionstark on April 19, 2021, 07:03:43 AM



Title: Bitcoin RPC return 401 when it being called before the IBD complete
Post by: orionstark on April 19, 2021, 07:03:43 AM
Hello, Is it normal? I've already set the config RPC with user and password correctly. But, when I'm trying to call it, it returns a 401 response.


Title: Re: Bitcoin RPC return 401 when it being called before the IBD complete
Post by: NotATether on April 19, 2021, 08:11:47 AM
The 401 response has nothing to do with the initial block download, it literally represents "Unauthorized", and it's returned when you're not passing the username and password using --rpcuser and --rpcpassword command line switches. (See this issue: https://github.com/bitcoin/bitcoin/issues/9661)

It's also returned when you did not specify a password at launch and you did not use the temporary password inside the .cookie file inside the datadir when you made the call.

How are you making the RPC call? Are you using curl from another machine with the user and password in your Bitcoin.conf, or are you doing this from a programming language, and which one? We need more information about how you're performing the call.