Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

Monero Stack Exchange is a question and answer site for developers and users of the secure, private and untraceable cryptocurrency Monero. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Fetching balance for Monero Wallet with getBalance function in JavaScript doesn't work. I am using RPC method for it. Output: Showing HTTP/ error

Ask Question try { //connect to daemon let daemon = await monerojs.connectToDaemonRpc("http://localhost:28081", "pinkumonero", "1234"); let height = await daemon.getHeight(); console.log("Height is:", height); const response = axios.post("http://localhost:28082", publicKey, headers: { 'Content-Type': 'application/json' }).then((responseData) => { dataFetched = responseData.data; console.log("Result of fetching balance", dataFetched); res.status(200).json({ Balance: dataFetched }); } catch (err) { console.log("Error in fetching balance of XMR", err); res.status(500).json({ StatusCode: "0", Message: "Error in XMR balance fetching", error: err.message }) Using curl command in the CLI [curl 127.0.0.1:28082/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_balance","params":{"account_index":0,"address_indices":[0,1]}}' -H 'Content-Type: application/json'] Enthusiast Feb 8 at 8:01

Thanks for contributing an answer to Monero Stack Exchange!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .