Validating staking, deposit and withdrawal
Common steps for depositing and withdrawal
- Pre-requisite; your computer should be connected to the mainnet and blocks should be getting created. Instructions at: Connecting To Mainnet.
- Wait for all blocks to get downloaded from the previous step. You can check the latest block at DpScan.app. If you try to run the next set of steps before all blocks are downloaded, you might get gas related errors.
-
Open the appropriate shell window. Do not close the other shell window in which the mainnet is connected to.
-
Change to the folder where the blockchain node client is located.
-
This step is specific to Mac and Linux. Set the environment variable to the required library path. Remember that if you open a new Terminal window anytime, you will need to run this command again, to set the environment variable. You might want to add this environment variable to your shell profile.
-
Set the environment variables to point to the data folder and DP_RAW_URL.
Windowsset DP_KEY_FILE_DIR=c:\dp\data\keystore
set DP_RAW_URL=\\.\pipe\geth.ipc
export DP_KEY_FILE_DIR=$HOME/dp/data/keystore
export DP_RAW_URL=$HOME/dp/data/geth.ipc
In case you get any error related to DP_RAW_URL, try the following instead:
export DP_RAW_URL=~/.ethereum/geth.ipc
export DP_KEY_FILE_DIR=$HOME/dp/data/keystore
export DP_RAW_URL=$HOME/dp/data/geth.ipc
In case you get any error related to DP_RAW_URL, try the following instead:
export DP_RAW_URL=~/.ethereum/geth.ipc
Depositing
- Pre-requisite; you should already have a quantum wallet with coins for staking. A minimum of 5,000,000 (5 million) coins are required for staking.
- If you used the Desktop Wallet app to manage your quantum coins, click the Wallets option on the left bottom corner, then use the Backup option to save the wallet file into the keystore folder (see previous step for where this folder is located)
-
Create a quantum wallet for validating. This wallet will henceforth be called as the validator wallet. This wallet is different from the wallet from which you will be depositing the coins for staking. You will be prompted to enter a password. Ensure you use a strong password atleast 16 characters in length. You should never forget your password. If you don't remember it, the wallet will be useless and you cannot access any coins or tokens inside it.
- Once you execute the above command successfully, the quantum wallet will be created. Note down the address of this wallet from the output of the above command. This will be your validator quantum address.
-
You will also notice that a file has been created under the data\keystore location. This is your quantum wallet. An example is shown below:
Example: Path of the secret key file: data\keystore\UTC--2024-01-13T21-09-56.375263700Z--a553b8935988e6260b6e3c3ff5b340ee478b504b7166b4881365a9153c80a78c
- Backup the above wallet file in 3 different offline devices as explained in Prepare your device. You should not proceed to remaining steps until you backup the wallet.
- Remember that you will always need the password to use the wallet. If you don't remember it, the wallet will be useless and you cannot access any coins or tokens inside it. Consider noting down this password safely offline in a trusted location.
- Likewise, even if you remember the password, if the wallet file is lost or corrupted, you cannot access any coins or tokens. If the wallet is stolen and the password is not strong, the attacker can get all the coins or tokens in your wallet. Hence you should keep your wallet well protected.
- Copy the quantum wallet from which you are depositing the coins from, into the data\keystore folder.
-
Run the following command to deposit coins.
Replace DEPOSITOR_ADDRESS with the address of the wallet that has the coins to deposit. Ensure this wallet also has additional coins for gas fees for the transaction.
Replace VALIDATOR_ADDRESS with the address of the wallet for validating as specified in step 2.
Replace DEPOSITOR_AMOUNT with the number of coins you want to deposit. You should leave atleast 10000 coins in your account instead of depositing all coins; this is for gas fees for this deposit transaction and also future transactions when you want to withdraw the deposited coins. - If the above command is successful, you should see a confirmation message. After about 10 minutes, you may check the despoit balance by following the steps in the section below: Checking Staking Balance.
- You should proceed to immediately run the validator node by following the steps in . Otherwise you might loose coins due to inactivity slashing.
- You should move the depositor quantum wallet to a different device and also keep multiple backups offline. You shouldn't keep the depositor quantum wallet in the same computer that is running the blockchain node. Only the validator wallet should be kept on this computer. If you loose your depositor quantum wallet or forgot the password or it gets stolen, even if you have the validator wallet, you will not be able to get your deposited coins back. Keep both your depositor and validator wallets safe!
Checking Staking Details, Mining Rewards etc.
- Pre-requisite; you should already have staked coins and the validator node is running.
-
You can check the staked balance by running the following command, replacing VALIDATOR_ADDRESS with your validator wallet address.
Alternatively, you can also search by your validator or depositor address in the Block Explorer.
Increasing Deposit
- Pre-requisite; you should already have staked coins and the validator node is running.
-
You can increase your staked coins by running the following command, replacing DEPOSITOR_ADDRESS with your depositor address and ADDITIONAL_DEPOSIT_AMOUNT with the additional number of coins you would like to deposit.
You should always leave about 100,000 coins in your depositor wallet for gas fees in the future when withdrawing coins or mined rewards coins.
Withdrawing
- Pre-requisite; you should already have deposited coins for staking.
- Copy the depositor quantum wallet under the data\keystore folder if not already copied.
-
You can initiate the withdrawal of mined coins (block rewards) by running the following command after block 421888 (before this block, the command was different).
Alternatively, you can also withdraw partially including deposit amount, by running the second command. You have to be careful since giving a large amount (number of coins) can cause your balance to go below the 5 million threshold that is required to become a validator.
WindowsWithdraw Rewardsdputil initiatewithdrawalrewards DEPOSITOR_ADDRESS
Alternate: Withdraw Partial Coinsdputil initiatepartialwithdrawal DEPOSITOR_ADDRESS AMOUNT
Withdraw Rewards./dputil initiatewithdrawalrewards DEPOSITOR_ADDRESS
Alternate: Withdraw Partial Coins./dputil initiatepartialwithdrawal DEPOSITOR_ADDRESS AMOUNT
Withdraw Rewards./dputil initiatewithdrawalrewards DEPOSITOR_ADDRESS
Alternate: Withdraw Partial Coins./dputil initiatepartialwithdrawal DEPOSITOR_ADDRESS AMOUNT
-
If the above command is successful and the deposit completes, you can withdraw the staked coins after 32000 blocks have been mined, by running the following command. This can be upto 7 days or more as of current block times.
WindowsFor withdrawals initiated after block 421888dputil completepartialwithdrawal DEPOSITOR_ADDRESS
Alternate: For withdrawals initiated before block 421888dputil completewithdrawal DEPOSITOR_ADDRESS
For withdrawals initiated after block 421888./dputil completepartialwithdrawal DEPOSITOR_ADDRESS
Alternate: For withdrawals initiated before block 421888./dputil completewithdrawal DEPOSITOR_ADDRESS
For withdrawals initiated after block 421888./dputil completepartialwithdrawal DEPOSITOR_ADDRESS
Alternate: For withdrawals initiated before block 421888./dputil completewithdrawal DEPOSITOR_ADDRESS
Pausing and Resuming Validation
- Pre-requisite; you should already have staked coins and the validator node is running.
-
If you have to stop your validator node for maintenance, you can pause and resume validation. This not only helps the blockchain reduce unnecessary time spent waiting for your validator node, but also will prevent slashing (penalty) in the future.
WindowsPausing Validationdputil pausevalidation DEPOSITOR_ADDRESS
Resuming Validationdputil resumevalidation DEPOSITOR_ADDRESS
Pausing Validation./dputil pausevalidation DEPOSITOR_ADDRESS
Resuming Validation./dputil resumevalidation DEPOSITOR_ADDRESS
Pausing Validation./dputil pausevalidation DEPOSITOR_ADDRESS
Resuming Validation./dputil resumevalidation DEPOSITOR_ADDRESS
Changing Validator Wallet
- Pre-requisite; you should already have staked coins and the validator node is running.
-
Sometimes you might want to change the validator wallet, for example if it was compromised (stolen). You can run the following command to change the validator wallet.
Ensure that you restart the validator node with the new validator wallet (refer to steps earlier in this document). Move the old validator wallet to a different location before starting the node again. Future improvements will be made to this process to avoid the node restart when changing validator wallets.