Liquid staking module specifications

Our milkINIT implementation is based on the work that the Stride team has put together inside their StakeIBC module. All we have done is simply forking their code and updating it to be compatible with Initia, the Layer 1 chain on top of which our optimistic rollup (MilkyWay) runs.

In this page you can find a list of messages and commands that can be used in order to liquid stake some INIT tokens and run some useful operations with the minted milkINIT tokens.

Transferring your tokens from Initia to MilkyWay

Before liquid staking your tokens, you need to transfer the INIT tokens you want to liquid stake from the Inita chain to the MilkyWay chain. To do this, you can use the IBC Transfer module present inside both Initia and MilkyWay chain.

To transfer some amount of INIT tokens from Initia to MilkyWay, you can use the following message:

{
  "@type": "/ibc.applications.transfer.v1.MsgTransfer",
  "source_port": "transfer",
  "source_channel": "<Channel ID on the Initia testnet>",
  "token": {
    "denom": "uinit",
    "amount": "<Amount of tokens to be transferred>"
  },
  "sender": "<Initia address of the user sending the tokens>",
  "receiver": "<MilkyWay address of the user receiving the tokens>",
  "timeout_height": {
    "revision_number": "<Revision number>",
    "revision_height": "<Revision height>"
  },
  "timeout_timestamp": "<Timeout timestamp>",
  "memo": ""
}

Please note that the amount of tokens to be transferred is represented in uinit. This means that if you want to transfer 1 INIT token, you need to specify 1000000 (1 INIT = 1,000,000 uinit).

To know about the source channel to use, please refer to this page.

To know more about the timeout_height and timeout_timestamp fields, please refer the IBC Transfer module specifications.

Liquid staking INIT tokens

To liquid stake your INIT tokens, you first have to transfer such tokens from the Initia chain to the MilkyWay chain where the StakeIBC module is present. To do this, you can reference this section, which highlights the message and command you can use.

Once you have transferred your tokens from the Initia chain to the MilkyWay chain using IBC, you can use the following message to liquid stake those tokens:

{
  "@type": "/stride.stakeibc.MsgLiquidStake",
  "creator": "<Address of the user>",
  "amount": "<Amount of uinit to be liquid staked (e.g. 1000000)>",
  "host_denom": "uinit"
}

Please note that the amount of tokens to be liquid staked must be in terms of uinit. This means that if you want to liquid stake 1 INIT, you will have to specify 1000000 as the amount value.

You can create, sign and send a transaction with such message using the following command:

milkywayd tx stakeibc liquid-stake <amount> uinit --from <your_key>

To know about the node address and chain id required to run this command, please reference this page.

Liquid unstaking (redeeming) milkINIT tokens

If you want to liquid unstake some milkINIT tokens and receive back the associated INIT tokens, you can use the following message:

{
  "@type": "/stride.stakeibc.MsgRedeemStake",
  "creator": "<MilkyWay address of the user redeeming their milkINIT tokens>",
  "amount": "<Amount of milkuinit to redeem>",
  "host_zone": "<ID of the Initia chain zone>",
  "receiver": "<Initia address of the user that will receive the unstaked INIT tokens>"
}

Please note that the amount of tokens to be liquid unstaked needs to be provided as milkuinit. This means that if you want to redeem 1 milkINIT, you will need to specify 1000000 as the amount (1 milkINIT = 1,000,000 milkuinit).

If you want to know more about the id of Initia chains that you can use, please refer to this page.

ℹī¸ Note

Differently from the liquid staking operation, where the user receives the milkINIT tokens as soon as they liquid stake some INIT tokens, the liquid staking operation requires some time before the user can receive the unstaked INIT tokens back after unstaking their milkINIT tokens. This because since the underlying tokens are staked on the Initia chain, they will need to wait the unbonding period to be over before those tokens are automatically sent to them. You can view the unbonding time of each Initia chain here.

Transferring milkINIT tokens from MilkyWay to another Minitia

If you want to transfer some milkINIT tokens from the MilkyWay chain to another Minitia, we suggest you doing so using the IBC Transfer module, and in particular by using the packet forward milldeware. Since all Minitias are connected to the Initia chain, you can take advantage of this by avoiding to setup a channel directly between the MilkyWay chain and your Minitia. Instead, using such middleware, the tokens will be routed to your chain passing by the Initia chain itself, decreasing the number of channels that need to be opened and maintained.

To transfer the milkINIT tokens to your chain, you can use the following message:

{
  "@type": "/ibc.applications.transfer.v1.MsgTransfer",
  "source_port": "transfer",
  "source_channel": "<MilkyWay to Initia Channel ID>",
  "token": {
    "denom": "milkuinit",
    "amount": "<Amount of milkuinit to be transferred>"
  },
  "sender": "<MilkyWay address of the user sending the tokens>",
  "receiver": "<Address of the user receiving the tokens>",
  "timeout_height": {
    "revision_number": "<Revision number>",
    "revision_height": "<Revision height>"
  },
  "timeout_timestamp": "<Timeout timestamp>",
  "memo": "{\"forward\": {\"receiver\": \"<Address of the recipient on your Minitia>\", \"port\": \"transfer\", \"channel\": \"<Transfer channel from Initia to your Minitia>\"}}"
}

Please note that the amount of tokens to be transferred is represented in milkuinit. This means that if you want to transfer 1 milkINIT token, you need to specify 1000000 (1 milkINIT = 1,000,000 milkuinit).

To know about the source channel to use, please refer to this page.

To know more about the timeout_height and timeout_timestamp fields, please refer the IBC Transfer module specifications.

Make sure you understand the meaning of the memo field, and how it can be used to leverage the packet forwarding middleware properly.

Last updated