There is a bounty on this issue. The amount is in the title. The reward will be awarded to the first person or group of people who resolve this issue.
If you are starting to work on this bounty, please write a comment so that we can assign the issue to you. We expect contributors to provide a PR in a reasonable timeframe or, in case of an extensive work, updates on their progress. We will unassign the issue if we feel the assignee is not responsive or has abandoned the task.
Read the [full conditions and details](https://github.com/woodser/monero-cpp/blob/master/docs/bounties.md) of the bounty system.
message(FATAL_ERROR"Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent")
A C++ library for creating Monero applications using native bindings to [monero v0.18.3.3 'Fluorine Fermi'](https://github.com/monero-project/monero/tree/v0.18.3.3).
A C++ library for creating Wownero applications using native bindings to Wownero.
* Supports fully client-side wallets by wrapping [wallet2.h](https://github.com/monero-project/monero/blob/master/src/wallet/wallet2.h).
* Supports fully client-side wallets by wrapping wallet2.
* Supports multisig, view-only, and offline wallets.
* Uses a clearly defined [data model and API specification](https://woodser.github.io/monero-java/monero-spec.pdf) intended to be intuitive and robust.
* Query wallet transactions, transfers, and outputs by their properties.
* Receive notifications when wallets sync, send, or receive.
* Tested by over 100 tests in [monero-java](https://github.com/woodser/monero-java) and [monero-ts](https://github.com/woodser/monero-ts) using JNI and WebAssembly bindings.
* Unit tests
## Table of contents
Forked from [monero-cpp](https://github.com/woodser/monero-cpp) and modified, credits
go to the original author.
* [Sample code](#sample-code)
* [Documentation](#documentation)
* [Using monero-cpp in your project](#using-monero-cpp-in-your-project)
* [Related projects](#related-projects)
* [License](#license)
* [Donations](#donations)
## Example usage
## Sample code
Install the following into, for example, `/usr/local/`:
```c++
// create a wallet from a seed phrase
monero_wallet_config wallet_config;
wallet_config.m_seed = "hefty value later extra artistic firm radar yodel talent future fungal nutshell because sanity awesome nail unjustly rage unafraid cedar delayed thumbs comb custom sanity";
* [API and model overview with visual diagrams](https://woodser.github.io/monero-java/monero-spec.pdf)
* [monero-ts documentation](https://github.com/woodser/monero-ts#documentation) provides additional documentation which translates to monero-cpp
## Using monero-cpp in your project
This project may be compiled as part of another application or built as a shared or static library.
```cpp
#include<iostream>
For example, [monero-java](https://github.com/woodser/monero-java) compiles this project to a shared library to support Java JNI bindings, while [monero-ts](https://github.com/woodser/monero-ts) compiles this project to WebAssembly binaries.
#include "wallet/wownero_wallet_full.h"
#include "utils/wownero_utils.h"
### Linux
using namespace std;
wownero_wallet* wallet_restored = nullptr;
int main() {
// create a wallet from a seed phrase into /tmp/test.keys
4. Follow instructions to install [unbound](https://unbound.docs.nlnetlabs.nl/en/latest/getting-started/installation.html) for Linux to your home directory (e.g. `~/unbound-1.19.0`).
5. Build monero-project, located as a submodule at ./external/monero-project. Install [dependencies](https://github.com/monero-project/monero#dependencies) as needed for your system, then build with: `make release-static -j8`
6. Link to this library's source files in your application, or build monero-cpp to a shared library in ./build: `./bin/build_libmonero_cpp.sh`
wallet_restored->sync(my_sync_listener);
### macOS
// start syncing the wallet continuously in the background
wallet_restored->start_syncing();
1. Clone the project repository if applicable: `git clone --recurse-submodules https://github.com/woodser/monero-cpp.git`
3. Follow instructions to install [unbound](https://unbound.docs.nlnetlabs.nl/en/latest/getting-started/installation.html) for macOS to your home directory (e.g. `~/unbound-1.19.0`).
4. Build monero-project, located as a submodule at ./external/monero-project. Install [dependencies](https://github.com/monero-project/monero#dependencies) as needed for your system, then build with: `make release-static -j8`
5. Link to this library's source files in your application, or build monero-cpp to a shared library in ./build: `./bin/build_libmonero_cpp.sh`
### Windows
1. Download and install [MSYS2](https://www.msys2.org/).
2. Press the Windows button and launch `MSYS2 MINGW64` for 64 bit systems or `MSYS2 MINGW32` for 32 bit.
3. Update packages: `pacman -Syu` and confirm at prompts.
4. Relaunch MSYS2 (if necessary) and install dependencies:
5. Clone repo if installing standalone (skip if building as part of another repo like monero-java or monero-ts): `git clone --recursive https://github.com/woodser/monero-cpp.git`
7. Build monero-project, located as a submodule at ./external/monero-project. Install [dependencies](https://github.com/monero-project/monero#dependencies) as needed for your system, then build with:
For 64 bit: `make release-static-win64`
For 32 bit: `make release-static-win32`
8. Link to this library's source files in your application, or build monero-cpp to a shared library (libmonero-cpp.dll) in ./build: `./bin/build_libmonero_cpp.sh`
## Running sample code and tests
1. In CMakeLists.txt, set the flags to build:
set(BUILD_LIBRARY ON)
set(BUILD_SAMPLE ON)
set(BUILD_SCRATCHPAD ON)
set(BUILD_TESTS ON)
2. `./bin/build_libmonero_cpp.sh`
3. Run the app, for example: `./build/sample_code`
staticstd::vector<std::shared_ptr<monero_key_image>>deserialize_key_images(conststd::string&key_images_json);// TODO: remove this specialty util used once
staticstd::vector<std::shared_ptr<wownero_key_image>>deserialize_key_images(conststd::string&key_images_json);// TODO: remove this specialty util used once
// TODO: template implementation here, could move to monero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
// TODO: template implementation here, could move to wownero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
// TODO: template implementation here, could move to monero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
// TODO: template implementation here, could move to wownero_utils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation
if(config.m_can_split!=boost::none&&config.m_can_split.get())throwstd::runtime_error("Cannot split transactions with create_tx(); use create_txs() instead");
std::vector<std::shared_ptr<monero_tx_wallet>>sweep_account(constmonero_tx_config&config);// sweeps unlocked funds within an account; private helper to sweep_unlocked()
std::vector<std::shared_ptr<wownero_tx_wallet>>sweep_account(constwownero_tx_config&config);// sweeps unlocked funds within an account; private helper to sweep_unlocked()
// blockchain sync management
mutablestd::atomic<bool>m_is_synced;// whether or not wallet is synced
@ -287,7 +287,7 @@ namespace monero {
boost::threadm_syncing_thread;// thread for auto sync loop
boost::mutexm_syncing_mutex;// synchronize auto sync loop
voidrun_sync_loop();// run the sync loop in a thread
monero_sync_result lock_and_sync(boost::optional<uint64_t>start_height=boost::none);// internal function to synchronize request to sync and rescan
monero_sync_result sync_aux(boost::optional<uint64_t>start_height=boost::none);// internal function to immediately block, sync, and report progress
wownero_sync_result lock_and_sync(boost::optional<uint64_t>start_height=boost::none);// internal function to synchronize request to sync and rescan
wownero_sync_result sync_aux(boost::optional<uint64_t>start_height=boost::none);// internal function to immediately block, sync, and report progress
std::shared_ptr<monero_output_query>copy(conststd::shared_ptr<monero_output_wallet>&src,conststd::shared_ptr<monero_output_wallet>&tgt)const;// TODO: necessary to override all super classes?
std::shared_ptr<wownero_output_query>copy(conststd::shared_ptr<wownero_output_wallet>&src,conststd::shared_ptr<wownero_output_wallet>&tgt)const;// TODO: necessary to override all super classes?
std::shared_ptr<monero_tx_query>copy(conststd::shared_ptr<monero_tx_wallet>&src,conststd::shared_ptr<monero_tx_wallet>&tgt)const;// TODO: necessary to override all super classes?
std::shared_ptr<wownero_tx_query>copy(conststd::shared_ptr<wownero_tx_wallet>&src,conststd::shared_ptr<wownero_tx_wallet>&tgt)const;// TODO: necessary to override all super classes?
wallet->sync();// TODO monero-project: creating multisig tx fails if wallet not explicitly synced before import_multisig_hex: https://github.com/monero-project/monero/issues/6850
wownero_wallet*wallet=wallets[i];
wallet->sync();// TODO wownero-project: creating multisig tx fails if wallet not explicitly synced before import_multisig_hex: https://github.com/wownero-project/wownero/issues/6850