How to stake FTM on Opera

This guide details how to stake FTM on Opera chain as Validator (“Staker”) and as a Delegator, using the command-line interface. Delegating will also be available on Fantom’s desktop, web, and mobile wallet applications.

Running a validator

A validator (or “Staker”) is an address that runs a node that participates in the consensus of Lachesis by validating event blocks.

Some important facts about running a validator

  • Minimum stake required at all times is 3,175, 000 FTM
  • When you request to withdraw your stake, you must first deactivate your validator (stop it from validating blocks)
  • Delegator can delegate at most 15 times the amount of tokens the validator has staked itself (for example, if the validator has staked 3,175, 000 FTM, then the maximum number of tokens that can be delegated to it is 3,175,000 FTM*15 = 47,625,000 FTM)
  • Withdrawing tokens from staking after deactivating your validator takes 7 days from when you initiate the request, to when you can actually withdraw

Recommended Hardware

We recommend running at least an AWS T2.large EC2 instance (or equivalent) and at least 800GB of Amazon EBS General Purpose SSD (gp2) storage (or equivalent). This will ensure you participate in the consensus of every block, and allows you to maintain a reasonable “Proof of Importance” score (which is an important factor in the distribution of rewards).

How to Stake

All references to “Staker” refer to a Validator address

  1. Setup a Lachesis node:

Update your environment

sudo apt-get update
sudo apt-get -y upgrade

Install build-essential to install make

sudo apt-get install -y build-essential
wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz
sudo tar -xvf go1.13.3.linux-amd64.tar.gz
sudo mv go /usr/local

Setup golang environment variables

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
mkdir -p $HOME/go/src/github.com/Fantom-foundation
cd $HOME/go/src/github.com/Fantom-foundation/
git clone https://github.com/Fantom-foundation/go-lachesis.git
cd go-lachesis/
make build

Confirm your go-lachesis version

./build/lachesis helpVERSION:
0.3.0-dev
COMMANDS:
account Manage accounts
attach Start an interactive JavaScript environment (connect to node)
console Start an interactive JavaScript environment
dumpconfig Show configuration values
js Execute the specified JavaScript files
wallet Manage Ethereum presale wallets
help Shows a list of commands or help for one command

Download the default genesis mainnet.toml

cd $HOME/go/src/github.com/Fantom-foundation/go-lachesis/build/
wget https://raw.githubusercontent.com/Fantom-foundation/lachesis_launch/master/mainnet.toml

Start your node

./lachesis --config mainnet.toml --nousb

2. Create a new account

First, we need to setup a new account to receive funds in;

./lachesis account new

Follow the prompts and supply the password, you will receive output;

Your new key was generatedPublic address of the key:   0x
Path of the secret key file: - You can share your public address with anyone. Others need it to interact with you.
- You must NEVER share the secret key with anyone! The key controls access to your funds!
- You must BACKUP your key file! Without the key, it's impossible to access account funds!
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!

3. Use the bridge to convert ERC20, BEP2, or Xar Network FTM to Opera FTM

4. Startup as a validator

Stop your current lachesis process

Create an unlock file for the account password

Start the node

./lachesis --config mainnet.toml --nousb --validator 0x --unlock 0x --password /path/to/password

5. Load up the SFC Contract and create a validator

  • Ensure you stake a minimum of 3,175,000 FTM

6. Run sfc.getStakerID(YOUR_ADDRESS)

  • If a number is returned, it means your validator has been added to the SFC, and you are now staking and validating event blocks!

How to Delegate

Delegating via the command line is a relatively complicated process involving the following eight steps. However, from 7 January 2020, delegators will be able to delegate in just a few clicks directly from Fantom’s desktop, web, and mobile wallets.

Some important facts about delegation:

  • Minimum stake of 1 FTM required
  • Currently you cannot increase your delegated stake. We are working on adding that functionality in future releases
  • You can only delegate to one validator at a time
  • Withdrawing tokens from a validator takes 7 days from when you initiate the request, to when you can actually withdraw
  1. Setup a Lachesis node:

Install build tools

Update your environment

sudo apt-get update
sudo apt-get -y upgrade

Install build-essential to install make

sudo apt-get install -y build-essential
wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz
sudo tar -xvf go1.13.3.linux-amd64.tar.gz
sudo mv go /usr/local

Setup golang environment variables

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
mkdir -p $HOME/go/src/github.com/Fantom-foundation
cd $HOME/go/src/github.com/Fantom-foundation/
git clone https://github.com/Fantom-foundation/go-lachesis.git
cd go-lachesis/
make build

Confirm your go-lachesis version

./build/lachesis helpVERSION:
0.3.0-dev
COMMANDS:
account Manage accounts
attach Start an interactive JavaScript environment (connect to node)
console Start an interactive JavaScript environment
dumpconfig Show configuration values
js Execute the specified JavaScript files
wallet Manage Ethereum presale wallets
help Shows a list of commands or help for one command

Download the default genesis mainnet.toml

cd $HOME/go/src/github.com/Fantom-foundation/go-lachesis/build/
wget https://raw.githubusercontent.com/Fantom-foundation/lachesis_launch/master/mainnet.toml

Start your node

./lachesis --config mainnet.toml --nousb

2. Create a new account

First, we need to set up a new account to receive funds in;

./lachesis account new

Follow the prompts and supply the password, you will receive output;

Your new key was generatedPublic address of the key:   0x
Path of the secret key file:- You can share your public address with anyone. Others need it to interact with you.
- You must NEVER share the secret key with anyone! The key controls access to your funds!
- You must BACKUP your key file! Without the key, it's impossible to access account funds!
- You must REMEMBER your password! Without the password, it's impossible to decrypt the key!

3. Use the bridge to convert ERC20, BEP2, or Xar Network FTM to Opera FTM

4. Launch the web3js console by running ./lachesis attach

5. Load the sfc

6. Check the sfc has loaded correctly

// Sanity check
sfc.stakersNum() // if everything is all right, will return non-zero value

7. Get the `stakerID` of the current validators, and then you can ask the actual individual or organisation that runs the validator node that you wish to delegate to.

You can retrieve a list of all current stakerIDs by running

sfc.ValidationStake();

You can also check the list of validators on the explorer here.

Note: It is important that you do your research on the validator you wish to delegate to. Validators cannot steal your staked tokens, but if the validator becomes a cheater (i.e tries to cheat on the network, say, for example, by signing blocks twice) your staked tokens could be reduced. If a validator has a lot of downtime, it won’t be earning any rewards. On the explorer, you can see all active validators, their staked amounts, how much users have delegated to it, their Proof of Importance score, and how long the node has been down for.

8. Create delegation

Delegate a certain number of FTM to a staker. Note that you can only delegate to one validator per address.

If you already have a delegation, then you have to create a new address or withdraw a previous delegation.

amount is set in Wei. Minimum delegation is 1000000000000000000 Wei (1 FTM). Note that 1 FTM = 10¹⁸ Wei

YOUR_ADDRESS = <address>
personal.unlockAccount(YOUR_ADDRESS, <password>, 60) // unlock account for 60 second
tx = sfc.createDelegation(<stakerID>, {from: YOUR_ADDRESS, value: "<amount>"})

Further Reading

For a full list of web3js commands you can execute (such as increasing stake, withdrawing stake, and claiming rewards) please see the documentation here.

Fantom Foundation

The core of the new internet

Michael Kong (FANTOM Foundation)

Written by

Fantom Foundation

The core of the new internet

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade