Skip to content

Instantly share code, notes, and snippets.

@jjangg96
Last active January 24, 2024 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jjangg96/5ebe57cd522d42bf5e045007cf0d299a to your computer and use it in GitHub Desktop.
Save jjangg96/5ebe57cd522d42bf5e045007cf0d299a to your computer and use it in GitHub Desktop.
REStake with Ledger

0base.vc REStake for Ledger

Bot address for chains that support Authz.

Chain Bot Address
agoric agoric1cwe4fgnmvdzx6kefxs8alldtwhywctnxt7mdr5
cerberus cerberus1jrjdqzxchlt09gj6qvn4ds8suxh9aqwyty62ml
cosmoshub cosmos1jrjdqzxchlt09gj6qvn4ds8suxh9aqwyhr6rw5
gravitybridge gravity1jrjdqzxchlt09gj6qvn4ds8suxh9aqwynngmtu
juno juno1jrjdqzxchlt09gj6qvn4ds8suxh9aqwyp3ecfg
osmosis osmo1jrjdqzxchlt09gj6qvn4ds8suxh9aqwylcfncx
regen regen1jrjdqzxchlt09gj6qvn4ds8suxh9aqwygp3lcs
rizon rizon1jrjdqzxchlt09gj6qvn4ds8suxh9aqwy57xjzv
stargaze stars1jrjdqzxchlt09gj6qvn4ds8suxh9aqwyrld799
terra terra1knhcrmhcm4d6apcj4vglelax7sz4fm8759s6mj
umee umee1jrjdqzxchlt09gj6qvn4ds8suxh9aqwy948u2x

Prerequisites

Process

  1. Delegate or Redelegate to 0base.vc with your Ledger (https://0base.dev)
  2. Install CLI
  3. Connect your ledger wallet into CLI
  4. Create a grant.json file for grant
  5. Sign grant.json using CLI and Create sign.json
  6. Broadcast sign.json using CLI and Your Ledger
  7. Check grant tx on mintscan

Example: JUNO

Install CLI

Check https://github.com/ovrclk/cosmos-omnibus/tree/master/juno You can install CLI with Repository and Version.

# Clone juno from Repository
$ git clone https://github.com/CosmosContracts/Juno juno
$ cd juno

# Checkout current working version
$ git checkout v2.1.0

# Compile it
$ make install

# Check CLI
$ junod version

Connect your ledger wallet into CLI

# Add ledger wallet into CLI
# myKey is a name of address
$ junod keys add myKey --ledger

# Check wallet
$ junod keys list

Create a grant.json file for grant

  • Granter : Your Ledger Juno address. (There are two addresses in total)
  • Grantee: 0base.vc bot address for a selected chain. (There are two addresses in total)
{
  "body": {
    "messages": [
      {
        "@type": "/cosmos.authz.v1beta1.MsgGrant",
        "granter": "(Your juno address)",
        "grantee": "(juno1jrjdqzxchlt09gj6qvn4ds8suxh9aqwyp3ecfg : Bot address of chain)",
        "grant": {
          "authorization": {
            "@type": "/cosmos.authz.v1beta1.GenericAuthorization",
            "msg": "/cosmos.staking.v1beta1.MsgDelegate"
          },
          "expiration": "2023-04-02T07:58:50Z"
        }
      },
      {
        "@type": "/cosmos.authz.v1beta1.MsgGrant",
        "granter": "(Your juno address)",
        "grantee": "(juno1jrjdqzxchlt09gj6qvn4ds8suxh9aqwyp3ecfg : Bot address of chain)",
        "grant": {
          "authorization": {
            "@type": "/cosmos.authz.v1beta1.GenericAuthorization",
            "msg": "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"
          },
          "expiration": "2023-04-02T07:41:02Z"
        }
      }
    ]
  },
  "auth_info": {
    "signer_infos": [],
    "fee": {
      "amount": [],
      "gas_limit": "200000",
      "payer": "",
      "granter": ""
    }
  },
  "signatures": []
}

Sign grant.json using CLI and Create sign.json

# Sign with your ledger and create sign.json
# Use your key that was created above
# Check node url
$ junod tx sign grant.json --keyring-backend file \
--chain-id juno-1 \
--from myKey \
--node https://rpc.cosmos.directory:443/juno \
--output-document sign.json

Broadcast sign.json using CLI and Your Ledger

# Broadcast sign.json to network.
# Check fees.
$ junod tx broadcast sign.json \
--chain-id juno-1 \
--node https://rpc.cosmos.directory:443/juno \
--fees 2000ujuno

Check grant tx on mintscan

If you want to use a different chain, simply replace juno with another chain.

That's it, 0base.vc REStake bot will run auto-compound every hour.

@mbolesta
Copy link

mbolesta commented Apr 5, 2022

this is cool. how do you revoke the grant later if you change your mind? and once it expires do you just repeat the process?

@jjangg96
Copy link
Author

jjangg96 commented Apr 5, 2022

this is cool. how do you revoke the grant later if you change your mind? and once it expires do you just repeat the process?

You can send a revoke transaction anytime. I will update the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment