DEV Community

Cover image for Auto-compound using restake.app
kelpr.eth🦉
kelpr.eth🦉

Posted on • Updated on

Auto-compound using restake.app

If you are here because you have ledger but can't make it work with restake.app then you are at the right place.

Before we begin there are some points we need to have in place.

Pre-requisites

  • Ledger with cosmos app installed
  • Computer running Mac OS Monterey 12.4
  • go installed. If you need look here
  • Xcode. Yes Xcode 😱. Check this thread after you install it.
  • basic bash scripting
  • 💎 hands

A bit of background

Mac OS 12.4 or lower introduced a lot of breaking changes and hence the current binary for different cosmos chains when compiled from source code could face some issues.

You might see following deprecation notices when you tried the make install command in your earlier attempts to get restake work with ledger.

cgo-gcc-prolog: 81:11: warning:
"SecKeychainCreate' is deprecated: first deprecated in macOS 12.0
Custom keychain management is no longer supported [-Wdeprecated-declarations]
Enter fullscreen mode Exit fullscreen mode

Luckily the newer versions of dependencies are available which could help overcome these issues and we can auto-compound our staking rewards 🎉 while still using ledger.

Getting there

All the steps are the same for the chains I have tested for including Bitsong, Cerberus, Cheqd, Juno, LUM, MEME, Osmosis, Stargaze except for CRO which is depends on how you are staking. More on that later.

We will refer to the steps outlined by on restake.app for ledger. Kudos to them to put up everything upfront 🙌.

Let's take example of Osmosis. Here is the screenshot for reference taken from here

Osmosis Eco Stake Validator

  1. As seen in the screenshot we have to git clone and then cd into the folder.
  2. Before we run make install we need to modify the go.mod file with latest versions of dependency for go-keychain and zondax/hid. You can find the go.mod file in the restake_osmosis folder.
  3. Once you open the file scroll to the bottom and add these files in the replace section block.
github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4
github.com/zondax/hid => github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266
Enter fullscreen mode Exit fullscreen mode

Then go to terminal and run make install again. You might have to get the newer dependencies using go. Just run the commands which are prompted by go's helpful cli.
helpful tips from go cli

If everything works well you should see the osmosisd binary generated under ~/go/bin/ folder.

Then you can continue to follow the next steps which are Add Ledger as a key and Grant permission to delegate rewards from the same link mentioned above for Osmosis.

Just follow the cli instructions as and when they are prompted.

Success!! You are now auto-compounding your rewards in this bear market while cosmos continues to buidl 💪.

A big thank you ❤️ to EcoStake for bringing this innovative idea to cosmos.

The curious case of CRO staking

As you might know there are couple of ways to stake CRO and we have to interact with two different ledger apps depending on how we are staking.

For this guide, I'm assuming that you are staking using Keplr + ledger. In this case we would need to modify the command to Add Ledger as key to include --coin-type 118 when adding keys as part of the second step. For example,

main-chaind keys add ledger --ledger --keyring-backend file --coin-type 118
Enter fullscreen mode Exit fullscreen mode

Secret Network

For secret network we can use the pre-compile binary which already works with ledger.

  • Download the release v1.3.1 from here
  • Referring to the steps outlined for StakeLab validator you can skip the git clone and make install steps and work directly with binary downloaded in step 1.
  • cd into the folder where binary was downloaded. You might have to give chmod permission to make binary executable.
chmod +x secretcli
Enter fullscreen mode Exit fullscreen mode
  • Moving forward you will have to use ./secretcli command to interact further.
  • Referring to Add Ledger as a key step you have add extra argument to the existing command. Something like this
./secretcli keys add ledger --ledger --keyring-backend file --legacy-hd-path
Enter fullscreen mode Exit fullscreen mode
  • Once the above step is executed successfully move to the last step to grant permission to delegate rewards.
./secretcli tx authz grant secret18zzklau04kf3qtwrnnzlf20xrxpx3a89dqu42m generic --msg-type /cosmos.staking.v1beta1.MsgDelegate --from ledger --ledger --chain-id secret-4 --node https://rpc.cosmos.directory:443/secretnetwork --keyring-backend file --gas auto --gas-prices 0.025uscrt --gas-adjustment 1.5
Enter fullscreen mode Exit fullscreen mode

AssetMantle

After you clone the repo for assetMantle node here. Make sure to checkout the following commit

git checkout 5b2b0dcb37b107b0e0c1eaf9e907aa9f1a1992d9
Enter fullscreen mode Exit fullscreen mode

Rest of the steps are similar to the one in Getting there section.

FAQs

What will happen if I lose the keyring file generated when adding my keys?
You can just recreate it from your ledger. The important thing is to keep your seed words safe.

What will happen if I re-delegate to another validator?
Validators will only restake for you if you have a delegation with them. If you redelegate all funds, they’ll stop restaking. You can then remove the grants manually from the restake UI.

Should I be worried about my private key being exposed via any means when using the above approach?
No your private key stays on your ledger and is never exposed to your computer.

Top comments (0)