Overview of Rootstock-CLI
The rsk-cli
tool enables users to manage wallets, check balances, send transactions, verify smart contracts, and interact with smart contracts on the Rootstock blockchain—a Bitcoin sidechain designed for smart contracts.
It supports both mainnet and testnet environments. Additionally, the tool provides bridge interaction features, allowing users to seamlessly transfer assets between Rootstock and Bitcoin (or other supported blockchains) via integrated bridge protocols.
The Rootstock-CLI (Command Line Interface) allows you to interact with your Rootstock wallet directly from the terminal, giving you control over creating, managing, and funding your wallet with RBTC (Smart Bitcoin).
In this guide, we will explore how to use the Rootstock-CLI to create a wallet, manage it securely, and add funds to it.
Key Features​
The wallet command lets you manage Ethereum-compatible wallets on Rootstock. You can:
- Create, import, or use an existing wallet.
- List saved wallets, switch wallets, update wallet names, and delete wallets.
- Wallets are securely encrypted with AES-256-CBC, and private keys are stored in a JSON file.
Use the balance
command to view your wallet's current balance on the Rootstock blockchain.
This is supported on both mainnet and testnet.
The transfer
command enables sending RBTC to another address.
Transactions can be initiated on both mainnet and testnet.
View the status of a transaction using the tx
command by providing the transaction ID.
The deploy
command allows users to deploy smart contracts on the blockchain by providing the ABI Application Binary Interface and bytecode files.
This is supported on both mainnet and testnet.
With the verify
command, users can verify deployed smart contracts using Rootstock’s explorer API.
It supports both mainnet and testnet.
The contract
command lets users interact with read-only functions of a verified smart contract, listing the available methods for interaction.
Prerequisites:​
Before using rsk-cli, you need the following:
- Node.js: The tool is built using Node.js, so you need to have it installed. You can download it from the official Node.js website and npm (Node Package Manager) comes bundled with Node.js.
Verify the installation by running:
node -v
npm -v
Ensure to have v22.9.0 version of node and above for compatibility
- Access to Rootstock Network: Ensure to have access to Rootstock's mainnet or testnet. For testnet use, we’ll need testnet RBTC for experimentation, which can be requested from a testnet faucet.
Once these prerequisites are met, proceed to install and use rsk-cli.
Installation​
To install the tool, use Node.js's package manager npm:
npm i -g @rsksmart/rsk-cli
This installs the tool globally, allowing you to use the rsk-cli command in the terminal from any directory.
This flag tells rsk-cli
to operate on the Rootstock testnet rather than the mainnet. Rootstock has both a mainnet (for real transactions) and a testnet (for testing purposes). Using the testnet helps avoid spending actual tokens and allows for safe testing.