Delegator Guide (CLI)

This document contains all the necessary information for delegators to interact with the Swisstronik through the Command-Line Interface (CLI).

It also contains instructions on how to manage accounts and restore accounts from the fundraiser.

Very Important: Please ensure that you follow the steps described hereinafter carefully, as negligence in this significant process could lead to an indefinite loss of your SWTRs. Therefore, read through the following instructions in their entirety prior to proceeding and reach out to us if you need support.

Please also note that you are about to interact with the Swisstronik, a blockchain technology containing highly experimental software. While the blockchain has been developed in accordance to the state of the art and audited with utmost care, we can nevertheless expect to have issues, updates and bugs. Furthermore, interaction with blockchain technology requires advanced technical skills and always entails risks that are outside our control. By using the software, you confirm that you understand the inherent risks associated with cryptographic software and that the Swisstronik Team may not be held liable for potential damages arising out of the use of the software. Any use of this open source software released under the Apache 2.0 license is done at your own risk and on a "AS IS" basis, without warranties or conditions of any kind.

Please exercise extreme caution!

Swisstronik Accounts

At the core of every Swisstronik account, there is a seed, which takes the form of a 12 or 24-words mnemonic. From this mnemonic, it is possible to create any number of Swisstronik accounts, i.e. pairs of private key/public key. This is called an HD wallet (see BIP32 for more information on the HD wallet specification).

The funds stored in an account are controlled by the private key. This private key is generated using a one-way function from the mnemonic. If you lose the private key, you can retrieve it using the mnemonic. However, if you lose the mnemonic, you will lose access to all the derived private keys. Likewise, if someone gains access to your mnemonic, they gain access to all the associated accounts.

Do not lose or share your 12 words with anyone. To prevent theft or loss of funds, it is best to ensure that you keep multiple copies of your mnemonic, and store it in a safe, secure place and that only you know how to access. If someone is able to gain access to your mnemonic, they will be able to gain access to your private keys and control the accounts associated with them.

The address is a public string with a human-readable prefix (e.g. swtr15srdmqa9934z6utqywsagt456va5xwjpwvmpth) that identifies your account. When someone wants to send you funds, they send it to your address. It is computationally infeasible to find the private key associated with a given address.

Creating an Account

To create an account, you just need to have swisstronikd installed. Before creating it, you need to know where you intend to store and interact with your private keys. The best options are to store them in an offline dedicated computer or a ledger device. Storing them on your regular online computer involves more risk, since anyone who infiltrates your computer through the internet could exfiltrate your private keys and steal your funds.

It is more secure to perform this action on an offline computer.

To generate an account, just use the following command:

swisstronikd keys add <your_key_name>

The command will generate a 24-word mnemonic and save the private and public keys for account 0 at the same time. Each time you want to send a transaction, you will need to unlock your system's credentials store. If you lose access to your credentials storage, you can always recover the private key with the mnemonic.

  • <your_key_name> is the name of the account. It is a reference to the account number used to derive the key pair from the mnemonic. You will use this name to identify your account when you want to send a transaction.

  • You can add the optional --account flag to specify the path (0, 1, 2, ...) you want to use to generate your account. By default, account 0 is generated.

You may not be prompted for password each time you send a transaction since most operating systems unlock user's credentials store upon login by default. If you want to change your credentials store security policies please refer to your operating system manual.

Do not lose or share your 12 words with anyone. To prevent theft or loss of funds, it is best to ensure that you keep multiple copies of your mnemonic, and store it in a safe, secure place and that only you know how to access. If someone is able to gain access to your mnemonic, they will be able to gain access to your private keys and control the accounts associated with them.

After you have secured your mnemonic (triple check!), you can delete bash history to ensure no one can retrieve it:

history -c 
rm ~/.bash_history

You can generate more accounts from the same mnemonic using the following command:

swisstronikd keys add <your_key_name> --recover --account 1

This command will prompt you to input a passphrase as well as your mnemonic. Change the account number to generate a different account.

Accessing the Swisstronik Network

In order to query the state and send transactions, you need a way to access the network. To do so, you can either run your own full-node, or connect to someone else's.

Do not share your mnemonic (12 or 24 words) with anyone. The only person who should ever need to know it is you. This is especially important if you are ever approached via email or direct message by someone requesting that you share your mnemonic for any kind of blockchain services or support. No one from Swisstronik Team will ever send an email that asks for you to share any kind of account credentials or your mnemonic.

Running Your Own Full-Node

This is the most secure option, but comes with relatively high resource requirements. In order to run your own full-node, you need good bandwidth and at least 1TB of disk space.

You will find the tutorial on how to install swisstronikd and run a full-node here.

Connecting to a Remote Full-Node

