REStake - Lazy Cosmos Stakeholder Solution
Presumably everyone should have heard of the concept of compound interest in finance, that is, in addition to the interest calculated based on the principal, the newly obtained interest can also earn interest. So as long as the cycle of calculating interest is denser, wealth will grow faster. (The beauty of exponential functions, lol)
Therefore, this concept is extended to the blockchain based on proof of stake, which is the process in which the stakeholder regularly extracts the income obtained by the delegation and then re-delegates it to the verifier. Because human memory is not reliable enough or just want to be lazy and other reasons, someone helped to write a program that can automate this process, which is the REStake mentioned above.
REStake is?
REstake is a project developed and maintained by ECO Stake , a group of people dedicated to promoting environmental improvement with decentralized technology. It helps the stakeholder to automatically complete the regular automatic withdrawal of earnings and delegation to the same validator through Cosmos' Authz module (the ability to authorize a specific wallet address such as the validator's wallet to perform certain transactions in the name of your own wallet) function.
- REStake will only authorize the validator to use the revenue obtained from the delegation from the same validator to delegate to itself, and will not use other funds in your wallet.
- And the validator will help you pay the Gas Fee for the transaction.
- Another point, REStake is open source, you can find its source code at https://github.com/eco-stake/restake .
Stakeholders set REStake
First go to REStake's homepage, which will list the chains supported by REStake:
The information from top to bottom of each chain is:
- The market capitalization and annualized interest rate of this coin.
- Whether this chain supports Authz, if not, REStake cannot automatically complete the operation of repeated delegation, but you can do it manually on the web page.
- Are there any validators on this chain that have REStake enabled.
- The support status of REStake, some chains (like Likecoin) are automatically added to the list, so there may not be enough tests.
After clicking on the corresponding chain, you can see the validators who have enabled REStake, such as Likecoin:
To view your delegates, first log in through Keplr using the Connect menu.
If you point to the frequency of the restake in each validator, you can see the frequency of the validator's restake and the minimum income requirement (only when your income is greater than the set value will the verifier perform the restake)
If the validator you entrusted supports REStake, the REStake column will turn into a green REStake button. After clicking, you can adjust the parameters of REStake.
In fact, there is nothing that needs to be set, that is, the upper limit of each delegation is like this. Although we are all using the default is not limited. After setting, click the Enable REStake button below to sign the authorization.
and then? There is no more, at most I don’t know when to come back and see how much the order has increased (laughs).
Validator sets REStake
If you want to enable REStake for your own validator, you can refer to the documentation of REStake , or learn from us (not).
The first thing to prepare is:
- A server with Docker and docker-compose.
- A new wallet address to store funds for REStake to pay transaction fees.
- Associate your own validator with a Keybase identity, which will be used later when you initiate a Pull Request in REStake's operator list warehouse. For LikeCoin, you can refer to the article we wrote when we first set up the validator , you may need to update the command.
Next, clone REStake's source code:
$ git clone https://github.com/eco-stake/restake.git cd retake cp.env.sample.env
Then edit the .env file and fill in the mnemonic of your new wallet into the MNEMONIC field.
MNEMONIC=foo bar...
Then create or edit the networks.local.json file in the src/ directory and add your validator information. Because we currently only have LikeCoin verifiers, let's take this as an example. For other chains, please refer to src/networks.json in the source code.
{ "likecoin": { # The name displayed on the REStake website. "prettyName": "LikeCoin", # REST API access point. # If you are running REStake on the server that also has your validator node enabled with the REST API. # This can be set to http://localhost:1317. "restUrl": [ "https://likecoin-rest.yoitsu.xyz" ], # RPC API access point. # If you also have your validator node on the server you are running REStake on. # This can be set to http://localhost:26657. "rpcUrl": [ "https://likecoin-status.yoitsu.xyz" ], # Set the same gas price as your validator node. "gasPrice": "2000nanolike", # The operator address of your validator, likevaloper that "ownerAddress": "likevaloper1r4sv5ea8mhd7q2cp566sh5zvkwg8xf3xwgw6uw" } }
After setting, you can run the following command to test it.
# Since we only have validators for LikeCoin, we use the last parameter to skip other chains. $ /usr/bin/docker-compose run --rm app npm run autostake likecoin > retake@0.1.0 autostake > NODE_OPTIONS=--openssl-legacy-provider node scripts/autostake.mjs "likecoin" [12:14:19.513] [12:14:22.422] Starting LikeCoin [12:14:22.574] Bot address is like13zq4c45h5z7zf8mnu8z9nqu9pdqe29u0jgk7d3 [12:14:22.806] Using REST URL https://likecoin-rest.yoitsu.xyz [12:14:22.807] Running autostake [12:14:23.004] Bot balance is 46469956000 nanolike [12:14:23.005] Finding delegators... [12:14:23.449] ...batch 1 [12:14:23.451] Checking 22 delegators for grants... [12:14:23.640] like1lqrvv08ygtd4q2rvrst30ww4uqfgzpl3rx68zu Not autostaking for this validator, skipping [12:14:23.640] ...batch 1 [12:14:23.641] Found 4 delegators with valid grants... [12:14:23.641] Calculating and autostaking in batches of 50 [12:14:23.919] like1c3fgu63q782jmxmdvcy8qkggqw2r3hzffgf3ru 1515066593 nanolike reward is too low, skipping [12:14:23.928] like1jf7u589sr24ae47stkfl93t5xkjut3sr0usckv 986739626 nanolike reward is too low, skipping [12:14:23.935] like1n4mugxw9wu4g0d257p4ss7l35wfa8a4003mrg5 193129283 nanolike reward is too low, skipping [12:14:24.054] like1erg2phzhumvgsynzk0553w772ldgv48ylp3gf4 1306399824 nanolike reward is too low, skipping [12:14:24.054] LikeCoin summary: [12:14:24.054] LikeCoin finished: Sent 0/0 messages
If you want to set the timing to run, you can use crontab or systemd-timer. We use this because we are familiar with the latter. You can refer to the unit files and timers below.
# /etc/systemd/system/restake.service [Unit] Description=stakebot service with docker compose Requires=docker.service After=docker.service Wants=restake.timer [Service] Type=oneshot # Change to your ReStake directory here. WorkingDirectory=/path/to/restake ExecStart=/usr/bin/docker-compose run --rm app npm run autostake [Install] WantedBy=multi-user.target # /etc/systemd/system/restake.timer [Unit] Description=Restake bot timer [Timer] AccuracySec=1min # Replace here with the running interval you plan, such as the one hour we set. OnCalendar=*-*-* *:00:00 [Install] WantedBy=timers.target
Submit enabled validators to REStake
If the test is OK, you can submit your own validator to REStake's validator list repository.
Fork thehttps://github.com/eco-stake/validator-registry repository, create a new directory with the name of your own validator, and then add the following two files. You can also refer to how the validators already in the warehouse are written (laughs).
# chains.json { "$schema": "../chains.schema.json", # Validator's name. "name": "Yoitsu", # The various chains that the validator operates on. "chains": [ { "name": "likecoin", # Your validator's operator address. "address": "likevaloper1r4sv5ea8mhd7q2cp566sh5zvkwg8xf3xwgw6uw", "restake": { # The address of the wallet where you pay the gas fee generated by REStake. "address": "like13zq4c45h5z7zf8mnu8z9nqu9pdqe29u0jgk7d3", # How often do you run REStake? "run_time": "every 1 hour", # What is the minimum income you need to make a REStake? # Here is the minimum unit of each coin, such as LikeCoin, it is nanolike. "minimum_reward": 5000000000 } } ] } # profile.json { "$schema": "../profile.schema.json", "name": "Yoitsu", # The PGP public key fingerprint of the Keybase identity associated with your verifier, short. "identity": "B6CF41D1879E8002" }
Then submit a Pull Request. If there is no problem, your validator will be marked as a validator that supports REStake on REStake.
Like my work? Don't forget to support and clap, let me know that you are with me on the road of creation. Keep this enthusiasm together!
- Author
- More