A command-line interface (CLI) tool written in Go for interacting with the Rootstock blockchain.
This tool provides comprehensive functionality to connect to an Ethereum-compatible RPC endpoint and manage wallets, query balances, send transactions, and interact with the Rootstock network.
- Create Wallet: Generate new wallets with password protection
- Import Wallet: Import existing wallets using private keys
- List Wallets: View all available wallets with optional names
- Export Wallet: Export wallet private key to the console
- Check Balance: Query RBTC balance for any wallet address
- Send Transactions: Transfer RBTC between wallets with configurable gas settings
- Password Protection: All wallets are encrypted with user-defined passwords
- Secure Keystore: Wallets are stored in encrypted keystore files
- Private Key Management: Secure handling of private keys with optional display
- Go 1.24.4 or higher
- Access to an Rootstock RPC endpoint
- Clone the repository:
git clone https://github.com/rsksmart/rsk-go-cli.git
cd rsk-go-cli- Build the application:
make buildOr build manually:
go build -o rsk-go-cli main.go- Make the binary executable:
chmod +x rsk-go-cliYou can also run the application directly without building:
go run main.goCreate a .env file in the project root with the following variables:
# RSK RPC endpoint (required)
RPC_URL=https://public-node.testnet.rsk.coYou can use different Rootstock RPC endpoints:
- Mainnet:
https://public-node.rsk.co - Testnet:
https://public-node.testnet.rsk.co
# RSK Testnet
RPC_URL=https://public-node.testnet.rsk.co
# Or for Mainnet
# RPC_URL=https://public-node.rsk.co# Show help
./rsk-go-cli --help
# Show wallet commands
./rsk-go-cli wallet --help./rsk-go-cli wallet createCreate with private key display:
./rsk-go-cli wallet create --show-private-key./rsk-go-cli wallet importThe command will prompt you to securely enter your private key. The input will not be displayed on screen for security.
./rsk-go-cli wallet export -j --name "My Wallet"./rsk-go-cli wallet export -j --address 0xWALLET_ADDRESS./rsk-go-cli wallet list# By address
./rsk-go-cli wallet balance --address 0xWALLET_ADDRESS
# By wallet name
./rsk-go-cli wallet balance --name "My Wallet"# Basic transfer
./rsk-go-cli transfer --from-address 0xFROM_ADDRESS --to-address 0xTO_ADDRESS --amount 0.1
# Transfer with custom gas settings
./rsk-go-cli transfer --from-address 0xFROM_ADDRESS --to-address 0xTO_ADDRESS --amount 0.1 --gas-limit 50000 --gas-price 0.001
# Transfer using wallet names
./rsk-go-cli transfer --from-name "My Wallet" --to-address 0xTO_ADDRESS --amount 0.1
# Transfer with automatic gas price (recommended)
./rsk-go-cli transfer --from-address 0xFROM_ADDRESS --to-address 0xTO_ADDRESS --amount 0.1--from-addressor-f: Source wallet address--from-nameor-n: Source wallet name--to-addressor-t: Destination wallet address--to-nameor-m: Destination wallet name--amount: Amount to send in RBTC (required)--gas-limitor-g: Gas limit (default: 21000 for simple transfers)--gas-price: Gas price in Gwei (optional, automatically uses network-suggested price if not specified). Gas price must be between 0.0001 and 0.1 Gwei.
--addressor-a: Wallet address to check--nameor-n: Wallet name to check
go test ./...make lintThe CLI provides intelligent gas handling for transactions:
- Default: 21,000 gas units (standard for simple RBTC transfers)
- Custom: Set your own gas limit using
--gas-limitflag - When to adjust: Increase for complex transactions, smart contract interactions, or when you need more computational resources
- Automatic (Recommended): When
--gas-priceis not specified, the CLI automatically fetches the network's suggested gas price usingeth_gasPrice - Manual: Set your own gas price in Gwei using
--gas-priceflag - Network Optimization: Automatic gas pricing ensures your transactions are processed efficiently without overpaying
- Real-time Estimation: Shows estimated gas cost in RBTC before transaction execution
- Total Cost Display: Displays the complete transaction cost (transfer amount + gas fees)
- Balance Validation: Automatically checks if you have sufficient balance to cover both the transfer amount and gas fees
# Let the network decide gas price (recommended for most users)
./rsk-go-cli wallet transfer --from-address 0x... --to-address 0x... --amount 0.1
# Set custom gas price (advanced users who want to control transaction priority)
./rsk-go-cli wallet transfer --from-address 0x... --to-address 0x... --amount 0.1 --gas-price 0.001
# Set custom gas limit for complex transactions
./rsk-go-cli wallet transfer --from-address 0x... --to-address 0x... --amount 0.1 --gas-limit 22000- Password Security: Use strong, unique passwords for your wallets
- Private Key Safety: Never share your private keys or keystore files
- Network Security: Ensure you're connecting to legitimate Rootstock RPC endpoints
- File Permissions: The application creates a
.rsk-go-clidirectory in your home folder with restricted permissions
- RPC_URL not set: Ensure your
.envfile contains theRPC_URLvariable - Connection errors: Verify your RPC endpoint is accessible and correct
- Permission errors: Check that the application has write permissions to your home directory
- Wallet not found: Ensure the wallet address or name is correct
- Gas estimation failures: If automatic gas pricing fails, try specifying
--gas-pricemanually
- Check the help command:
./rsk-go-cli --help - Review command-specific help:
./rsk-go-cli wallet --help - Ensure your
.envfile is properly configured
We welcome contributions from the community. Please fork the repository and submit pull requests with your changes. Ensure your code adheres to the project's main objective.
For any questions or support, please open an issue on the repository or reach out to the maintainers.
The software provided in this GitHub repository is offered "as is," without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement.
- Testing: The software has not undergone testing of any kind, and its functionality, accuracy, reliability, and suitability for any purpose are not guaranteed.
- Use at Your Own Risk: The user assumes all risks associated with the use of this software. The author(s) of this software shall not be held liable for any damages, including but not limited to direct, indirect, incidental, special, consequential, or punitive damages arising out of the use of or inability to use this software, even if advised of the possibility of such damages.
- No Liability: The author(s) of this software are not liable for any loss or damage, including without limitation, any loss of profits, business interruption, loss of information or data, or other pecuniary loss arising out of the use of or inability to use this software.
- Sole Responsibility: The user acknowledges that they are solely responsible for the outcome of the use of this software, including any decisions made or actions taken based on the software's output or functionality.
- No Endorsement: Mention of any specific product, service, or organization does not constitute or imply endorsement by the author(s) of this software.
- Modification and Distribution: This software may be modified and distributed under the terms of the license provided with the software. By modifying or distributing this software, you agree to be bound by the terms of the license.
- Assumption of Risk: By using this software, the user acknowledges and agrees that they have read, understood, and accepted the terms of this disclaimer and assumes all risks associated with the use of this software.
