User Tools

Site Tools


haxx:tutorials:iota:cli_app

iota cli app: a setup and usage guide

overview

Access your iota cryptocurrency from the command-line using a nifty javascript wallet. This guide will document my process in installing, setting up, and gaining access to my iota wallet (anonymized for security).

If you are not familiar with Cryptocurrency in general, or IOTA in specific, please be sure to check out those links to familiarize yourself accordingly.

In short: a cryptocurrency is an attempt at a completely digital fiat currency, backed by encryption and (often, at least the classical ones) some sort of distributed ledger data structure, which creates a broader security via community/network consistency. It is referred to as a 'currency' as it is a medium of facilitating transactions within a certain scope or domain. In recent years the mainstream has latched onto cryptocurrencies as a speculative asset (and perhaps many will become routinely considered as investments), but the space has also seen inroads being made towards using these technologies in various forms to facilitate transactions not directly intended as a means of speculation. For example, using various cryptocurrency tokens to access computing resources or get various tasks performed (ie smart contracts). Ethereum is notable for exploring this 'smart contract' space (and is, in many circles, considered the second most likely candidate for mainstream speculative investment, next to bitcoin… time will tell if either of these remain at the top of these charts), and IOTA endeavors to make similar inroads specifically in the IoT (internet of things) space.

There appear to be at least 2 potential candidates for command-line wallets:

I am going with the iotaledger/cli-app one, only because I encountered it first, and it seems to have been updated more recently. They may both be viable; they're both in javascript, and may well have the same base code (one may be a fork for all I know), and being relatively simpler in nature (ie not needing code to support a graphical interface), they may well not need to see as regular updates as the GUI wallets.

installation

Make sure that the npm and nodejs packages are installed, and that you have root access to the machine in order to install it.

machine:~$ sudo npm install -g iota-cli-app
/usr/local/bin/iota-cli -> /usr/local/lib/node_modules/iota-cli-app/index.js
iota-cli-app@1.0.8 /usr/local/lib/node_modules/iota-cli-app
├── json5@0.5.1
├── install@0.10.4
├── left-pad@1.3.0
├── bluebird@3.5.1
├── chalk@2.4.1 (escape-string-regexp@1.0.5, supports-color@5.4.0, ansi-styles@3.2.1)
├── prettyjson@1.2.1 (colors@1.2.1, minimist@1.2.0)
├── node-fetch@1.7.3 (is-stream@1.1.0, encoding@0.1.12)
├── iota.lib.js@0.4.7 (xmlhttprequest@1.8.0, bignumber.js@4.1.0, crypto-js@3.1.9-1, async@2.6.0)
├── moment@2.22.1
├── lodash@4.17.10
├── vorpal@1.12.0 (node-localstorage@0.6.0, in-publish@2.0.0, minimist@1.2.0, strip-ansi@3.0.1, chalk@1.1.3, log-update@1.0.2, wrap-ansi@2.1.0, inquirer@0.11.0, babel-polyfill@6.26.0)
└── eslint@3.19.0 (path-is-inside@1.0.2, natural-compare@1.4.0, is-resolvable@1.1.0, strip-bom@3.0.0, imurmurhash@0.1.4, ignore@3.3.8, strip-json-comments@2.0.1, pluralize@1.2.1, globals@9.18.0, estraverse@4.2.0, esquery@1.0.1, esutils@2.0.2, progress@1.1.8, doctrine@2.1.0, text-table@0.2.0, user-home@2.0.0, babel-code-frame@6.26.0, optionator@0.8.2, debug@2.6.9, json-stable-stringify@1.0.1, require-uncached@1.0.3, chalk@1.1.3, levn@0.3.0, mkdirp@0.5.1, glob@7.1.2, concat-stream@1.6.2, inquirer@0.12.0, is-my-json-valid@2.17.2, file-entry-cache@2.0.0, espree@3.5.4, js-yaml@3.11.0, shelljs@0.7.8, table@3.8.3, escope@3.6.0)
machine:~$ 

The default permissions set an ownership of user nobody, which prevented my regular user from accessing (short of opening up permissions). I opted just to change ownership to my user:

machine:~$ sudo chown -R wedge /usr/local/lib/node_modules
machine:~$ 

At which point, assuming /usr/local/bin is in the user's path, you can then run iota-cli right on the command line.

setting up

