Skip to content

ProjectLibertyLabs/graph-sdk

Repository files navigation

Release Issues

Graph-Sdk is a utility to read and modify social graphs defined by DSNP protocol and stored on Frequency blockchain.

Overview

This repository contains the following modules

  • Core : DSNP compatible social graph implementation in Rust
  • Config : All supported environments and their configuration details
  • Bridge : Graph SDK bridges for other languages
    • jni : JNI bridge for JVM languages
    • ffi : FFI bridge for languages such as C/C++ and Swift
  • Java: Java and Android wrappers around graph sdk.

Build

  1. Install Rust using the official instructions.

  2. Check out this repository

  3. rust-toolchain.toml specifies the standard toolchain to use. If you have rustup installed, it will automatically install the correct toolchain when you run any cargo command.

  4. Running following command will try to build the core library.

    make build

Build and test JNI

  • To build and install the JNI bridge run

    make build-jni
  • To test Java and JNI bridge run

    make test-jni

Protobuf code generation

When modifying any of the protobuf definitions, it is important to perform the following steps to ensure proper serialization and deserialization between JNI and Rust types.

make build-protos
  • If protobuf is not installed run
make install-protos

Build and test FFI

  • To build and install the FFI bridge run

    make bindgen
  • To test FFI bridge run

    make test-ffi
    • FFI tests have a dependency on libsodium-dev and expect it to be installed
     apt-get install -y libsodium-dev

Examples

Here are a few examples of how to use this library: