Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.
This repository was archived by the owner on May 6, 2024. It is now read-only.

Antenna SDK for Arduino boards #25

@simonerom

Description

@simonerom

Description

This port will provide transaction signing and broadcasting for IOTX token (transfers, balance, etc...), XRC20 tokens (transfers, balance, etc...), and smart contracts interaction, as well as utility functions like account creation, token units conversion etc... It will interact with a JSON-RPC API server (like our Babel service that implements Ethereum JSON-RPC API, or any other API server. communication with IoTeX Full-Node to broadcast transactions.

The library will suport popular Arduino boards, including ESP32, ESP8266 and Arduino Nano 33 IoT

Context

Arduino is a great platform for people & makers to experiment, learn and build IoT applications.
Joining Arduino & IoTeX would take these IoT projects to the next level, allowing users to effectively integrate an IoT-friendly Blockchain into their devices and applications. While IoTeX already provides some C++ examples (antenna-embedded), a comprehensive antenna-arduino library that implements IoTeX Antenna SDKs and is easily imported into Arduino projects is missing.

Acceptance criteria

The final deliverable will be made up by an Arduino library with PlatformIO compatibility. The library will follow the Arduino code standards. Along with the library, a set of examples and documentation will be created for the supported Arduino boards.

Below the Milestones with respective acceptance criteria:

Milestone 1: JSON-RPC over HTTPS

  • JSON-RPC parser/serializer
    This is a Class including utilities to construct and parse JSON-RPC requests and responses. This will leverage a third party lightweight JSON library such as JSMN or cJSON
  • IConnection
    This is an Interface for a HTTP/HTTPs connection. Possibly a mock implementation or an implementation for one board (eg. ESP32)
  • Api
    This is a class/interface for the IoTeX JSON-RPC api. Will implement the following methods, which construct the payload using the JSON-RPC parser, send a request over HTTP using IConnection, parse the response and return it in an adequate struct/class. Implements the following methods (initially)
    • getAccount()
    • getNonce()
    • getTransactionByHash()

Milestone 2: Signature

  • Transfer
    This is a class that represents a transfer. Holds the following data, as well as possibly some utility methods: amount, recipient, payload, gasPrice, gasLimit

  • Wallet: a class that represents a wallet. Provides the following methods:

    • getPrivateKey(): creates a new wallet and returns the private key
    • getIoTeXAddress(): returns the native IoTeX address
    • getEthereumAddress(): returns the address in the Ethereum format
    • signMessage(): hashes a message using the private key and returns the hash
    • signTokenTransferAction() this will construct the token transfer message then call the signMessage and return the signature.
  • Api: the following methods will be added to the Api class

    • sendTokenTransfer(Wallet, Transfer): Signs and broadcast a IOTX transfer

Milestone 3 - Contract execution

  • Execution: class that represents a smart contract. Holds the following data and methods

    • contractAddress
    • amount
    • Methods to generate contract data:
      • setupContractData()
      • getData()
  • Wallet: add the following methods

    • signContractExecution(amount,execution)
  • Api: add the following methods

    • sendContractExecution(wallet, execution)

Milestone 4 - Test boards, Examples & publish

  • Implement the existing interfaces for each of the supported boards:
  • ESP32
  • ESP8266
  • Arduino Nano 33 IoT
  • Cellular board - Possibly, depending on time
  • Create a set of examples and documentation
  • Publish the library

Time estimation

No specific deadline, but we'd like to have it ready by July 15th, 2021

Misc/References

Signature of actions

The message must be “constructed” in protobuf format (version is 1, nonce can be obtained from milestone 1, action will be of type Transfer for token transfers, Execution for contract calls and fields are passed as arguments to the call). https://github.com/iotexproject/iotex-proto/blob/28696168bf02b64a9fbf71edda0a68a4ad714c08/proto/types/action.proto#L205

Refer to the existing antenna-embedded signing module. If any fix is required to the signature function the IoTeX team will provide help on this

Protobuf

Protobuf encoding is needed for sending actions to the server. This will be handled by integrating a lightweight third party library such as NanoPb

Reward

3500 USD

  • Milestone 1: 750 USD
  • Milestone 2: 750 USD
  • Milestone 3: 750 USD
  • Milestone 4: 1250 USD

Important Links

Getting started: https://docs.iotex.io

IoTeX Blockchain Explorer: https://iotexscan.io

IoTeX Testnet Faucet https://faucet.iotex.io/

Follow Us

https://iotex.io
https://t.me/IoTeXGroup
https://twitter.com/iotex_io
https://medium.com/@iotex
https://www.reddit.com/r/IoTeX

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions