This is the source code of a Monero JSON-RPC client (for both daemon and wallet) built on .netstandard2.1.
Both a daemon client and wallet client are available. The daemon client interacts with monerod.exe
, and the wallet client interacts with monero-wallet-rpc.exe
Initialize Client
using Monero.Client.Daemon;
var daemonClient = await MoneroDaemonClient.CreateAsync(new Uri("http://127.0.0.1:18082/json_rpc")).ConfigureAwait(false);
Get Connections
List<Connection> connections = await daemonClient.GetConnectionsAsync().ConfigureAwait(false);
For the entire MoneroDaemonClient interface, please click here.
Initialize Client
using Monero.Client.Network;
using Monero.Client.Wallet;
using Monero.Client.Wallet.POD;
// Synchronously Initialize Client
var moneroWalletClient = new MoneroWalletClient(new Uri("http://127.0.0.1:18082/json_rpc"));
// Asynchronously Initialize Client (and Open Wallet) - This is the preferred method of initialization.
var walletClient = await MoneroWalletClient.CreateAsync(MoneroNetwork.Mainnet, "TestMainnet", "123").ConfigureAwait(false);
Open Wallet
// Will throw if wallet is already open.
await moneroWalletClient.OpenWalletAsync("new_wallet3", "banana").ConfigureAwait(false);
Transfer Funds
var cts = new CancellationTokenSource();
var dA = new List<(string address, ulong amount)>()
{
("BfukYd1Dv5YDgkZDhffjmHb1SfzT7Wr1HNTYkyxEmfnXiGepCHgPiaWicRCLHpM2moVNWAxNEVKogU2w58fT", 1000ul),
("SomeOtherMoneroAddress", 3233100ul),
};
var response = await moneroWalletClient.TransferAsync(dA, TransferPriority.Normal, cts.token).ConfigureAwait(false);
For the entire MoneroWalletClient interface, please click here. Note: Unlike the Daemon Client, to perform any action with the Wallet Client, one must first either create a new wallet, or open an existing one (as shown above).
Available on Nuget here.
Install-Package Monero.Client -Version 1.0.1.4
git clone https://github.com/monero-ecosystem/csharp-monero-rpc-client.git
All contributions are welcome. Please make sure your pull request include:
- A detailed description of the issue.
- A detailed description of your solution.
- Make sure your commit messages are descriptive.
If you found this library helpful, donations are appreciated. 89CkXKw3MQLXAinJz2eb8ohmGdDasGxun65ArenNuqXFfDSVbhiqpte4E2PQaxT4yPbsNSXkT4hR2QMFYQneZfBoCX19Wx2