TransWikia.com

How to setup Monero RPC authentication?

Monero Asked by Anekdotin on August 24, 2021

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.

3 Answers

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.

Correct answer by SerHack on August 24, 2021

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"}'

Answered by Jon B on August 24, 2021

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.....

Answered by Ashwin on August 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP