4

I am currently experimenting on testnet.

  • server a = monero wallet
  • server b = website

I have the monerod client synced. I run the monerod and monero-wallet-rpc on server a. I want to make my commands from server b. monero rpc command

./monero-wallet-rpc  --wallet-file testwallet --password test --rpc-bind-port 28080 --daemon-address 127.0.0.1:28081 --testnet --daemon-login test:test

monerod command

./monerod  --rpc-login test:test --testnet --rpc-bind-ip=127.0.0.1 --log-level=1

It gets stuck at

2018-02-01 22:42:51.060     7f577a44b780        INFO    global  contrib/epee/include/net/http_server_impl_base.h:76      Binding on 127.0.0.1:28080
2018-02-01 22:42:51.060     7f577a44b780        WARN    wallet.rpc      src/wallet/wallet_rpc_server.cpp:2945    Starting wallet rpc server

Any attempts to contact the RPC server from server b results in 401 unauthorized. When I start the monero-wallet-cli it works well.

user36303
  • 34,858
  • 2
  • 57
  • 123
Anekdotin
  • 185
  • 1
  • 7

3 Answers3

4

401 HTTP error is defined as UNAUTHORIZED error meaning you don't have the permission to call the RPC API.

At the moment, Monero Wallet RPC requires authentication by default, username is: monero , password is a randomly generated string.

To disable the login: add the --disable-rpc-login flag to the command line.

If you want to specify a username and a password, add the --rpc-login username:password where username is your username and password is your password.

user36303
  • 34,858
  • 2
  • 57
  • 123
SerHack
  • 540
  • 4
  • 22
2

I had to explicitly specify digest authentication to get past this with curl

curl -u monero:APASSWORD --digest -X POST http://127.0.0.1:42069/json_rpc '{"jsonrpc":"2.0","method":"getaddress","params": null,"id":"11111"}'
Jon B
  • 121
  • 1
2

It seem like you have started the RPC correctly. Usually the RPC just stops at 'Starting wallet rpc wallet server' You are getting 401 because you might not be using using digest auth. You need to provdide the credentials used with --rpc-login rpc_username:rpc_password like this - curl -u rpc_username:rpc_password --digest -X POST.....

Ashwin
  • 21
  • 1