Jito Restaking CLI
Overview
The Jito Restaking CLI is a command-line tool that provides access to Jito's Restaking protocol. This tool enables users to interact with the Jito Restaking protocol, allowing for vault management, operator delegation, and so on.
With this CLI, you can:
- NCN, Operator, Vault Operation
- Mint and burn VRT
- Monitor account statuses with JSON output support
- Preview transactions before sending them with the
print-txflag - Connect and sign transactions with Ledger hardware wallets
Features
JSON Output
The CLI supports JSON output for easier parsing and integration with other tools.
To enable JSON output, use --print-json flag with command like get, list.
This is especially useful for scripting and automation.
JSON Output Options:
--print-json: Outputs full account information in JSON format while automatically filtering out anyreservedfields--print-json-with-reserves: Outputs account information in JSON format withreservedfields
Example JSON output:
Example JSON output:
JSON output can be piped to tools like jq for further processing:
|
Transaction Inspection
You can preview transactions before sending them using the --print-tx flag.
Example output:
When using this flag, the transaction will not be processed - only printed for inspection. Note that instruction data shown in the output is base58 encoded, which provides a compact text representation of binary data.
Ledger Hardware Wallet Support
The CLI now supports integration with Ledger hardware wallets for enhanced security when signing transactions. This allows you to keep your private keys secure on your hardware device instead of storing them as local keypair files.
Using Ledger for Signing
You can specify a Ledger device as the signer by using the usb://ledger?key=0 in any command that accepts keypair arguments.
When you specify a Ledger path, the CLI will automatically connect to your Ledger device and prompt you to confirm the transaction on the device.
Set Admin
Using Ledger with Other Commands
You can use your Ledger device with any command that accepts a signer argument. The CLI will automatically handle the connection and signing process with your Ledger device.
Getting Started
This getting started guide will cover creating a vault, minting some VRT, delegating to an operator, updating the vault and withdrawing VRT.
Setup
Build and install the CLI
In the root of the repo:
Ensure it has been installed
Create a Vault
This is a Jito Test Vault, which uses JitoSOL as its supported token.
THIS IS FOR TESTING PURPOSES ONLY
Example Vault: jkHHVMhQefVuEiFKEyEZgcDZoXv8ZZyjUiK11e61oVY
Example VRT: 5rN9m6TkyPkzMGVpdmbRVYct1RKa7VssV1AwsHVPFaxJ
Example Operator: EN7drMzCkZqpuyMVW1QBu8Ciw4Se76KNxNvFZYhDnyUH
Initialize Vault
Creating a vault requires:
<RPC_URL>: RPC url<TOKEN_MINT>: The pubkey of the "supported token" mint<DEPOSIT_FEE_BPS>: Fee for minting VRT<WITHDRAWAL_FEE_BPS>: Fee for withdrawing ST<REWARD_FEE_BPS>: Fee taken when ST rewards are sent to the vault<DECIMALS>: Decimals of the newly created VRT. ( 9 is Recommended )<INITIALIZE_TOKEN_AMOUNT>: The amount of tokens to initialize the vault with ( in the smallest unit )<VRT_MINT_ADDRESS_FILE_PATH>: The file path of VRT mint address (Optional)
Note the resulting Vault Pubkey.
Create VRT Metadata
To create the metadata:
<RPC_URL>: RPC url<VAULT>: The vault Pubkey<NAME>: Name for VRT<SYMBOL>: Symbol for VRT<URI>: Metadata url
Update VRT Metadata
To update the metadata:
<RPC_URL>: RPC url<VAULT>: The vault Pubkey<NAME>: Name for VRT<SYMBOL>: Symbol for VRT<URI>: Metadata url
Update a Vault
It is the vault's responsibility to update it once per epoch. If a vault is not updated, no other actions can be taken. This is done by initializing a vault_update_state_tracker, cranking it and to finish the update, closing it.
Initialize Vault Update State Tracker
Starts the update process, this should be the first IX called at the start of an epoch.
<RPC_URL>: RPC url<VAULT>: The vault Pubkey
Crank Vault Update State Tracker
Needs to be called for each operator. If there are no operators, this IX can be skipped. Operators need to be called in order.
<RPC_URL>: RPC url<VAULT>: The vault Pubkey<OPERATOR>: The operator that is being updated
Close Vault Update State Tracker
<RPC_URL>: RPC url<VAULT>: The vault Pubkey[NCN_EPOCH]: Optional NCN Epoch, for closing older, still-open, vault update state trackers
Vault Functions
Mint VRT
<RPC_URL>: RPC url<VAULT>: The vault Pubkey<AMOUNT_IN>: In st tokens with no decimals ( lamports instead of SOL )<MIN_AMOUNT_OUT>: In vrt tokens with no decimals
Create and Delegate to Operator
Initialize an Operator
Note: This command will output the operator's public key.
<RPC_URL>: RPC url<OPERATOR_FEE_BPS>: On-chain operator fee used for external reward calculations
Initialize Operator Vault Ticket
This ticket is a the operator telling the vault that it's ready to receive delegation.
<RPC_URL>: RPC url<OPERATOR>: Pubkey of the operator<VAULT>: Pubkey of the vault
Warmup Operator Vault Ticket
To allow the operator to receive delegation.
<RPC_URL>: RPC url<OPERATOR>: Pubkey of the operator<VAULT>: Pubkey of the vault
Initialize Vault Operator Delegation
To complete the handshake, the vault has to allow delegation to the operator.
Note: vault comes first since this is a vault program ix
<RPC_URL>: RPC url<VAULT>: Pubkey of the vault<OPERATOR>: Pubkey of the operator
Delegate to Operator
<RPC_URL>: RPC url<VAULT>: The vault Pubkey<OPERATOR>: Pubkey of the operator<AMOUNT>: In st tokens with no decimals
Cooldown Delegation
Undelegating stake requires a cooldown of one epoch, so this IX starts the undelegation process. The funds will be undelegated during the update vault process.
<RPC_URL>: RPC url<VAULT>: The vault Pubkey<OPERATOR>: Pubkey of the operator<AMOUNT>: In st tokens with no decimals
Withdraw from Vault
Enqueue withdrawal
Withdrawing the supported mint from the vault, involves a full epoch cooldown period and then burning the equivalent VRT. To finish the withdrawal, call burn-withdrawal-ticket.
<RPC_URL>: RPC url<VAULT>: The vault Pubkey<AMOUNT>: To burn in VRT tokens with no decimals
Burn Withdrawal Ticket
Burn the withdrawal ticket after the cooldown period to complete the withdrawal.
<RPC_URL>: RPC url<VAULT>: The vault Pubkey