Giter Club home page Giter Club logo

esp32-client-sdk's Introduction

IOTA Client Software Development Kit(SDK) for ESP32

This SDK is built on top of iota.c and ESP-IDF for IOTA client development on ESP32 MCU series.

Learn more about iota.c please visit IOTA C Client Documentation

Example Commands

This SDK provides some example for testing and learn IOTA Client application, commands are shown below:

Client API

  • node_info - Get info from the connected node
  • api_tips - Get tips from the connected node
  • api_get_blk <Block Id> - Get a block from a given block ID
  • api_blk_meta <Block Id> - Get metadata from a given block ID
  • api_blk_children <Block Id> - Get children from a given block ID
  • api_get_output <Output Id> - Get the output object from a given output ID
  • api_send_tagged_str <Tag> <Data> - Send out tagged data string to the Tangle

Wallet

  • wallet_address <start_index> <count> <is_change> - Get ed25519 addresses of the wallet
  • wallet_send_token <sender index> <receiver index> <amount> - Send tokens from sender address to receiver address

System

  • help - List commands
  • free - Get the size of available heap.
  • heap - Get heap info
  • stack - Get main stack info
  • version - Get esp32 and wallet versions
  • restart - system reboot

Node Events

The node event API is in charge of publishing information about events within the node software.

  • Event Config : menuconfig->IOTA Wallet->Event Config
  • Command : node_events
  • Argument : <event_select>
  • Usage : node_events <event_select>

Note :

  • The paramter <event_select> should be a one byte hexadecimal value of range 0 - FF. Eg: node_events 2F
  • To stop receiving events, <event_select> should be 0 : node_events 0
  • The set bit positions of the <event_select> hexadecimal value determines the events to be subscribed. Refer the table below for events, bit positions and its config parameters.
Event Bit Position Menu Config
milestones/latest 1 *
milestones/confirmed 1 *
blocks 2 *
blocks/tagged-data 3 *
milestones 4 *
block-metadata/[block Id] 5 Block Id
outputs/[outputId] 6 Output Id
transactions/[transactionId]/included-block 7 Transaction Id
blocks/transaction 8 *

Position of bit to be counted from the LSB side.

Requirements

This project was tested on ESP32-DevKitC V4 and ESP32-C3-DevKitC 02 dev boards.

Build system setup

Please follow documentations to setup your toolchain and development framework.

Notice: This SDK is tested under esp-idf/release/v4.3

Clone esp-idf from GitHub

$ git clone --recursive https://github.com/espressif/esp-idf.git
$ cd esp-idf
$ git submodule update --init --recursive
$ ./install.sh
$ source ./export.sh

Build Wallet Application

Clone the wallet source code

git clone https://github.com/iotaledger/esp32-client-sdk.git
cd esp32-client-sdk
git submodule update --init --recursive

Here we need to set the target device before configuration.

For ESP32

$ idf.py set-target esp32

For ESP32-C3

$ idf.py set-target esp32c3

By default, the wallet uses a random mnemonic, you can set the mnomonic in (random) Mnemonic by menuconfig

$ idf.py menuconfig

Update IOTA node endpoint

IOTA Wallet  --->
      WiFi  --->
      SNTP  --->
      Event Config  --->
  (192.168.11.111) IOTA Node URL
  (14265) IOTA node port number
  [ ] IOTA node use tls
  (random) Mnemonic
  [*] English Mnemonic Only
  (60) Sensor Sampling Period
  [ ] Testing Application

Configure Wifi Username and Password so ESP32 can connect in Station Mode, make sure WiFi endpoint has internet access

IOTA Wallet --> WiFi --->
  (myssid) WiFi SSID
  (mypass) WiFi Password
  (5) Maximum Retry

Update config for Node Events

IOTA Wallet --> Event Config --->
  (mqtt.lb-0.h.chrysalis-devnet.iota.cafe) Events Node URL
  (1883) Events Port
  (iota_test_@123) Events Client Id
  () Block Id : Will be used for block-metadata/[block Id] event
  () Output Id : Will be used for outputs/[outputId] event
  () Transaction Id : Will be used for transactions/[transactionId]/included-block event

$ idf.py build

$ idf.py -p [PORT] flash monitor

Run the Example Application

Cli Examples

Transaction Message

Data Message

Notice: these messages are on the testnet that might not be found after a network reset.

Troubleshooting

E (38) boot_comm: This chip is revision 2 but the application is configured for minimum revision 3. Can't run.

I'm using ESP32-C3 Rev2 but the current ESP-IDF uses Rev 3 as default, we need to change it via idf.py menuconfig

Component config ---> ESP32C3-Specific ---> Minimum Supported ESP32-C3 Revision (Rev 3)  ---> Rev 2

esp32-client-sdk's People

Contributors

rebinmannady93 avatar junwei0117 avatar valerio-vaccaro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.