Skip to content

librat

Nodes in the Minot network that share data are called Rats (here is why). The functionality is shipped as a Rust and C library.

Ubuntu

Our PPA provides .deb files for a system-wide installation. After the setup, you can simply run apt.

sudo apt install librat-dev

Debian-based Distros

The PPA mentioned above is specific to Ubuntu the package itself does not require any system dependencies. Therefore it can be installed manually on all debian-based distros.

Manual .deb Installation
curl -s https://api.github.com/repos/uos/minot/releases/latest \
| grep "browser_download_url" \
| grep ".deb" \
| grep "$(dpkg --print-architecture)" \
| cut -d '"' -f 4 \
| xargs curl -L -O

sudo dpkg -i ./librat-dev_*.deb

The package also installs a pkg-config file, which allows the following usage in CMake.

Example CMake
find_package(PkgConfig REQUIRED)
pkg_check_modules(RAT REQUIRED librat)

add_executable(my_app main.c)
target_include_directories(my_app PRIVATE ${RAT_INCLUDE_DIRS})
target_link_libraries(myfind_package(PkgConfig REQUIRED)
pkg_check_modules(RAT REQUIRED librat)

add_executable(my_app main.c)
target_include_directories(my_app PRIVATE ${RAT_INCLUDE_DIRS})
target_link_libraries(my_app PRIVATE ${RAT_LIBRARIES})

From Source

Building from source generates a static and shared library in the ./target/release/ folder. You will need to clone the repository first.

Build librat from source
git clone https://github.com/uos/minot
cd minot
cargo build --package mt_rat --release

A typical system-wide installation is done by copying the libraries to your linker path. Alternatively, you may change the link path and include search paths in your build system.

sudo cp ./target/release/librat.* /usr/local/lib/
sudo mkdir -p /usr/local/include/rat/
sudo cp ./rat/rat.h /usr/local/include/rat/

Then you can use the library in your C/C++ code.

#include <rat/rat.h>

And link with -lrat.


For using the Rust library, just add this to your dependencies in Cargo.toml.

Cargo.toml
[dependencies]
mt_rat = "0.5.3"