node-monero-rpc
node wrapper for monero daemon and wallet rpc
Table of Contents
- Installation
- Documentation
- Testing
- Warning
- Projects using node-monero-rpc
- License
Installation
npm install --save monero-rpc
Documentation
Daemon API
Initialisation
Instantiate a new Daemon object:
const Daemon = Daemon const daemon = 'http://localhost:18081'const daemon = 'http://node.monero.hashvault.pro:18081' // or use a remote node
Methods
getLastBlockHeight(callback)
Look up how many blocks are in the longest chain known to the node.
daemon
getLastBlockHeader(callback)
Look up how many blocks are in the longest chain known to the node.
daemon
getBlockHeader(id, callback)
Block header information can be retrieved using either a block's hash or height.
By height:
daemon
By hash:
daemon
getBlock(id, callback)
Full block information can be retrieved by either block height or hash, like with the block header calls.
daemon
getBlockTemplate(address, reserved, callback)
Get a new block template for mining.
daemon
submitBlock(blob, callback)
Submit a block to the network.
daemon
getKeyImagesSpent(keyImages, callback)
Check if a key image is spent.
daemon
stop(callback)
daemon
getInfo(callback)
Get miscellaneous information about the state of this daemon and the network.
daemon
isTestnet(callback)
Get miscellaneous information about the state of this daemon and the network.
daemon
Wallet API
Warning
All amounts are in atomic units. 1 Monero is 1e12 atomic units.
Initialisation
Start monero-wallet-rpc
:
monero-wallet-rpc --wallet-file mywallet --rpc-bind-port 18082 --disable-rpc-login
Instantiate a new Wallet object:
const Wallet = Walletconst wallet = 'http://localhost:18082'
Methods
getAddress(callback)
Get the wallet's address.
wallet
getBalance(callback)
Get the wallet's balance.
wallet
transfer(options, callback)
Send Monero.
wallet
splitTransfer(options, callback)
Send monero, and split into multiple transactions if required.
wallet
getPayments(paymentId, callback)
Get a list of incoming payments using a given payment id.
wallet
getRandomIntegratedAddress(callback)
Generate a random integrated address.
wallet
getBulkPayments(paymentIds, height, callback)
Get a list of payments using a list of payment ids from a given height.
wallet
Testing
Code is linted with eslint and tested with Jest. Run npm test
to lint and run
test suite.
Warning
This library is not complete. This library probably has bugs. This library
eats babies. Don't use it unless you know what you're getting yourself into.
See the GitHub issues for a list of features which are missing.
Projects using node-monero-rpc
Feel free to create a pull request to add your own project.
- monerod_exporter - Monerod Prometheus exporter
License
Released under the 3-Clause BSD License. See LICENSE
for more information.