Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Akita Meshtastic IPFS Plugin

Organization: Akita Engineering Website: www.akitaengineering.com Contact Email: info@akitaengineering.com

This Meshtastic plugin, akita-meshtastic-ipfs, integrates the InterPlanetary File System (IPFS) with Meshtastic, enabling decentralized data storage and retrieval over your Meshtastic network. It is implemented as a Meshtastic plugin to simplify integration with Meshtastic-based projects.

Features

  • Plugin Integration: Designed to integrate with Meshtastic's plugin framework for modularity and maintainability.
  • Decentralized Data Storage: Store and retrieve messages and files using IPFS.
  • Offline Access: Access previously retrieved data even without an internet connection.
  • Content Addressing: Ensure data integrity and authenticity using IPFS CIDs.
  • Message Metadata: Messages are stored with sender ID and timestamp.
  • Configuration: Configure plugin settings through the Meshtastic app or CLI.
  • Resource Management: Includes memory checks and configurable storage limits.
  • FreeRTOS Task: IPFS operations run in a separate FreeRTOS task to prevent blocking the main Meshtastic loop.
  • Progress Indication: Displays connected peers and free heap memory.
  • Security: Includes basic authentication with a pre-shared key.
  • Robustness: Implements retries and detailed error logging.
  • HTTP Gateway Bridge: The plugin exchanges JSON requests with the gateway over HTTP and receives CID or data responses immediately.

Installation

  1. Dependencies:

  2. Plugin Files:

    • Place akita-meshtastic-ipfs.cpp and akita-meshtastic-ipfs.h in the src/plugins directory of your Meshtastic project.
  3. Compile and Flash:

    • Compile and flash the Meshtastic firmware to your devices.
    • Depending on your Meshtastic setup, you may need to register the plugin in main.cpp or follow your project's plugin registration process.
  4. Configuration:

    • Use the Meshtastic app or CLI to configure the plugin:
      • Enable or disable the plugin (enabled).
      • Set the IPFS gateway address (gatewayAddress).
      • Set the IPFS gateway port (gatewayPort).
      • Set the shared gateway key (gatewayKey) when gateway authentication is enabled.

Gateway Installation

  1. Dependencies:

    • Install Python 3.7 or later.

    • Install the required Python packages:

      pip install -r gateway/requirements.txt
    • Ensure IPFS is installed and running on your system. See the IPFS documentation for installation instructions.

  2. Configuration:

    • Configure the gateway using environment variables. See the gateway/src/config.py file for available options.

    • Important: Set a strong PRESHARED_KEY environment variable for authentication.

    • Example:

      export PRESHARED_KEY="your_secure_key"
      export MESHTASTIC_DEVICE="/dev/ttyUSB0" # Or use MESHTASTIC_HOST and MESHTASTIC_PORT
      python gateway/src/main.py

Plugin Installation

  1. Dependencies:

    • You'll need the Meshtastic development environment set up for your specific platform (e.g., Arduino IDE for ESP32).
    • Install the following libraries:
      • IPFS_Lite
      • ArduinoJson
      • TimeLib
      • WiFi (for ESP32)
  2. Include Plugin Files:

    • Place akita-meshtastic-ipfs.cpp and akita-meshtastic-ipfs.h in the src/plugins directory of your Meshtastic project.
  3. Compile and Flash:

    • Compile and flash the Meshtastic firmware to your devices.

Configuration Options

Gateway

The following environment variables can be used to configure the gateway:

  • IPFS_PORT: The Meshtastic port number used for IPFS communication. Default: 200.
  • USE_MESH_INTERFACE: Set to True to use a Meshtastic Mesh Interface (TCP/IP), False to use serial. Default: True.
  • MESHTASTIC_HOST: The hostname or IP address of the Meshtastic device (for TCP/IP). Default: 127.0.0.1.
  • MESHTASTIC_PORT: The port number of the Meshtastic device (for TCP/IP). Default: 4444.
  • WEB_PORT: The port number for the SocketIO web server. Default: 8080.
  • AUTHENTICATION_ENABLED: Set to True to enable authentication, False to disable. Default: True.
  • PRESHARED_KEY: The pre-shared key used for authentication. Required if authentication is enabled. Default: secret_key (CHANGE THIS!).

Plugin

The following options can be configured in the Meshtastic settings (using the app or CLI):

  • enabled: (Boolean) Enables or disables the IPFS plugin. Default: true.
  • gatewayAddress: (String) The IP address of the IPFS gateway.
  • gatewayPort: (Integer) The port number of the IPFS gateway.
  • gatewayKey: (String) The pre-shared key sent as Authorization: PSK <key>. Default: secret_key.

Usage

  • Once the plugin and gateway are set up, Meshtastic devices can send and receive data via IPFS.
  • When sending data, the Meshtastic device sends the data to the gateway, which stores it on IPFS and returns the CID. The CID is then broadcast over the Meshtastic network.
  • When receiving a CID, a Meshtastic device can request the data from the gateway, which retrieves it from IPFS and sends it back to the device.
  • The gateway also provides a SocketIO interface for web applications and an authenticated HTTP endpoint at /api/ipfs for the embedded plugin.

Important Notes

  • Resource Usage: IPFS can be resource-intensive. Monitor device memory and CPU usage, especially on the gateway.
  • Network Connectivity: IPFS and Meshtastic require network connectivity. Ensure that your devices have a stable connection.
  • Security: This plugin includes basic authentication. For production environments, use a more secure solution (e.g., OAuth 2.0, certificates).
  • Testing: Thoroughly test the plugin and gateway in your specific Meshtastic environment before deployment.

License

This project is licensed under the GNU General Public License v3.0.

About

This Meshtastic plugin, akita-meshtastic-ipfs, integrates the InterPlanetary File System (IPFS) with Meshtastic, enabling decentralized data storage and retrieval over your Meshtastic network. It is implemented as a Meshtastic plugin to simplify integration with Meshtastic-based projects.

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages