I downloaded my local node on the Monero testnet, specifically I used:

monerod --testnet --db-sync-mode fast --prune-blockchain

After successfully launching the node, I mined some XMR. My intention is to test Monero transactions with the monerojs Javascript library.

Currently on my Monero address I have about 1.5 XMR but when I try to view my balance from the local Javascript console, it always shows me a balance equal to zero.

This is the Javascript code I used:

let wallet = await monerojs.createWalletFull({
    networkType: MoneroNetworkType.TESTNET,
    password: "<MyPass>",
    mnemonic: "<myMnemonic>",
    server: new monerojs.MoneroRpcConnection(""),

const syncResult = await wallet.sync();
console.log('Sync progress:', syncResult);

let account= await wallet.getAccount(0)
  const balance=account.getBalance() // or const balance=parseInt(account.getBalance().toString(), 10)

BigInteger { _d: [], _s: 0 }



Can someone explain to me if I'm doing the wrong connection to the daemon or some wallet configuration?

  • Have you fully synced/scanned the blockchain with your wallet? Your post above doesn't show you have actually done this. See example usage in the tests: src/test/TestMoneroWalletFull.js
    – jtgrassie
    Jun 16, 2023 at 2:01
  • I was doing the sync function wrong at the node. Now works. The only thing is that it is very slow to sync the wallet. If I do it via monero-wallet-cli it's much faster
    – AlexCav
    Jun 16, 2023 at 9:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.