Skip to content

iot2tangle/deprecated-cmake-mam

Repository files navigation

IOT2TANGLE Cmake based Entangled MAM Library

The following repo allows to build Entangled MAM examples to send and receive messages via the new MAM Protocol using Cmake instead of Bazel. The main reason to transition from Bazel to Cmake is portability: Bazel does not perform very well on IoT devices (it does not even provide an installer for Raspberry Pi3B).

Why do we need this?

Since IOT2TANGLE requires us to build code to send data over MAM2 on different IoT devices, a build system that can run on SoCs such as ESP32, STM32, etc. was needed to compile the required code. Cmake allows us to do so while keeping a clear relation with Entangled modifications.

This repositorie reflects official Entangled 100% adding only the headers generated by Bazel and the CMakeLists.txt files to indicate dependencies and targets. Future modifications on Entangled should be easily absorved by adding new headers if needed and entries to the CMakesLists.txt files.

Installation and usage

The following instructions cover Unix based systems (Linux/MacOS). Be sure to have GNU Compiler Collection (GCC) and Cmake installed before running the following commands.

git clone https://github.com/iot2tangle/cmake-mam.git
cd cmake-mam
cmake .
make

Once the build is done, you can seek for the send-msg and recv executables inside mam folder. To send a message (be sure to use nodes without SSL and do not include the http://):

./send-msg node05.iotatoken.nl 16265 YOURSEED9YOURSEED9YOURSEED9YOURSEED9YOURSEED9YOURSEED9YOURSEED9YOURSEED9YOURSEED "Testing MAM2 sending script built with Cmake" "no"

If everything went well you should get an Address, Message ID and Bundle.

Address: VSBDFUUIOYGYSYFAOCCUBFSJGZDIDLNMBCDHENGGYPKMCDZYGLZTBPVSTPQENVSRJXFMWWRZRLYRFUTZX 
Message ID: IONONZOXVGTNGVEOCXPUI
Bundle: SLMYHEVDFVLIRCWGJLGTJ9SZZEGNOFKUIHGOLGKVPBRBWXGVTCKPSGXK9RBXICCSSVPSJDYRPHLKSGEEYSLMYHEVDFVLIRCWGJLGTJ9SZZEGNOFKUIHGOLGKVPBRBWXGVTCKPSGXK9RBXICCSSVPSJDYRPHLKSGEEY

To fetch a given message we use the recv program and pass node, port and Bundle as arguments

./recv node05.iotatoken.nl 16265 SLMYHEVDFVLIRCWGJLGTJ9SZZEGNOFKUIHGOLGKVPBRBWXGVTCKPSGXK9RBXICCSSVPSJDYRPHLKSGEEYSLMYHEVDFVLIRCWGJLGTJ9SZZEGNOFKUIHGOLGKVPBRBWXGVTCKPSGXK9RBXICCSSVPSJDYRPHLKSGEEY

Final comments

This is a work in progress and requires a lot of optimization to clean up unneeded dependencies being included by Bazel that have an impact on the binaries size. As we publish this code the send-msg script is 1.2MB (around 1MB when built optimized). Because some IoT devices have 1MB of Flash memory the size of this binaries needs to be reduced.


IOTA Entangled Monorepo

Build status

This is a monorepo containing all you need to get [IOTA] operating in C/C++

Containing IOTA components, models as well as cryptography primitives used in IOTA.

Content:

Component Description
[Tanglescope] A monitoring tool for the Tangle
[MAM] A low level implementation for MAM
[CIRI] (WIP) A low level implementation of IOTA node largely inspired by [IRI]
[CClient] A low level IOTA client implementation

Building

bazel test //...

Developing Entangled

  • Be sure to run ./tools/hooks/autohook.sh install after initial checkout!
  • Pass -c dbg for building with debug symbols.

Tools required for running git commit hook

  • buildifier
  • clang-format

Buildifier

Buildifier can be installed with bazel or go

Install with go

  1. change directory to $GOPATH
  2. run $ go get github.com/bazelbuild/buildtools/buildifier The executable file will be located under $GOPATH/bin
  3. make a soft link for global usage, run $ sudo ln -s $HOME/go/bin/buildifier /usr/bin/buildifier

Install with bazel

  1. clone bazelbuild/buildtools repository $ git clone https://github.com/bazelbuild/buildtools.git
  2. change directory to buildtools
  3. build it with bazel command, $ bazel build //buildifier The executable file will be located under path/to/buildtools/bazel-bin
  4. make a soft link

clang-format

clang-format can be installed by command:

  • Debian/Ubuntu based: $ sudo apt-get install clang-format
  • OSX: $ brew install clang-format

Contributors

thibault-martinez
thibault-martinez
tsvisabo
tsvisabo
th0br0
th0br0
oopsmonk
oopsmonk
ifullgaz
ifullgaz
HowJMay
HowJMay
jkrvivian
jkrvivian
rajivshah3
rajivshah3