package
1.6.0
Repository: https://github.com/ndau/commands.git
Documentation: pkg.go.dev

# README

ndsh -- the Ndau Shell

The ndau tool is very useful and powerful, but its design is oriented toward a development environment in which convenience is more important than security. This means that all its internal state, including private keys, is persisted in plain text on the user's hard drive. For operational use, we need something more security-oriented.

ndsh fills that need: it stores nothing outside of volatile memory, making it safe to run in secure operational environments.

Features

Implemented

  • is a shell
    • has a prompt
    • can exit to surrounding shell with exit or quit
  • launch with a --net=X argument, where X can be main, test, dev, local, or any URL. Default to main.
  • specify commands to execute on launch, and post-execution exit policy
  • enter a 12-word phrase after launch: it isn't exposed to your shell history
  • automatically asynchronously discover accounts for a given phrase
  • manually add undiscovered accounts by derivation path
  • refer to accounts by nicknames or minimal suffixes
  • list known accounts and nicknames
  • manually add nicknamed "foreign" accounts by address
    • or specify them from the command line (use -c)
  • view account details
  • do most things the ndau tool can do:
    • accounts
      • create new account, return address and derivation path
      • set validation rules (with recovery from recovery service as applicable)
      • create a child account
      • update status from blockchain
      • add, remove validation script
      • perform CRUD operations on arbitrary validation keys
      • change recourse period
      • delegate
      • lock
      • notify
      • stake
      • set rewards destination
      • register node
      • claim node reward
      • send CreditEAI tx
      • closeout account into another account, transfering out all ndau
    • rfe
    • issue
    • transfer
    • transfer and lock
    • get and set system variables
    • get version information
    • get summary/sib information
    • nominate node rewards
    • record price
    • command validation change
  • staged mode for transactions:
    • override any field (via JSON representation)
    • add signatures from arbitrary private keys
    • add signatures directly from certain hardware keys
    • just emit the signable bytes of the current state
    • serialize the JSON out, or send to send to the blockchain
  • certain commands (summary, tx, view) have --jq option to filter the output

Conventions

ndsh expects that every Command implement a safe, idempotent -h flag which displays some help about that command.

# Functions

IsAccountDoesNotExist identifies AccountDoesNotExist errors.
IsNoMatch is true when the provided error is NoMatch.
IsNotUniqueSuffix is true when the provided error is NotUniqueSuffix.
NewAccount creates a new Account from a seed and derivation path It does not attempt to perform any blockchain actions.
NewAccounts creates a new Accounts container.
NewShell initializes the shell.
ParseInto parses the argvs into the destination data This leverages alexflint/go-arg, so the dest struct can be constructed the same way.

# Variables

ClientURL stores client URL currently in use.
ErrNilStage is returned when Stage or Tx is nil.
RecoveryURL stores the recovery URL currently in use.

# Structs

An Account is the ndsh's internal representation of an account.
AccountDoesNotExist is returned from Update if the account does not exist.
Accounts manage tracking and querying a list of accounts There's a lot of internal complexity here, most of which is to support a simple feature: you can refer to an account by any number of nicknames, or its address, any unique suffix of any of those.
Add adds accounts and/or nicknames.
ChangeRecourse changes an account's recourse period.
ChangeValidation changes an account's validation rules.
ClaimNodeReward claims node rewards for which an account has been nominated.
Closeout an account.
CommandValidatorChange changes the validation power of a node.
CreateChild creates a child account, assigning its initial attributes.
CreditEAI credits EAI to all accounts delegated to the specified account.
Delegate delegates to an account.
Exit leaves the shell.
Help provides help about general usage and specific commands.
Issue issues ndau from the Endowment.
ListAccounts lists all known accounts.
LoadSystemAccounts loads the accounts described in system_accts.toml.
Lock locks an account.
Net prints the net currently connected to, or updates it.
New creates a new account.
NoMatch is returned when someone tries to Get an account, but there are no matching names.
NominateNodeRewards nominates a node account to receive rewards.
Notify an account.
NotUniqueSuffix is returned when someone tries to Get an account with an insufficient suffix to distinguish it from other candidates.
RecordPrice records the current market price of ndau (in USD).
Recover an account from its seed phrase.
RecoverKeys recovers the keys of an account.
RegisterNode registers an account as an active node.
ReleaseFromEndowment releases ndau from the endowment.
SetRewardsDestination sets an account's destination for EAI and node rewards.
SetValidation assigns an account's first validation keys and script.
Shell manages global state, dispatching commands, and other similar responsibilities.
Stage keeps track of a staged transaction.
Stake an account.
Summary displays version information.
Sysvar changes a system variable.
Transfer transfers ndau from on account to another.
TransferAndLock transfers ndau to a newly-created account and locks it.
Tx manipulates a prepared transaction.
Unstake an account.
Verbose sets or displays verbose mode.
Version displays version information.
View views an account.
Watch adds foreign accounts, sometimes with nicknames.

# Interfaces

A Command acts like a sub-program: it can specify its own argument parser, and can succeed or fail, displaying arbitrary messages as a result, without exiting the shell.