Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
172 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
= Robonomics on Substrate | ||
:Author: Robonomics developers | ||
:Revision: 0.1.0 | ||
:toc: | ||
:sectnums: | ||
|
||
image:https://travis-ci.org/airalab/substrate-node-robonomics.svg?branch=master["Build Status", link="https://travis-ci.org/airalab/substrate-node-robonomics"] | ||
image:https://img.shields.io/github/downloads/airalab/substrate-node-robonomics/total.svg["Downloads", link="https://github.com/airalab/substrate-node-robonomics/releases"] | ||
image:https://img.shields.io/github/release/airalab/substrate-node-robonomics.svg["Release", link="https://github.com/airalab/substrate-node-robonomics/releases"] | ||
|
||
== 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 Substrate technologies. | ||
|
||
== Try it out | ||
|
||
. Import https://github.com/airalab/substrate-node-robonomics/blob/master/res/custom_types.json[custom data types] at https://polkadot.js.org/apps/#/settings/developer[Substrate UI]: Developer settings | ||
. Open https://polkadot.js.org/apps/#/settings[Substrate UI]: General settings | ||
. Set `custom` node endpoint to `wss://robonomics.akru.me/` | ||
. Save and reload | ||
|
||
When connection is success you can explore `Robonomics testnet` using Substrate UI. Just create account and request test XRT in our https://matrix.to/#/#robonomics:matrix.org[Matrix room]. | ||
|
||
- Accounts management: https://polkadot.js.org/apps/#/accounts | ||
- Looking for network events: https://polkadot.js.org/apps/#/explorer | ||
- Transfer test XRT: https://polkadot.js.org/apps/#/transfer | ||
- Send extrinsics to robonomics module: https://polkadot.js.org/apps/#/extrinsics | ||
|
||
== Install node | ||
|
||
Robonomics on Substrate binary blobs available as an assets in https://github.com/airalab/substrate-node-robonomics/releases[releases]. Latest version you can try to build from source code. | ||
|
||
=== Building from source | ||
|
||
Ensure you have Rust and the support software installed: | ||
|
||
[source, shell] | ||
---- | ||
curl https://sh.rustup.rs -sSf | sh | ||
# on Windows download and run rustup-init.exe | ||
# from https://rustup.rs instead | ||
rustup update nightly | ||
rustup target add wasm32-unknown-unknown --toolchain nightly | ||
rustup update stable | ||
cargo install --git https://github.com/alexcrichton/wasm-gc | ||
---- | ||
|
||
You will also need to install the following packages: | ||
|
||
- Linux: | ||
[source, shell] | ||
sudo apt install cmake pkg-config libssl-dev git clang libclang-dev | ||
|
||
- Mac: | ||
[source, shell] | ||
brew install cmake pkg-config openssl git llvm | ||
|
||
- Windows (PowerShell): | ||
+ | ||
[source, shell] | ||
---- | ||
# Install LLVM | ||
# Download and install the Pre Build Windows binaries | ||
# of LLVM from http://releases.llvm.org/download.html | ||
# Install OpenSSL (through vcpkg) | ||
mkdir \Tools | ||
cd \Tools | ||
git clone https://github.com/Microsoft/vcpkg.git | ||
cd vcpkg | ||
.\bootstrap-vcpkg.bat | ||
.\vcpkg.exe install openssl:x64-windows-static | ||
$env:OPENSSL_DIR = 'C:\Tools\vcpkg\installed\x64-windows-static' | ||
$env:OPENSSL_STATIC = 'Yes' | ||
[System.Environment]::SetEnvironmentVariable('OPENSSL_DIR', $env:OPENSSL_DIR, [System.EnvironmentVariableTarget]::User) | ||
[System.Environment]::SetEnvironmentVariable('OPENSSL_STATIC', $env:OPENSSL_STATIC, [System.EnvironmentVariableTarget]::User) | ||
---- | ||
|
||
Install robonomics node from git source: | ||
|
||
[source, shell] | ||
cargo install --force --git https://github.com/airalab/substrate-node-robonomics | ||
|
||
Run node in https://telemetry.polkadot.io/#/Robonomics[Robonomics testnet]: | ||
|
||
[source, shell] | ||
robonomics | ||
|
||
Or run your local development network: | ||
|
||
[source, shell] | ||
robonomics --dev | ||
|
||
=== Building with Nix | ||
|
||
Install Nix package manager: | ||
|
||
[source, shell] | ||
curl https://nixos.org/nix/install | sh | ||
|
||
Run in Nix shell: | ||
|
||
[source, shell] | ||
---- | ||
git clone https://github.com/airalab/substrate-node-robonomics && cd substrate-node-robonomics | ||
nix-shell --run "cargo run --release" | ||
---- | ||
|
||
== Network maintaining | ||
|
||
Currently Robonomics on Substrate https://telemetry.polkadot.io/#/Robonomics[testnet] is maintained by developers but anyone can support the project by several ways described below. | ||
|
||
=== Full node | ||
|
||
You can support the network just by launch the node. Every additional full node of blockchain helps it to be more sustainable and fault tolerant. Robonomics node binaries is available on https://github.com/airalab/substrate-node-robonomics/releases[releases] or could be <<building-from-source,build from source>>. | ||
|
||
=== Become a validator | ||
|
||
For nodes that can be online 24/7 also available most important role on chain - block producers or briefly validator. Robonomics on Substrate use https://github.com/paritytech/substrate/blob/8930f297737db67257f3be1a8b286f8c50189066/srml/staking/Staking.md[NPoS algorithm] for choosing block production accounts. For this reason if you have any stake in test XRT you can try self in block production. You can request test XRT in our https://matrix.to/#/#robonomics:matrix.org[Matrix room]. | ||
|
||
. Generate two accounts `stash` and `controller` using https://polkadot.js.org/apps/#/accounts/create[Account page] | ||
|
||
. Transfer full amount of test XRT to `stash` and a little bit to `controller` accounts | ||
|
||
. https://polkadot.js.org/apps/#/extrinsics[Send extrinsic] from `stash` account with params `staking:bond(controller, value, payee)`: | ||
|
||
.. `controller` account | ||
.. `stash` account total balance | ||
.. `0x00` | ||
|
||
. https://polkadot.js.org/apps/#/extrinsics[Send extrinsic] from `controller` account with params `staking:validate(prefs)` | ||
.. `0x00` | ||
|
||
. Launch Robonomics node (set `controller` account seed as parameter): | ||
[source, shell] | ||
robonomics --validator --key %CONTROLLER_SEED% | ||
|
||
. Check https://polkadot.js.org/apps/#/staking[validator list] | ||
|
||
== Robotics integration | ||
|
||
Special feature `ros` helps to use Robonomics Substrate modules in http://www.ros.org[ROS]-enabled cyber-physical systems. | ||
|
||
=== Building with ROS feature | ||
|
||
. Install ROS using http://wiki.ros.org/melodic/Installation[instruction]. | ||
|
||
. Import ROS environment: | ||
[source, shell] | ||
source /opt/ros/melodic/setup.bash | ||
|
||
. Build with `ros` feature: | ||
[source, shell] | ||
cargo build --release --features ros | ||
|
||
=== Launch ROS node | ||
|
||
. Start ROS core service | ||
[source, shell] | ||
roscore | ||
|
||
. Start node: | ||
[source, shell] | ||
cargo run --release --features ros | ||
|
||
. Subscribe for best block number: | ||
[source, shell] | ||
rostopic echo /blockchain/best_number |