Skip to content

airalab/robonomics-tools

Repository files navigation

Robonomics on Ethereum tools

Build Status

1. Intro

AIRA (Autonomous Intelligent Robot Agent) project implements the standard of economic interaction between human-robot and robot-robot via liability smart contract. AIRA makes it possible to connect a variety of different robots to the market of robot liabilities for the direct sale of data from robot sensors, ordering of logistics services, and organization ordering of personalized products at fully automated enterprises.

This source is a part of AIRA project. It implements their purposes using Ethereum with Haskell Web3.

2. Quick install

Ensure you have Stack and Nix installed:

curl -sSL https://get.haskellstack.org/ | sh
curl https://nixos.org/nix/install | sh

2.1. Install from binary caches

  1. Setup Airalab binary cache at https://aira.cachix.org/

  2. Import Airalab channel:

nix-channel --add http://aira.life/channels/aira-unstable/ aira
nix-channel --update
  1. Install from binary cache:

    nix-env -iA aira.robonomics-tools

2.2. Building from source

Install robonomics tools from git source:

git clone https://github.com/airalab/robonomics-tools && cd robonomics-tools && stack build --nix

3. Network maintaining

Robonomics tools contains utility with name xrtd.

Usage: xrtd [--web3 URI] --private KEY [--chain CHAIN_ID] [--ipfs MULTIADDR]
            [--lighthouse ENS] [--factory ENS] [--ens ADDRESS] [-l|--local]
  XRTd :: Robonomics network provider

Available options:
  --web3 URI               Ethereum node endpoint [DEFAULT: Infura mainnet]
  --private KEY            Hex encoded private key
  --chain CHAIN_ID         Ethereum chain [foundation, ropsten, kovan, rikenby]
  --ipfs MULTIADDR         IPFS node endpoint [DEFAULT: localhost]
  --lighthouse ENS         Robonomics lighthouse name
  --factory ENS            Robonomics liability factory name
  --ens ADDRESS            ENS registry contract
  -l,--local               Run in local mode: don't listen messages but generate
                           it on local machine
  -h,--help                Show this help text

This is the main application for Robonomics provider.

3.1. Local mining

Robonomics network makes XRT emission for any liability contract finalization. This is mean that it doesnt matter liability is useful or not. In this case you can just generate and settle liability with random fields to get Robonomics network emission.

  1. To start XRT mining you need a little bit XRT as a stake, buy it on Exchanges or some person.

  2. Create your own lighthouse smart contract using the Factory DApp at https://dev.aira.life/net/.

  3. Refill your stake at lighthouse smart contract using Factory DApp.

  4. Launch xrtd with private key of stake holder.

    xrtd -l --private $PRIVATE_KEY

3.2. IPFS PubSub messages

Creation and finalization of useful liablities can give some additional value in XRT. Promisee can boost libility creation using lighthouse fee. To collect this fee just enable IPFS PubSub listener via drop -l flag. In this case xrtd will listen incoming usefule Robonomics messages via IPFS PubSub and create new liability when messages matched.

xrtd --private $PRIVATE_KEY

3.3. Troubleshooting

  1. Error: cannot connect to the api. Is the deamon running?

    ipfs init
  2. xrtd: fd:16: Data.ByteString.hGetLine: end of file

    ipfs daemon --enable-pubsub-experiment

4. Liability explorer

Using liability command robot liabilities could be listed.

Usage: liability COMMAND
  Robonomics liability smart contract ops

Available options:
  -h,--help                Show this help text

Available commands:
  read                     Read liability smart contract
  list                     List liability smart contracts

To get liability details just run command with liability contract address as argument:

liability read 0x...