Stakebot is a server written in Golang for automated multi-chain staking, specifically claiming and delegating on Cosmos SDK chains. For the client implementations look at the autostaker.
Stakebot leverages the authz
and feegrant
modules. User accounts must grant the stakebot account access to MsgDelegate
and MsgWithdrawDelegatorReward
messages. This service does not include such functionality and must be done prior either via CLI or through a UI.
The server deploys cron jobs which iteratively claim the accounts rewards, then by calculating transaction fees, delegates the available balance of native tokens to the accounts validators, maintaing parity with the percentage delegated. It delegates with a safety margin known as tolerance
so that future transactions have sufficient funds. The stakebot has defaults per chain for frequency
and tolerance
but the frequency this can be adjusted to one of following:
hourly
quarterday
daily
weekly
monthly
- Clone the repo
git clone https://github.com/plural-labs/stakebot
. - Install the
stakebot
:go install
from the root directory. - Run
stakebot init
to create a set of keys and and the default config. - Move into the directory
cd ~/.stakebot
and edit the configvim config.toml
, adding chain details for the chains you want to support. - Run
stakebot serve
to begin the server. You will see some logs on start up.
A few extra utility commands:
stakebot address
returns the address of the serverstakebot find <address>
can be used to get info on a particular address stakebot is serving.
To set up autostaking via the REST server:
- Get the address of the stakebot by calling
/v1/address?id=<chain_id>
. - Manually grant the address the authority to call the two aforementioned msg types as well as a feegrant.
- After granting access to perform the messages and cover the fees, register your account as
/v1/register?address=<account>&frequeny=<frequency>&tolerance=<tolerance>
i.e./v1/register?address=cosmos1vhpsuaxg51gvvzwyhqejvwfved5ywa3n6vl4ld
. This automatically enables autostaking so long as the chain, in this casecosmoshub-4
is supported. If you don't add afrequency
ortolerance
, reasonable defaults will be chosen from the server settings. - If you want to manually trigger a restake you can also run:
/v1/restake?address=<address>
.
Alternatively, checkout the autostaker CLI and frontend
/v1/register?address=<account>
: Registers an account to the stakebot's KV store. Returns an error if the account does not exist or the stakebot doesn't support that chain./v1/restake?address=<account>
: Manu/v1/status?address=<account>
: Displays the status of that account/v1/chains
: Returns all chains that the stakebot server supports/v1/chain?id=<chain_id>
: Returns information on the specified chain if the stakebot server supports it./address/<chain_id>
: Returns the stakebot's address for a specific chain_id. Returns an error if the chain is not supported.