A Node.js library for creating Monero applications using RPC and WebAssembly bindings to monero v0.17.2.3 'Oxygen Orion'.
Build Node.js or browser applications using RPC or WebAssembly bindings to monero-project/monero. Wallet implementations are interchangeable by conforming to a common interface, MoneroWallet.js.
// import library
const monerojs = require("monero-javascript");
// connect to daemon
let daemon = await monerojs.connectToDaemonRpc("http://localhost:38081", "superuser", "abctesting123");
let height = await daemon.getHeight(); // 1523651
let feeEstimate = await daemon.getFeeEstimate(); // 1014313512
let txsInPool = await daemon.getTxPool(); // get transactions in the pool
// open wallet on monero-wallet-rpc
let walletRpc = await monerojs.connectToWalletRpc("http://localhost:38084", "rpc_user", "abc123");
await walletRpc.openWallet("sample_wallet_rpc", "supersecretpassword123");
let primaryAddress = await walletRpc.getPrimaryAddress(); // 555zgduFhmKd2o8rPUz...
let balance = await walletRpc.getBalance(); // 533648366742
let txs = await walletRpc.getTxs(); // get transactions containing transfers to/from the wallet
// create wallet from mnemonic phrase using WebAssembly bindings to monero-project
let walletFull = await monerojs.createWalletFull({
path: "sample_wallet_full",
password: "supersecretpassword123",
networkType: "stagenet",
serverUri: "http://localhost:38081",
serverUsername: "superuser",
serverPassword: "abctesting123",
mnemonic: "hefty value scenic...",
restoreHeight: 573936,
});
// synchronize with progress notifications
await walletFull.sync(new class extends monerojs.MoneroWalletListener {
onSyncProgress(height, startHeight, endHeight, percentDone, message) {
// feed a progress bar?
}
});
// synchronize in the background every 5 seconds
await walletFull.startSyncing(5000);
// receive notifications when funds are received, confirmed, and unlocked
let fundsReceived = false;
await walletFull.addListener(new class extends monerojs.MoneroWalletListener {
onOutputReceived(output) {
let amount = output.getAmount();
let txHash = output.getTx().getHash();
let isConfirmed = output.getTx().isConfirmed();
let isLocked = output.getTx().isLocked();
fundsReceived = true;
}
});
// send funds from RPC wallet to WebAssembly wallet
let createdTx = await walletRpc.createTx({
accountIndex: 0,
address: await walletFull.getAddress(1, 0),
amount: "250000000000", // send 0.25 XMR (denominated in atomic units)
relay: false // create transaction and relay to the network if true
});
let fee = createdTx.getFee(); // "Are you sure you want to send... ?"
await walletRpc.relayTx(createdTx); // relay the transaction
// recipient receives unconfirmed funds within 5 seconds
await new Promise(function(resolve) { setTimeout(resolve, 5000); });
assert(fundsReceived);
// save and close WebAssembly wallet
await walletFull.close(true);
cd your_project
or mkdir your_project && cd your_project && npm init
npm install monero-javascript@0.5.6
require("monero-javascript")
to your application code../monerod --stagenet
(or use a remote daemon)../monero-wallet-rpc --daemon-address http://localhost:38081 --stagenet --rpc-bind-port 38084 --rpc-login rpc_user:abc123 --wallet-dir ./
This project uses WebAssembly to package and execute Monero's source code for use in a browser or other WebAssembly-supported environment.
Compiled WebAssembly binaries are committed to ./dist for convenience, but these files can be built independently from source code:
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull && ./emsdk install latest-upstream && ./emsdk activate latest-upstream && source ./emsdk_env.sh
export EMSCRIPTEN=path/to/emsdk/upstream/emscripten
(change for your system)git clone https://github.com/monero-ecosystem/monero-javascript.git
cd monero-javascript
./bin/update_submodules.sh
set(MONERO_WALLET_CRYPTO_LIBRARY "auto" ...
to set(MONERO_WALLET_CRYPTO_LIBRARY "cn" ...
../bin/build_all.sh
(install monero-project dependencies as needed for your system)git clone https://github.com/monero-ecosystem/monero-javascript.git
cd monero-javascript
./monerod --stagenet
(or use a remote daemon)../monero-wallet-rpc --daemon-address http://localhost:38081 --stagenet --rpc-bind-port 38084 --rpc-login rpc_user:abc123 --wallet-dir ./
WALLET_RPC_CONFIG
and DAEMON_RPC_CONFIG
).npm test
npm run test -- --grep "Can get transactions"
./bin/start_wallet_rpc_test_servers.sh
./bin/build_browser_tests.sh
This project is licensed under MIT.
If this library brings you value, please consider donating.
46FR1GKVqFNQnDiFkH7AuzbUBrGQwz2VdaXTDD4jcjRE8YkkoTYTmZ2Vohsz9gLSqkj5EM6ai9Q7sBoX4FPPYJdGKQQXPVz
Monero Copyright (c) 2014-2021 The Monero Project. Portions Copyright (c) 2012-2013 The Cryptonote developers. Table of Contents Development resources Vulnerability response Research Announcements Tra
monero-regex Regular expression for matching Monero (XMR) addresses Install ~ ❯❯❯ npm install monero-regex Usage const moneroRegex = require('monero-regex');moneroRegex().test('nodejsrocks 47BnvD18P45
JavaScript miner for the cryptocurrency Monero Blockchain (XMR) using Coin-Hive �� Use Client's CPU Power Monero is different. To mine Monero, you have to calculate hashes with an algorithm called Cry
Monero Ban List This is my personal, daily updating, mirror of the blocklists at gui.xmr.pm Upstream https://gui.xmr.pm/files/block.txt https://gui.xmr.pm/files/block_tor.txt To use, download the bloc
docker-monero Built from source monero Docker images based on Alpine Linux Pulling docker pull cornfeedhobo/monero Running the Daemon docker run -dit --name monero \ -v $HOME/.bitmonero:/root/.bitmon
Bitwyre's Monero Runs the Monero monerod full-node in a container. Copyright (C) 2020, Bitwyre Technologies LLC. Authors Yefta Sutanto