Stoxumd-compatible serialization and transaction signing library
C++ library to create, sign, and serialize
Stoxum transactions
before submission to the Stoxum Consensus Ledger
(stoxumd).
Duplicates much of the functionality of the
sign
RPC function without the overhead of a JSON library,
network delay<stoxum/protocols, needing to trust a 3rd party's stoxumd,
nor needing to run your own stoxumd.
stoxum-libpp includes a git submodule to include the stoxumd source code, which is not cloned by default. To get the stoxumd source, either clone this repository using
$ git clone --recursive <location>
or after cloning, run the following commands
$ git submodule init
$ git submodule update
Note: even though the entire stoxumd source tree is included in the submodule, only a subset of it is used by the library.
CMake project installation example:
-
Copy, clone, or submodule the library into your project, eg:
/ My Project / extras / stoxum-libpp **library tree** / src **program tree** CMakeLists.txt
-
Edit your
CMakeLists.txt
file to include the stoxum-libpp config, and the include directories you'll need in your source code:... add_subdirectory(extras/stoxum-libpp/src/unity) # Include paths include_directories( SYSTEM extras/stoxum-libpp/extras/stoxumd/src extras/stoxum-libpp/extras/stoxumd/src/beast/include extras/stoxum-libpp/extras/stoxumd/src/beast/extras )
-
If you don't already have the boost and OpenSSL libraries included in your project, you can use the utility functions provided by stoxumd
list(APPEND CMAKE_MODULE_PATH "extras/stoxum-libpp/extras/stoxumd/Builds/CMake") include(CMakeFuncs) # Boost library use_boost( regex system thread) target_link_libraries(${YOUR_APP_NAME} ${Boost_LIBRARIES}) # OpenSSL library set(openssl_min 1.0.2) use_openssl(${openssl_min}) target_link_libraries(${YOUR_APP_NAME} ${OPENSSL_LIBRARIES}) ...
Some code examples are provided in src/test/stoxum-libpp_demo.cpp
to demonstrate how to create, sign, and verify the signature of a
transaction. Building and running this demo is an optional step to
verify that dependencies are installed and available as expected.
Note that the demo is not a comprehensive suite of tests of the relevant stoxumd functionality; that is covered by stoxumd's unit tests.
In addition to the Usage dependencies, building the demo requires
For linux and other unix-like OSes, run the following commands:
$ cd ${YOUR_STOXUM_LIBPP_DIRECTORY}
$ mkdir -p build/gcc.debug
$ cd build/gcc.debug
$ cmake ../.. -Dtarget=gcc.debug
$ cmake --build .
$ ./stoxumlibppdemo
For 64-bit Windows, open a MSBuild Command Prompt for Visual Studio and run the following commands:
> cd %YOUR_STOXUM_LIBPP_DIRECTORY%
> mkdir build
> cd build
> cmake -G"Visual Studio 14 2015 Win64" ..
> cmake --build .
> .\Debug\stoxumlibppdemo.exe
32-bit Windows builds are not officially supported.