This project provides a Java interface for managing a Monero wallet.
The interface relies on a running instance of Monero Wallet RPC to manage the wallet. Monero Wallet RPC is an application that manages a Monero wallet via remote procedure calls and relies on a full node to interact with the Monero blockchain.
- Download and extract the latest Monero CLI for your platform.
- In a command terminal,
cd
to the extracted directory. - Create a Monero wallet for development and tests:
- New testnet wallet:
./monero-wallet-cli --testnet --daemon-address http://node.xmrbackb.one:28081
- Restore testnet wallet:
./monero-wallet-cli --restore-deterministic-wallet --testnet --daemon-address http://node.xmrbackb.one:28081
- New testnet wallet:
- Start monero-wallet-rpc:
- Example: wallet name
TestWallet
, userrpc_user
, passwordabc123
:./monero-wallet-rpc --testnet --daemon-address http://node.xmrbackb.one:28081 --rpc-bind-port 18082 --wallet-file /Applications/monero-v0.11.1.0/TestWallet --rpc-login rpc_user:abc123
- Example: wallet name
- Download the latest code from this GitHub repository:
- Create a directory to hold project assets:
mkdir monero_wallet_java && cd monero_wallet_java
- Check out the code:
git clone https://github.com/woodser/monero-wallet-java.git
- Optionally import the Java projects into an IDE like Eclipse
- Create a directory to hold project assets:
- If necessary, configure the default wallet for running JUnit tests within TestUtils.java. The RPC domain, port, and authentication username and password can be configured.
- Run JUnits under src/test/java to verify the setup. Note that
TestMoneroWalletSends.java
requires sufficient funds to be available in the wallet to test sending payments (hence why testnet mode is recommended, so it's not real XMR).
public int getHeight();
public BigInteger getBalance();
public BigInteger getUnlockedBalance();
public MoneroAddress getStandardAddress();
public MoneroIntegratedAddress getIntegratedAddress(String paymentId);
public MoneroIntegratedAddress splitIntegratedAddress(String integratedAddress);
public String getMnemonicSeed();
public String getViewKey();
public URI toUri(MoneroUri uri);
public MoneroUri fromUri(URI uri);
public void saveBlockchain();
public void stopWallet();
public MoneroTransaction send(String address, BigInteger amount, String paymentId, BigInteger fee, int mixin, int unlockTime);
public MoneroTransaction send(MoneroAddress address, BigInteger amount, String paymentId, BigInteger fee, int mixin, int unlockTime);
public MoneroTransaction send(MoneroPayment payment, String paymentId, BigInteger fee, int mixin, int unlockTime);
public MoneroTransaction send(List<MoneroPayment> payments, String paymentId, BigInteger fee, int mixin, int unlockTime);
public List<MoneroTransaction> sendSplit(List<MoneroPayment> payments, String paymentId, BigInteger fee, int mixin, int unlockTime, Boolean newAlgorithm);
public List<MoneroTransaction> sweepDust();
public List<MoneroTransaction> getAllTransactions();
public List<MoneroTransaction> getTransactions(boolean getIncoming, boolean getOutgoing, boolean getPending, boolean getFailed, boolean getMemPool, Collection<String> paymentIds, Integer minHeight, Integer maxHeight);
This project is licensed under Apache 2.0 and MIT.