If you do not want or cannot run your own node, you can connect to someone else's full-node. You should pick an operator you trust, because a malicious operator could return incorrect query results or censor your transactions. However, they will never be able to steal your funds, as your private keys are stored locally on your computer or ledger device. Possible options of full-node operators include validators, wallet providers or exchanges.

In order to connect to the full-node, you will need an address of the following form: https://77.87.106.33:26657 (Note: This is a placeholder). This address has to be communicated by the full-node operator you choose to trust.

Setting Up swisstronikd

Before setting up swisstronikd, make sure you have set up a way to access the Swisstronik network

Please check that you are always using the latest stable release of swisstronikd

swisstronikd is the tool that enables you to interact with the node that runs on the Swisstronik network, whether you run it yourself or not. Let us set it up properly.

In order to set up swisstronikd, use the following command:

swisstronikd config <flag> <value>

It allows you to set a default value for each given flag.

First, set up the address of the full-node you want to connect to:

swisstronikd config node <host>:<port 
// example: swisstronikd config node https://77.87.106.33:26657 (note: this is a placeholder)

If you run your own full-node, just use tcp://localhost:26657 as the address.

Finally, let us set the chain-id of the blockchain we want to interact with:

swisstronikd config chain-id swisstronik_1291-1

Querying the State

Before you can bond SWTR and withdraw rewards, you need to set up swisstronikd

swisstronikd lets you query all relevant information from the blockchain, like account balances, amount of bonded tokens, outstanding rewards, governance proposals and more. Next is a list of the most useful commands for delegators.

// query account balances and other account-related information
swisstronikd query account <yourAddress>

// query the list of validators
swisstronikd query staking validators

// query the information of a validator given their address (e.g. swtrvaloper15srdmqa9934z6utqywsagt456va5xwjp9p5r82)
swisstronikd query staking validator <validatorAddress>

// query all delegations made from a delegator given their address (e.g. swtr15srdmqa9934z6utqywsagt456va5xwjpwvmpth)
swisstronikd query staking delegations <delegatorAddress>

// query a specific delegation made from a delegator (e.g. swtr15srdmqa9934z6utqywsagt456va5xwjpwvmpth) to a validator (e.g. swtrvaloper15srdmqa9934z6utqywsagt456va5xwjp9p5r82) given their addresses
swisstronikd query staking delegation <delegatorAddress> <validatorAddress>

// query the rewards of a delegator given a delegator address (e.g. swtr15srdmqa9934z6utqywsagt456va5xwjpwvmpth)
swisstronikd query distribution rewards <delegatorAddress>

// query all proposals currently open for depositing
swisstronikd query gov proposals --status deposit_period

// query all proposals currently open for voting
swisstronikd query gov proposals --status voting_period

// query a proposal given its proposalID
swisstronikd query gov proposal <proposalID>

For more commands, just type:

swisstronikd query

For each command, you can use the -h or --help flag to get more information.

Bonding SWTR and Withdrawing Rewards

Before you can bond SWTR and withdraw rewards, you need to set up swisstronikd and create an account.

Before bonding SWTR, please read the delegator overview to understand the risk and responsibilities involved with delegating.

Note: These commands need to be run on an online computer.

// Bond a certain amount of SWTRs to a given validator
// ex value for flags: <validatorAddress>=swtrvaloper15srdmqa9934z6utqywsagt456va5xwjp9p5r82, <amountToBound>=10000000aswtr, <gasPrice>=7aswtr

swisstronikd tx staking delegate <validatorAddress> <amountToBond> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>


// Redelegate a certain amount of aswtr from a validator to another
// Can only be used if already bonded to a validator
// Redelegation takes effect immediately, there is no waiting period to redelegate
// After a redelegation, no other redelegation can be made from the account for the next 3 weeks
// ex value for flags: <stcValidatorAddress>=swtrvaloper15srdmqa9934z6utqywsagt456va5xwjp9p5r82, <amountToRedelegate>=100000000aswtr, <gasPrice>=7swtr

swisstronikd tx staking redelegate <srcValidatorAddress> <destValidatorAddress> <amountToRedelegate> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>

// Withdraw all rewards
// ex value for flag: <gasPrice>=7aswtr

swisstronikd tx distribution withdraw-all-rewards --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>


// Unbond a certain amount of SWTRs from a given validator
// You will have to wait 3 weeks before your SWTRs are fully unbonded and transferrable
// ex value for flags: <validatorAddress>=swtrvaloper15srdmqa9934z6utqywsagt456va5xwjp9p5r82, <amountToUnbound>=10000000aswtr, <gasPrice>=7swtr

swisstronikd tx staking unbond <validatorAddress> <amountToUnbond> --from <delegatorKeyName> --gas auto --gas-adjustment 1.5 --gas-prices <gasPrice>

To confirm that your transaction went through, you can use the following queries:

Double check with a block explorer if you interact with the network through a trusted full-node.

Last updated