I'm taking address and viewkey as input then want to return its balance in my expressjs project. How to call monero blockchain from nodejs for checking balance of any paper wallet?
1 Answer
There are several nodejs packages for working with wallets. They essentially just wrap the JSON-RPC methods on the daemon / wallet RPC interfaces.
You don't actually need a wrapper though as you can just call the JSON-RPC methods directly. For getting the balance, you would call this. The examples use cURL at the command line, but if you know how to make HTTP requests in nodejs, it should be pretty obvious what request payloads to use and the example responses show what JSON data you'll get back.
-
As far as I know you cant add a view key there, so before you can use the JSON-RPC calls there you need to create a view only simplewallet frist or?– onefoxCommented Aug 30, 2018 at 10:06
-
No. A paper wallet has everything needed to view its balance as it has private spend and view keys. A view-only wallet simply doesn't have a spend key. This question is about a paper-wallet, not a view-only wallet. Commented Aug 30, 2018 at 11:00
-
Yes the paper wallet has everything but the call you linked needs a wallet behind it or? so you have to "create" a wallet from the paper wallet first if I am correct. Or how do you use the linked call with only the address and viewkey?– onefoxCommented Aug 30, 2018 at 11:24
-
1See what you're getting at, yes, the linked monero-wallet-rpc call indeed requires a wallet file which can be first created from seed of the paper wallet. Any nodejs package that operates on the daemon instead of wallet RPC, can of course use the paper wallet view-key directly. Commented Aug 30, 2018 at 11:32