Quick Guide to Delegated Staking

Delegated Staking

Delegate VID Tokens to Secure VideoCoin Network and get rewarded

VID Token holders can actively participate in securing the VideoCoin network by delegating a portion of their tokens to transcode workers. The transcoding work is distributed to workers in proportion to the total stake of each worker. The total stake of a worker includes the self stake and delegated stake by one or more delegators. The delegated stake can be withdrawn. However, the VID tokens are transferred to the holder’s account after the expiry of the unbonding time which is currently set at 21 days.

Delegators will be rewarded by distributing a portion of the rewards earned by the worker. Please refer to the document on reward distribution for the details.
Delegation and withdrawal can be performed through a tool called staker that is wrapped as a docker image. This tool is used by workers for self delegation as well as by delegators to delegate tokens to a worker. Follow the below steps:

  • Download the command line docker image of staker. https://hub.docker.com/r/videocoinnetwork/staker
  • Setup a configuration file in the format of the Ethereum key store file that contains a private key and public key (password protected). The encrypted private key in this file should be able to access our ERC_20 VID Tokens on Ethereum Mainnet. The same account is used on the VideoCoin network also.
  • Run the delegate or withdraw commands as shown in the following sections.

Setup

The staker tool needs to communicate with the Ethereum main net to access VID tokens. You can use a free or paid subscription from Infura to access Ethereum through a web interface. Please visit the Infura website (https://infura.io/product) and obtain your ID and make it available to the staker tool. Replace the <ethereum_mainnet_rpc_url> with the URL (along with product id) in the staker commands listed below.

Prepare an Ethereum key file that contains your private key in encrypted form. The following is a sample key file for reference. Supply this file to the staker tool. This filename can be used to replace in the staker commands.

{'address': 'fd41a83c713bd0d612c0ca0fd078ec6cc5d37cfb',
'crypto': {'cipher': 'aes-128-ctr',
           'cipherparams': {'iv': '47db6518e4ecc7e8c5800722f173e214'},
           'ciphertext': '2d09d0c77a4a00cfb59fe5cbe0cf867c32b04e725ccacca52e96d3c1bb70a067',
           'kdf': 'scrypt',
           'kdfparams': {'dklen': 32,
                         'n': 4096,
                         'p': 6,
                         'r': 8,
                         'salt': '2f1790fe23a3a1957b75d73f1be8d4814129e512b9e9956687774b4471c3be7f'},
           'mac': '008c38f40bdb4c0d5faaa30f9e55c4798974447fdd9c7f8535914e323c2268d8'},
'id': '23f7b36d-ff7b-4a9d-954e-06ed3fa7a1fa',
'version': 3}

Delegation Process

Currently, the delegation is a two-step process. The first step is to move the ERC-20 VID tokens from Ethereum’s main net to the VideoCoin Network. The second step is to stake native VID on the worker that you choose.
Use the following command to transfer VID tokens from Ethereum main net to VideoCoin network:

$ docker run --rm -it --env="ETH_RPC_URL=<ethereum_mainnet_rpc_url>" -v $PWD:/tmp videocoinnetwork/staker fund 4 -k /tmp/<worker-key-file> -s <secret>

Use the following command to delegate VID to a worker:

$ docker run --rm -it --env="ETH_RPC_URL=<ethereum_mainnet_rpc_url>" -v $PWD:/tmp videocoinnetwork/staker delegate add worker.PuK amount -k <worker-key-file>  -s <password>
Parameter Description
worker.PuK Address of worker for which delegation is requested
amount Amount of VID to be delegated

If the worker is not registered with the VideoCoin, the command fails. VideoCoin explorer can be used to obtain the list of workers registered with the VideoCoin Network

Use the following command to show the balances:

$ docker run --rm -it --env="ETH_RPC_URL=<ethereum_mainnet_rpc_url>" -v $PWD:/tmp videocoinnetwork/staker probe -k /tmp/<worker-key-file>  -s <password>
Parameter Description
worker.PuK Address of worker for which delegation is requested
amount Amount of VID to be delegated

If the worker is not registered with the VideoCoin, the command fails. VideoCoin explorer can be used to obtain the list of workers registered with the VideoCoin Network

Withdraw Process

Use the following command to withdraw stake from a worker:

$ docker run --rm -it --env="ETH_RPC_URL=<ethereum_mainnet_rpc_url>" -v $PWD:/tmp videocoinnetwork/staker delegate withdraw <worker.PuK> <amount> -k /tmp/<worker-key-file> -s <password>
Parameter Description
worker.PuK Address of worker from which delegator is withdrawing stake
amount Amount VID to be withdrawn from the worker

The withdrawn stake is deposited to the delegator’s accounts only after the expiry of unbonding period.

Use the following command to complete pending unbonding requests that are initiated in the previous step:

$ docker run --rm -it --env="ETH_RPC_URL=<ethereum_mainnet_rpc_url>" -v $PWD:/tmp videocoinnetwork/staker delegate withdraw complete -k  /tmp/<worker-key-file> -s <password>

Use the following command to transfer native VID from VideoCoin network to ERC-20 VID tokens on Ethereum main net:

$ docker run --rm -it --env="ETH_RPC_URL=<ethereum_mainnet_rpc_url>" -v $PWD:/tmp videocoinnetwork/staker withdraw <amount> -k  /tmp/<worker-key-file> -s <password>
Parameter Description
amount Amount of VID to be transferred from VideoCoin network to ERC-20 on Ethereum Mainnet