• Stars
    star
    258
  • Rank 158,189 (Top 4 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rust implementation of a helium wallet CLI

helium-wallet

Build Status

A Helium wallet implementation in Rust.

This is a simple wallet implementation that enables the creation and use of an encrypted wallet.

NOTE: This wallet is not the absolute safest way to create and store a private key. No guarantees are implied as to its safety and suitability for use as a wallet associated with Helium crypto-tokens.

Installation

From Binary

Download the latest binary for your platform here from Releases. Unpack the zip file and place the helium-wallet binary in your $PATH somewhere.

Usage

At any time use -h or --help to get more help for a command.

Global options

Global options precede the actual command on the command line.

The following global options are supported

  • -f / --file can be used once or multiple times to specify either shard files for a wallet or multiple wallets if the command supports it. If not specified a file called wallet.key is assumed to be the wallet to use for the command.

  • --format json|table can be used to set the output of the command to either a tabular format or a json output.

Create a wallet

    helium-wallet create basic

The basic wallet will be stored in wallet.key after specifying an encryption password on the command line. Options exist to specify the wallet output file and to force overwriting an existing wallet.

Use the --seed option to use a previously generated seed phrase that will be used to construct the keys for the wallet. The app will prompt you to enter a space separated phrase. The CLI wallet accepts 12 word or 24 word seed phrases from both Helium mobile wallet apps as well as any valid 12 or 24 word BIP39 phrase. Note that this does not (yet) generate an HD wallet.

Create a sharded wallet

Sharding wallet keys is supported via Shamir's Secret Sharing. A key can be broken into N shards such that recovering the original key needs K distinct shards. This can be done by passing options to create:

    helium-wallet create sharded -n 5 -k 3

This will create wallet.key.1 through wallet.key.5 (the base name of the wallet file can be supplied with the -o parameter).

When keys are sharded using verify will require at least K distinct keys.

The --seed option described above can also be used to construct a sharded wallet.

Implementation details

A ed25519 key is generated via libsodium. The provided password is run through PBKDF2, with a configurable number of iterations and a random salt, and the resulting value is used as an AES key. When sharding is enabled, an additional AES key is randomly generated and the 2 keys are combined using a sha256 HMAC into the final AES key.

The private key is then encrypted with AES256-GCM and stored in the file along with the sharding information, the key share (if applicable), the AES initialization vector, the PBKDF2 salt and iteration count and the AES-GCM authentication tag.

Public Key

    helium-wallet info
    helium-wallet -f my.key info
    helium-wallet -f wallet.key.1 -f wallet.key.2 -f my.key info

The given wallets will be read and information about the wallet, including the public key, displayed. This command works for all wallet types.

Displaying

Displaying information for one or more wallets without needing its password can be done using;

    helium-wallet info

To display a QR code for the public key of the given wallet use:

    helium-wallet info --qr

This is useful for sending tokens to the wallet from the mobile wallet.

Verifying

Verifying a wallet takes a password and one or more wallet files and attempts to decrypt the wallet.

The wallet is assumed to be sharded if the first file given to the verify command is a sharded wallet. The rest of the given files then also have to be wallet shards. For a sharded wallet to be verified, at least K wallet files must be passed in, where K is the value given when creating the wallet.

    helium-wallet verify
    helium-wallet -f wallet.key verify
    helium-wallet -f wallet.key.1 -f wallet.key.2 -f wallet.key.5 verify

Sending Tokens

Single Payee

To send tokens to one other account use:

    helium-wallet pay one <payee> <hnt>
    helium-wallet pay one <payee> <hnt> --commit

Where <payee> is the wallet address for the wallet you want to send tokens to, <hnt> is the number of HNT you want to send. Since 1 HNT is 100,000,000 bones the hnt value can go up to 8 decimal digits of precision.

The default behavior of the pay command is to print out what the intended payment is going to be without submiting it to the blockchain. In the second example the --commit option commits the actual payment to the API for processing by the blockchain.

Multiple Payees in one transaction

To send tokens to mulitple other accounts use:

    helium-wallet pay multi <path to json file>
    helium-wallet pay multi <path to json file> --commit

Example json file:

[ { "address": "<adddress1>", "amount": <hnt1>, "memo": "<memo1>" }, { "address": "<adddress2>", "amount": <hnt2>, "memo": "<memo2>" } ]

Where <address#> is the wallet address for the wallet you want to send tokens to, <hnt#> is the number of HNT you want to send. Since 1 HNT is 100,000,000 bones the hnt value can go up to 8 decimal digits of precision. <memo#> is an 8 byte base 64 encdoded message.

The default behavior of the pay command is to print out what the intended payment is going to be without submiting it to the blockchain. In the second example the --commit option commits the actual payment to the API for processing by the blockchain.

Environment Variables

The following environment variables are supported:

  • HELIUM_API_URL - The API URL to use for commands that need API access, for example sending tokens.

  • HELIUM_WALLET_PASSWORD - The password to use to decrypt the wallet. Useful for scripting or other non-interactive commands, but use with care.

  • HELIUM_WALLET_SEED_WORDS - Space separated list of seed words to use when restoring a wallet from a mnemonic word list.

Building from Source

You will need a working Rust tool-chain installed to build this CLI from source. In addition, you will need some basic build tools.

If you wish to build from source instead of downloading a prebuilt release you can add setup a Ubuntu 20.04 environment with the following:

sudo apt update
sudo apt upgrade
git clone https://github.com/helium/helium-wallet-rs
cd helium-wallet-rs
curl https://sh.rustup.rs -sSf | sh
## recommended option 1
source $HOME/.cargo/env
sudo apt install build-essential pkg-config cmake clang

Clone this repo:

git clone https://github.com/helium/helium-wallet-rs

and build it using cargo:

cd helium-wallet-rs
cargo build --release

The resulting target/release/helium-wallet is ready for use. Place it somewhere in your $PATH or run it straight from the the target folder.

More Repositories

1

miner

Miner for the helium blockchain
Erlang
609
star
2

HIP

Helium Improvement Proposals
Jupyter Notebook
582
star
3

gateway-rs

The Helium Gateway
Rust
280
star
4

blockchain-core

Erlang
214
star
5

denylist

Shell
201
star
6

plumtree

Epidemic Broadcast Trees
Erlang
193
star
7

hotspot-app

Helium hotspot app for iOS and Android
TypeScript
187
star
8

explorer

A Helium Blockchain Explorer
JavaScript
124
star
9

docs

Helium Documentation
MDX
120
star
10

helium-program-library

Helium programs to run on the Solana blockchain
TypeScript
118
star
11

erlang-libp2p

An Erlang implementation of libp2p swarms
Erlang
111
star
12

helium-js

Official TypeScript packages for interacting with the Helium blockchain
TypeScript
110
star
13

console

A management console to onboard and manage devices running on the Helium blockchain network.
JavaScript
104
star
14

router

router combines a LoRaWAN Network Server with an API for console, and provides a proxy to the Helium blockchain
Erlang
69
star
15

mappers

Mappers Frontend and API
Elixir
68
star
16

erlang-hbbft

Erlang implementation of HoneyBadgerBFT
Erlang
67
star
17

blockchain-etl

Blockchain follower that follows and stores the Helium blockchain
Erlang
64
star
18

longfi-arduino

C++
62
star
19

wallet-app

TypeScript
59
star
20

console-decoders

Payload decoder functions for console.
JavaScript
59
star
21

blockchain-node

A Heilum Blockchain Node
Erlang
58
star
22

network-explorer

TypeScript
57
star
23

angry-purple-tiger

animal-based hash digests for humans
JavaScript
48
star
24

blockchain-http

An http API for the helium blockchain database
Erlang
47
star
25

erlang-dkg

Distributed key generation for Erlang (using pairing based cryptography)
Erlang
41
star
26

erlang-h3

Erlang binding for Uber's H3 spatial coordinate library
Erlang
41
star
27

maker-starter-app

TypeScript
37
star
28

gateway-config

The Helium configuration application. Enables configuring the Helium Hotspot over Bluetooth
Erlang
37
star
29

helium-ledger-app

The official Helium app for the Ledger Nano S
C
32
star
30

helium-vote

TypeScript
30
star
31

helium-ledger-cli

Rust
26
star
32

virtual-lorawan-device

A utility that attaches to a Semtech UDP Host and pretends to be a LoRaWAN Device
Rust
23
star
33

proto

Rust
22
star
34

whitepaper

The Helium Whitepaper
TeX
19
star
35

oracles

Oracles for Helium subDAOs
Rust
19
star
36

gateway-mfr-rs

Rust
18
star
37

angry-purple-tiger-rs

animal-based hash digests for humans.. in rust
Rust
18
star
38

merkerl

A Merkle Tree implementation in Erlang
Erlang
18
star
39

rosetta-helium

Rosetta implementation for helium
Go
18
star
40

longfi-platformio

C++
16
star
41

packet-purchaser

Erlang
16
star
42

relcast

Relcast library
Erlang
15
star
43

gateway_mfr

Erlang Manufacturing Suppport Code
Erlang
15
star
44

erlang-lorawan

Erlang
15
star
45

cargo-elixir

JavaScript
15
star
46

ecc508

Library to communicate with the Microchip cryptoauthentication device
Erlang
14
star
47

lorawan-sniffer

Rust
14
star
48

helium-api-rs

A Rust library for accessing Helium API servers
Rust
14
star
49

erlang-multihash

Erlang implementation of multihash
Erlang
13
star
50

react-native-helium

TypeScript
13
star
51

onboarding-server

JavaScript
13
star
52

erlang-tpke

Threshold encryption
Erlang
11
star
53

helium-console-cli

A command line interface for interacting with Helium Console API
Rust
11
star
54

ebus

An Erlang binding to libdbus
Erlang
11
star
55

libp2p-crypto

Erlang cypto library used by the libp2p system
Erlang
11
star
56

psql-migration

A SQL migration script for Erlang
Erlang
10
star
57

kdtree

Simple kdtree library in erlang
Erlang
10
star
58

semtech-udp

Rust
9
star
59

ecc608-linux-rs

A linux rust library for the i2c ecc508 and ecc608 family of crypto chips
Rust
9
star
60

modular-governance

A modular set of governance contracts on solana
JavaScript
9
star
61

helium-packet-router

Erlang
9
star
62

erlang-erasure

Simple Erlang binding for Jerasure's Reed-Solomon erasure encoding/decoding
C
9
star
63

longfi-core

Platform agnostic implementation of core LongFi primitives.
C
9
star
64

erlang-splicer

Splice 2 sockets together in Erlang
Erlang
9
star
65

stm32-lora-disco-rs

Unofficial Rust Board Support Crate for B-L072Z-LRWAN1
GDB
8
star
66

longfi-erlang

LongFi core bindings for Erlang
C
8
star
67

ecc_compact

Unpatented ECC point compression for NIST p-256 public keys
C
8
star
68

xorf-generator

public key filter tool
Rust
8
star
69

erlang-multiaddr

Erlang implementation of multiaddr
Erlang
8
star
70

longfi-arduino-legacy

C
7
star
71

vincenty

Vincenty's formulae implementation in Erlang
Rust
7
star
72

erlang-pbc

Pairwise crypto
C
7
star
73

erlang-ubx

Erlang support for speaking to ublox gps modules using the ubx protocol
Erlang
6
star
74

lorawan-h3

LoRaWAN regions represented as H3 polyfills
Rust
6
star
75

account-compression-anchor-gen

Anchor generated CPI clients for account compression and bubblegum
Rust
6
star
76

explorer-api

JavaScript
6
star
77

ebus-gatt

A bluetooth gatt server implementation using ebus
Erlang
6
star
78

cortex-mpu

Cortex-M MPU library
Rust
6
star
79

packet-forwarder-test

Rust
6
star
80

erlang-tc

Erlang NIF for threshold_crypto
Erlang
5
star
81

helium-crypto-rs

Rust
5
star
82

well-known

Well known addresses, OUIs, etc. for the Helium network
5
star
83

gwmp-mux

Multiplexer for Semtech's GWMP over UDP
Rust
5
star
84

erl_angry_purple_tiger

Erlang port of angry_purple_tiger
Erlang
5
star
85

erlang-sss

Erlang binding for Shamir Secret Sharing
Erlang
5
star
86

sibyl

Erlang
4
star
87

miner-test

Helium miner testing utilities
Erlang
4
star
88

cream

An Erlang cache backed by the performant Moka library
Erlang
4
star
89

connman

Connection Manager
C
4
star
90

erlang-stats

A NIF wrapper around kthohr/stats
Makefile
4
star
91

ebus-connman

An erlang connman client using ebus
Erlang
4
star
92

helium-foundation-k8s

Helium foundation k8s defs
4
star
93

helium-data

Utilities for processing helium data
Rust
4
star
94

ipython-target-modeling

Testing targeting models
Jupyter Notebook
3
star
95

module-sdk

Libraries and example applications for developing Helium embedded Applications
C
3
star
96

wallet-issues-tracker

Issue tracker for the Helium Wallet app
3
star
97

longfi-st-hal

Helium LongFi Examples Using ST HAL
C
3
star
98

etl-extract

Extracts ETL data that can be used for display or further analysis
Rust
3
star
99

elixir-reed-solomon-erasure

Reed solomon erasure coding NIFs for Elixir
Elixir
3
star
100

intercept

Erlang
3
star