Staking in proof-of-stake blockchain - Doge Protocol
Doge Protocol testnet is based on Ethereum code base with Quantum Resistance and other updates added on top of it. The node client software GETH of Ethereum was modified to achieve this functionality. The steps to interact with the blockchain including checking account balance, sending and receiving coins etc. remain the same. For more information, see Geth Console.
-
Ensure that your account is connected to the blockchain.
If you open a new command prompt or terminal, you will need to run the set (Windows) or export (Linux) commands again as described in the above link. - Ensure that there are coins in your wallet for staking. If not, you can reach out in the Doge Protocol community support channel for testnet (Link to Discord in menu), to get some coins for testing.
-
For Windows: Connect to the geth console; this is a pre-requisite for all further commands. Open a command prompt and change to the folder where geth is located. Then run the following command:
If the command is successful, you should see a prompt show up, waiting for keyboard input. You will also see your account-address printed on screen, with the label "coinbase".geth attach \\.\pipe\geth.ipc
-
Create validator account; For better security, the wallet (account) used for running validator nodes is different from your original wallet. Doing this allows you to keep your account wallet safe offline, such as in an air-gapped media.
To create a validator account, open a command prompt and change to the folder where geth is located. Then run the following command:
You need to prefix the above command with .\ if you are using PowerShell in admin mode. Running the above command will also show your validator account address.geth --datadir data account new
- Securely backup the content of the folder named data. This folder contains your validator account's quantum-resistant key.
-
Run the following two commands: this will set the staking contract to be used in a subsequent step.
set GETH_RAW_URL=\\.\pipe\geth.ipc
set GETH_STAKING_CONTRACT_ADDRESS=0x248c9eeefcc6a45ff8556cbc046287220d4361d7
-
Next, run the following two commands. Replace the address and password with the ones for your actual account that was created as described in Setting up blockchain node client:
set GETH_STAKING_DEPOSITER=YourWalletAddressGoesHere
While it is unsafe to set a password in an environment variable, it should be ok for the purpose of testing.set GETH_STAKING_DEPOSITER_PASS=YourWalletPasswordGoesHere
-
Next, run the following two commands. Replace the address and password with the ones for your validator account as described in Step 4) in this document:
set GETH_STAKING_VALIDATOR=YourValidatorAddressGoesHere
While it is unsafe to set a password in an environment variable, it should be ok for the purpose of testing.set GETH_STAKING_VALIDATOR_PASS=YourValidatorPasswordGoesHere
-
Stake some coins; Run the following two commands, replacing 11 with the number of coins you would like to stake. Your account should have so many coins in it, in order to stake.
set GETH_STAKING_DEPOSIT_AMOUNT=11
If the deposit is successful, you will get a transaction hash as a confirmation. In Testnet T3, you can stake only once from a given wallet. This limitation will be removed in subsequent testnets. From here on, your account will be eligible to get block rewards. These rewards will get deposited to your main wallet account. In Testnet T3, slashing has not been implemented yet, hence you will be able to get block rewards, even if you do not run the blockchain node. Once slashing is implemented (in a subsequent testnet), this classical proof-of-stake problem called as nothing-at-stake will be fixed.deposit.exe
-
Withdraw coins; To withdraw staked coins, run the following two commands, replacing 10 with the number of coins you would like to withdraw.
set GETH_STAKING_DEPOSIT_AMOUNT=10
If the deposit is successful, you will get a transaction hash as a confirmation. The amount will be withdrawn from the staking contract to your main wallet address. You may withdraw multiple times as long as you have enough balance in the staking contract.withdraw.exe
- About Testnet T3
- Requirements
- Setting up blockchain node client
- Connecting to the blockchain
- Connecting to the blockchain
- Staking in the proof-of-stake blockchain