skalenetwork / validator-cli

A command line tool for validators and delegators. Written in Python.
https://skale.network
GNU Affero General Public License v3.0
10 stars 4 forks source link
cli click python skale-network web3py

SKALE Validator CLI

Build and publish Test Discord

Table of Contents

  1. Installation
  2. CLI usage
    2.1 Init
    2.2 Validator commands
    2.3 Holder commands
    2.4 Metrics commands
    2.5 Wallet commands
    2.6 Self-recharging wallet commands
  3. Exit codes
  4. Development

Installation

Requirements

VERSION_NUM={put the version number here} && sudo -E bash -c "curl -L https://github.com/skalenetwork/validator-cli/releases/download/$VERSION_NUM/sk-val-$VERSION_NUM-`uname -s`-`uname -m` >  /usr/local/bin/sk-val"
sudo chmod +x /usr/local/bin/sk-val

Where to find out the latest version?

All validator-cli version numbers are available here: https://github.com/skalenetwork/validator-cli/releases

CLI Usage

Init

Download SKALE Manager contracts info and set the endpoint.

sk-val init

Required arguments:

If you want to use sgx wallet you need to initialize it first (see SGX commands)

Usage example:

sk-val init -e ws://geth.test.com:8546 -c https://test.com/manager.json --wallet software

SGX commands

Init

Initialize sgx wallet

sk-val sgx init [SGX_SERVER_URL]

Optional arguments:

Info

Print sgx wallet information

sk-val sgx info 

Optional arguments:

Validator commands

Register

Register as a new SKALE validator

sk-val validator register

Required arguments:

Optional arguments:

Usage example:

sk-val validator register -n test -d "test description" -c 20 --min-delegation 1000 --pk-file ./pk.txt

List

List of available validators

sk-val validator ls

Options:

Delegations

List of delegations for validator ID

sk-val validator delegations [VALIDATOR_ID]

Required params:

1) VALIDATOR_ID - ID of the validator

Accept pending delegation

Accept pending delegation request by delegation ID

sk-val validator accept-delegation --pk-file ./pk.txt

Required arguments:

Optional arguments:

Accept all pending delegations

Accept ALL pending delegations request for the address.
List with all pending delegations to be accepted will be shown. After this user should confirm the operation.

sk-val validator accept-all-delegations --pk-file ./pk.txt

Optional arguments:

Validator linked addresses

List of the linked addresses for validator address

sk-val validator linked-addresses [ADDRESS]

Required params:

1) Address - Ethereum address of the validator

Link address

Link node address to the validator account

sk-val validator link-address [ADDRESS] [NODE_SIGNATURE] --pk-file ./pk.txt

Required params:

1) Address - Ethereum address that will be linked 2) Node signature - Signature of the node that you can get using skale node signature command from skale-node-cli

Optional arguments:

Unlink address

Unlink node address from the validator account

sk-val validator unlink-address [ADDRESS] --pk-file ./pk.txt

Required params:

1) Address - Ethereum address that will be unlinked

Optional arguments:

Validator info

Info about the validator

sk-val validator info [VALIDATOR_ID]

Required params:

1) Address - Ethereum address of the validator

Output info:

1) Validator ID 2) Name 3) Address 4) Fee rate (percent - %) 5) Minimum delegation amount (SKL) 6) Accepting new delegation requests

Withdraw fee

Withdraw earned fee to specified address

sk-val validator withdraw-fee [RECIPIENT_ADDRESS] --pk-file ./pk.txt

Required params:

1) RECIPIENT_ADDRESS - Address to transfer bounty

Optional arguments:

Set MDA

Set a new minimum delegation amount for the validator

sk-val validator set-mda [NEW_MDA] --pk-file ./pk.txt

Required params:

1) NEW_MDA - New MDA value

Optional arguments:

Request address change

Request address change for the validator

sk-val validator change-address [ADDRESS] --pk-file ./pk.txt

Required params:

1) ADDRESS - New validator address

Optional arguments:

Confirm address change

Confirm address change for the validator. Should be executed using new validator key.

sk-val validator confirm-address [VALIDATOR_ID] --pk-file ./pk.txt

