SDKs overview

Helium provides a suite of Software Development Kits (SDKs) and libraries designed to help developers integrate devices and applications with its decentralized wireless network. These tools abstract the complexities of blockchain interactions and LoRaWAN or 5G connectivity, allowing developers to focus on application logic. The SDKs support various programming languages and platforms, facilitating tasks such as sending data packets, managing device identities, and interacting with the Helium blockchain for Data Credit transactions.

The primary interaction model involves devices using Data Credits (DC) to transmit data over the network. DCs are acquired by burning HNT, the native cryptocurrency of the Helium network. SDKs often include functionalities for encoding and decoding data payloads, managing device keys, and communicating with the Helium API endpoints for network status and transaction submission. The ecosystem also benefits from community-driven libraries that extend functionality or provide support for less common use cases.

Official SDKs by language

Helium's official SDKs are maintained by Nova Labs, the developer of the Helium network, and are designed to provide robust and up-to-date interfaces for interacting with the blockchain and network services. These SDKs are typically hosted on official repositories and are recommended for most development projects due to their active maintenance and alignment with network updates. The core functionalities often include wallet management, transaction construction, and interaction with the Helium APIs for data routing and device onboarding.

Language Package/Repository Install Command (Example) Maturity
JavaScript/TypeScript @helium/proto, @helium/transactions, @helium/http npm install @helium/proto @helium/transactions @helium/http Stable
Python helium-py pip install helium-py Stable
Go github.com/helium/proto go get github.com/helium/proto Stable
Rust helium-jsonrpc, helium-wallet cargo add helium-jsonrpc helium-wallet Stable

Installation

Installation of Helium SDKs typically follows standard package management practices for each respective programming language. Developers can use package managers like npm for JavaScript, pip for Python, go get for Go, and cargo for Rust. Specific installation instructions and dependencies are usually detailed in the respective SDK's documentation or repository README file. It is recommended to consult the Helium developer documentation for the most current and detailed installation guides.

JavaScript/TypeScript

For JavaScript and TypeScript projects, the Helium SDKs are available as npm packages. These packages provide functionalities for interacting with the Helium blockchain, constructing transactions, and communicating with HTTP API endpoints. A common set of packages includes @helium/proto for protobuf definitions, @helium/transactions for transaction building, and @helium/http for HTTP client interactions.

npm install @helium/proto @helium/transactions @helium/http

Python

The helium-py library offers a Pythonic interface to the Helium blockchain and API. It simplifies tasks such as querying blockchain data, managing wallets, and constructing transactions. Installation is typically done via pip:

pip install helium-py

Go

For Go developers, the Helium project provides Go modules for protobuf definitions and other utilities. These can be integrated into Go projects using the go get command.

go get github.com/helium/proto

Rust

Rust developers can utilize crates like helium-jsonrpc and helium-wallet for interacting with the Helium network. These crates provide low-level access to the blockchain's JSON-RPC interface and wallet functionalities.

cargo add helium-jsonrpc helium-wallet

Quickstart example

This quickstart example demonstrates how to use the @helium/http and @helium/transactions JavaScript SDKs to fetch account information and construct a simple payment transaction on the Helium network. This example assumes Node.js environment and necessary npm packages are installed.

const { Client } = require('@helium/http');
const { PaymentV2, Transaction } = require('@helium/transactions');
const { Keypair } = require('@helium/address');

async function main() {
  const client = new Client();

  // Replace with a valid Helium wallet address
  const senderAddress = '13hQc2K2F8hP1795v2vWq15c8jJzT4s5s6s7s8s9s0s'; 
  const recipientAddress = '14bQd3L3G9hR1806w3wXq16d9kKzU5t6t7u8u9u0u1u'; 
  const amountToSend = 10000000; // 0.01 HNT (1 HNT = 100,000,000 bones)

  // 1. Fetch account details
  try {
    const account = await client.accounts.get(senderAddress);
    console.log(`Sender Account Balance: ${account.balance.toString()} bones`);
    console.log(`Sender Account DC Balance: ${account.dcBalance.toString()} DC`);
  } catch (error) {
    console.error(`Error fetching account details: ${error.message}`);
    return;
  }

  // 2. Create a dummy keypair for demonstration (NEVER use hardcoded private keys in production)
  // In a real application, you would load your Keypair securely.
  const senderKeypair = Keypair.fromSecret(Buffer.from('YOUR_PRIVATE_KEY_IN_HEX', 'hex')); 
  console.log(`Sender Public Key: ${senderKeypair.publicKey.toString()}`);

  // 3. Construct a payment transaction
  const paymentTxn = PaymentV2.fromFeeAndContent({
    payer: senderKeypair.publicKey.toB58(),
    payments: [
      {
        payee: recipientAddress,
        amount: amountToSend,
      },
    ],
    nonce: 1, // Increment this for each transaction
    fee: 0, // Fee will be calculated by the SDK or oracle
  });

  // 4. Sign the transaction (requires the sender's private key)
  const signedTxn = await paymentTxn.sign({
    payer: senderKeypair,
  });

  console.log(`Signed Transaction: ${signedTxn.toString()}`);

  // 5. Submit the transaction (uncomment in a real scenario)
  /*
  try {
    const submission = await client.transactions.submit(signedTxn.toBase64());
    console.log('Transaction submitted:', submission);
  } catch (error) {
    console.error('Error submitting transaction:', error.message);
  }
  */
}

main();

This example demonstrates fetching an account balance and constructing a payment. To execute a real transaction, you would need to replace 'YOUR_PRIVATE_KEY_IN_HEX' with an actual private key and uncomment the transaction submission block. Security best practices dictate that private keys should never be hardcoded or exposed in client-side code, but rather managed securely (e.g., through hardware wallets or secure key management services).

Community libraries

Beyond the official SDKs, the Helium ecosystem benefits from a variety of community-contributed libraries and tools. These often provide specialized functionalities, integrations with other platforms, or alternative language bindings. Community projects can range from device-specific libraries for microcontrollers to analytics tools and dashboards. While not officially supported by Nova Labs, many community libraries are actively maintained and widely used within the developer community.

  • Helium Console Integrations: Libraries that facilitate data forwarding from the Helium Console to various cloud services (e.g., AWS IoT, Google Cloud IoT Core, Azure IoT Hub). These typically involve webhooks and payload decoders.
  • Device-Specific Libraries: Libraries for popular IoT microcontrollers (e.g., ESP32, Arduino) that simplify connecting LoRaWAN modules to the Helium network. These often wrap LoRaWAN stack implementations and handle device provisioning.
  • Data Visualization Tools: Open-source projects that help visualize data transmitted over the Helium network, often integrating with platforms like Grafana or custom web applications.
  • Wallet and Explorer Tools: Community-developed wallets or blockchain explorers that offer alternative interfaces for interacting with HNT and Data Credits, providing different user experiences or advanced features compared to official offerings.

When using community libraries, developers should review their source code, licensing, and community support to ensure they meet project requirements and security standards. Resources like GitHub and community forums are good places to discover and evaluate these contributions.

For example, projects integrating with Google Cloud IoT Core might leverage community-developed connectors that translate Helium's data format into a schema compatible with Google's platform, demonstrating how external cloud services can interact with the decentralized network.