machine:~$ iota-cli
Running IOTA CLI v1.0.8

iota (http://localhost:14265 disconnected): 

getting help

First up, what sort of actions can we perform? Let's see…

iota (http://localhost:14265 disconnected): help

  Commands:

    help [command...]           Provides help for a given command.
    exit                        Exits application.
    address                     Generates an address.
    api [command...]            Sends an arbitrary command to the node.
    balance                     Gets balance for current seed
    depth <depth>               Sets depth.
    healthcheck                 Looks for any node problems.
    history [options] [hash]    Gets last transactions.  Provide a hash for additional details.
    minWeightMagnitude <mwm>    Sets minWeightMagnitude.
    neighbors [address]         Shows neighbor information.  Address can be a partial match.
    node <address>              connects to a new iota node. (ex. 1.2.3.4)
    nodeinfo                    Shows connected node information.
    promote <hash>              Promotes a pending transaction.  Provide an id for additional details.
    replay [options] <hash>     Replays a pending transaction.  Provide an id for additional details.
    seed [seed]                 Sets your seed/password.  If you don't provide a seed one will be generated.
    transfer <address> <value>  Sends iotas to the address

iota (http://localhost:14265 disconnected): 

connecting to a node

I know I'm not currently running a node, and as we can see from the wallet, it is not currently connected to the IOTA network (the 'tangle' as they call it). So, let us explore the node command:

iota (http://localhost:14265 disconnected): node

  Missing required argument. Showing Help:

  Usage: node [options] <address>

  connects to a new iota node. (ex. 1.2.3.4)

  Options:

    --help  output usage information

Okay, so we'll need some potential nodes to connect to. A quick google search revealed the following sites:

I chose one near the top of the list at the time of writing: iota.bitfinex.com:80

What you ideally want is to use the loadbalanced node address as given; if not, then go for a node that has the highest matching milestone numbers (also listed on that same page).

connecting to chosen node

So let us try connecting to THAT node:

iota (http://localhost:14265 disconnected): node iota.bitfinex.com:80
Changing node to http://iota.bitfinex.com:80. This may take a few seconds for a remote node.  Did you turn on remote access?
iota (http://iota.bitfinex.com:80 ✓): 

Getting node information

We can query the connected node for its information:

iota (http://iota.bitfinex.com:80 ✓): nodeinfo
appName:                            IRI
appVersion:                         1.4.2.2
jreAvailableProcessors:             4
jreFreeMemory:                      4447394704
jreVersion:                         1.8.0_151
jreMaxMemory:                       7494696960
jreTotalMemory:                     7494696960
latestMilestone:                    ZDIPZQLYZWJGB9VVXBUOIDETMLXONYXICAUGSDMLNOWFNGSXQ9ECBATFQPSMFZKSDDABSXYUHGUZ99999
latestMilestoneIndex:               363877
latestSolidSubtangleMilestone:      ZDIPZQLYZWJGB9VVXBUOIDETMLXONYXICAUGSDMLNOWFNGSXQ9ECBATFQPSMFZKSDDABSXYUHGUZ99999
latestSolidSubtangleMilestoneIndex: 363877
neighbors:                          5
packetsQueueSize:                   0
time:                               1525007841803
tips:                               10005
transactionsToRequest:              3592
iota (http://iota.bitfinex.com:80 ✓): 

providing our wallet seed

To access our particular wallet, we need to provide our iota seed that we got in the process of setting things up (assuming we had done this before with other wallets; I had, so I have a seed). If you are entirely new to iota, you will likely need to generate a seed.

At any rate, the seed command is what we want to specify our seed (I've obfuscated mine, obviously, for security):

iota (http://iota.bitfinex.com:80 ✓): seed MYIOTASEED
Setting seed to "MYIOTASEED".
Retrieving account data in the background.  You can continue working.

iota (http://iota.bitfinex.com:80 ✓): 

obtaining balance

Of course, a wallet is only as good as its ability to report your current balance of IOTA. Let's see what we've got:

Account data retrieved.
iota (http://iota.bitfinex.com:80 ✓) 0ι : balance
One moment while we collect the data.
Your current balance is 0ι.

iota (http://iota.bitfinex.com:80 ✓) 0ι : 
haxx/tutorials/iota/cli_app.txt · Last modified: 2018/04/29 09:23 by wedge