Skip to content
Aviv Eyal edited this page Jun 6, 2018 · 11 revisions

REPL Overview

The Spacemesh REPL is an interactive console API enabling local users to execute various commands, execute transactions, get accounts and balances data and get computer state information. The REPL uses the grpc server or the http-json server endpoints to execute commands and get back state data. Some commands are one-step commands, for example, get account coin balance and some may involve multiple interactive steps, for example, setting up a POST commitment.

There are 2 main ways to access the REPL:

1. REPL mode

Starting a node in REPL mode. In this scenario, user starts a new instance of a Spacemesh node in REPL mode in a console session, and attaches it to another Spacemesh node running in another console session.

`./go-spacemesh repl`

2. First time user-experience

REPL in the main node software CLI session.

Implementation Nodes

  • The REPL is a front-end and should not implement any logic beyond handling of user input, calling Spacemesh API methods via the grpc or the http-json server with provided user input, and outputting data returned from OS services via one of the servers.

REPL Commands

Get Spacemesh Account Data

Get basic info about any Spacemesh account (user or smart contract) including the account's current coin balance, optional user provided account info string, account nonce (number of transactions) and additional account info. User needs to provide the account address.

$ account GZsJqUXaEPs35S1HRZehp45eiKRJ3YJfdAH63wkiZYiYyhLanf
> Account info: Avive Main Spacemesh account.
> Account type: User account.
> Account balance: 2 Spacemesh Coins (2*10^9 Spacemesh Cents).

Transfer coins between 2 accounts

This is a blockchain transaction. To execute a transaction account must be unlocked or user must provide local account passphrase if it is currently locked.

Modify any CLI flag or param

We would like to allow users to modify any CLI flag or param that doesn't require a node restart. This is useful for testing. If param or flag requires node restart then notify the user and allow him to restart the node with the provided param value.

Updating a param that doesn't require a node restart:

$ set param b=5 c=8
> param b was successfully set to 5.

Updating a param that requires a node restart:

$ set param a=5
> Node needs to be restarted for your update.
> Restart node? (y/n): y
> Restarting node with a=5...
> Node restarted.
$

Restart Node

Restarts the node. User may optionally specify new CLI flags and params.

$ restart node
$ provide CLI flags and params or press ENTER for none:
> Restarting node...
> Node restarted.
$

Set Coin-base Account

wip

Get Coin-base Account

wip

POST Setup

  • Each node needs have a proof of space time (POST) commitment in order to participate in the network as a validator and join the distributed computer.
  • POST setup is a one time process. The POST setup starts on the first run of a new Spacemesh node and doesn't require use of a second node in repl mode.
  • User may run the setup command again to modify his existing POST commitment from a repl session.
  • The POST commitment is per node identity and not related to a user account. Users get validation awards for their nodes by associating a public Spacemesh account id with their node via a node config param.
  • User may change his or her coin-base account used for validation awards using the repl.

Setup with default settings

$ setup
> Spacemesh requires a minimum of 300GB of free disk space. 250GB are used for POST and 50GB are reserved for the computer state. You may allocate additional disk space for POST in 300GB increments.
$ POST allocation (GB): 300
> Checking disk...
> Check completed - 350GB free space available.
> The initial POST process may take up to 48 hours to complete. Once completed your copy of Spacemesh will join the network and you will start earning validation coin awards. Please don't exit this app until this one-time setup is complete.
> Working... [------XXXXXXXX] - 3% done
> POST Successfully created. Welcome to Spacemesh :-)
$

Setup with modified POST allocation

$ setup
> Spacemesh requires a minimum of 300GB of free disk space. 250GB are used for POST and 50GB are reserved for the global computer state. You may allocate additional disk space for POST in 300GB increments.
$ POST allocation (GB): 900
> Checking disk...
Check completed - 950GB free space available.
The initial POST process may take up to 48 hours to complete. Once completed your copy of Spacemesh will join the network and you will start earning validation coin awards. Please don't exit this app until this one-time setup is complete.
Working... [------XXXXXXXX] - 3% done
POST Successfully created. Joining the network as a validator...
$

First Time User Experience

  • On first run, the REPL prompts the user to input the coin-base account public id or use the wallet to create one.
  • Once the user sets up the coin-base account, the node should save the public id in the node default config file so it may be used in future node sessions.
$ Welcome to Spacemesh.
> Please paste your public account id from your Spacemesh Wallet app here.
Don't have one? Run the Spacemesh UI to create a new wallet: GZsJqUXaEPs35S1HRZehp45eiKRJ3YJfdAH63wkiZYiYyhLanf
> Coin-base account set and persisted in the config file.
Spacemesh requires a minimum of 300GB of free disk space. 250GB are used for POST and 50GB are reserved for the computer state. You may allocate additional disk space for POST in 300GB increments.
POST allocation (GB): 300
> Checking disk...
Check completed - 350GB free space available.
The initial POST setup process may take up to 48 hours to complete. Once completed your copy of Spacemesh will join the network and you will start earning validation coin awards. Please don't exit this app until this one-time setup is complete.
Working... [------XXXXXXXX] - 3% done
POST commitment successfully created. Joining the network as a validator...
Your coin-base user account is GZsJqUXaEPs35S1HRZehp45eiKRJ3YJfdAH63wkiZYiYyhLanf.
[Node user messages appear here in this console session...]

Getting Started

Dev Guides

Product Specs

Clone this wiki locally