Required params:

1) VALIDATOR_ID - ID of the validator

Optional arguments:

Earned fees

Get earned fee amount for the validator address

sk-val validator earned-fees [ADDRESS]

Required params:

1) ADDRESS - Validator address

Optional arguments:

Holder commands

Delegate

Delegate tokens to validator

sk-val holder delegate

Required arguments:

Optional arguments:

Delegations

List of delegations for address

sk-val holder delegations [ADDRESS]

Required arguments:

1) ADDRESS - Ethereum address of the token holder

Options:

Cancel pending delegation

Cancel pending delegation request

sk-val holder cancel-delegation [DELEGATION_ID]

Required params:

1) Delegation ID - ID of the delegation to cancel

Optional arguments:

Request undelegation

Request undelegation in the end of delegation period

sk-val holder undelegate [DELEGATION_ID]

Required params:

1) Delegation ID - ID of the delegation

Optional arguments:

Withdraw bounty

Withdraw earned bounty to specified address

sk-val holder withdraw-bounty [VALIDATOR_ID] [RECIPIENT_ADDRESS] --pk-file ./pk.txt

Required params:

1) VALIDATOR_ID - ID of the validator 2) RECIPIENT_ADDRESS - Address to transfer bounty

Optional arguments:

Locked

Show amount of locked tokens for address

sk-val holder locked [ADDRESS]

Required arguments:

1) ADDRESS - Ethereum address of the token holder

Options:

Earned bounties

Get earned bounties amount by token holder for the validator ID

sk-val holder earned-bounties [VALIDATOR_ID] [ADDRESS]

Required params:

1) VALIDATOR_ID - ID of the validator 1) ADDRESS - Token holder address

Optional arguments:

Wallet commands

Setup Ledger

This command works only if you're using the Ledger wallet

sk-val wallet setup-ledger

Required params:

Send ETH tokens

Send ETH tokens to specific address

sk-val wallet send-eth [ADDRESS] [AMOUNT]

Required arguments:

1) ADDRESS - Ethereum receiver address 2) AMOUNT - Amount of ETH tokens to send

Optional arguments:

Usage example:

sk-val wallet send-eth 0x01C19c5d3Ad1C3014145fC82263Fbae09e23924A 0.01 --pk-file ./pk.txt --yes

Send SKL tokens

Send SKL tokens to specific address

sk-val wallet send-skl [ADDRESS] [AMOUNT]

Required arguments:

1) ADDRESS - Ethereum receiver address 2) AMOUNT - Amount of SKL tokens to send

Optional arguments:

Usage example:

sk-val wallet send-skl 0x01C19c5d3Ad1C3014145fC82263Fbae09e23924A 0.01 --pk-file ./pk.txt --yes

Self-recharging wallet commands

Balance

Show balance of the validator self-recharging wallet

sk-val srw balance [VALIDATOR_ID]

Required arguments:

1) VALIDATOR_ID - ID if the validator

Optional arguments:

Usage example:

sk-val srw balance 1 --wei

Recharge

Recharge validator SRW wallet (amount in ETH)

sk-val srw recharge [AMOUNT]

Required arguments:

1) AMOUNT - Amount of ETH to recharge

Optional arguments:

Usage example:

sk-val srw recharge 0.1 --pk-file ./tests/test-pk.txt

Withdraw

Withdraw ETH from validator SRW wallet (amount in ETH)

sk-val srw withdraw [AMOUNT]

Required arguments:

1) AMOUNT - Amount of ETH to withdraw

Optional arguments:

Usage example:

sk-val srw withdraw 0.1 --pk-file ./tests/test-pk.txt

Exit codes

Exit codes conventions for SKALE CLI tools

Development

Setup repo

Install development dependencies

pip install -e .[dev]
Add flake8 git hook

In file .git/hooks/pre-commit add:

#!/bin/sh
flake8 .

Debugging

Run commands in dev mode:

python main.py YOUR_COMMAND

Setting up Travis

Required environment variables:

License

GitHub

All contributions are made under the GNU Affero General Public License v3. See LICENSE.