rns-domain-manager
v0.1.1
Published
CLI tool to manage RNS (.rsk) domains on Rootstock blockchain
Maintainers
Readme
RNS Domain Manager (CLI)
A TypeScript CLI tool to manage RNS (.rsk) domains on the Rootstock blockchain. Register, transfer, and manage your blockchain domain names directly from your terminal.
📦 Install
npm install -g rns-domain-manager🚀 Quick Usage
# Check domain availability
rsk rns:register mydomain --owner 0xYourAddress --network testnet --dry-run
# Register a domain
rsk rns:register mydomain --owner 0xYourAddress --network testnet🌐 What is RNS?
RNS (Rootstock Name Service) is the official decentralized domain name system for the RSK blockchain, similar to ENS on Ethereum. It allows you to register human-readable .rsk domains instead of using long wallet addresses.
✨ Features
- Domain Registration: Register new
.rskdomains with commit-reveal process - Domain Transfer: Transfer ownership of existing domains
- Availability Check: Check if domains are available before registration
- Price Calculation: See registration costs in RIF tokens
- Multi-Network: Support for both RSK Testnet and Mainnet
- JSON Output: Machine-readable output for scripting
- Dry Run: Test commands without executing transactions
🚀 Quick Start
1. Installation
Global Installation (Recommended)
# Install globally from NPM
npm install -g rns-domain-manager
# Use directly from anywhere
rsk --helpOne-line Installation & Usage
# Install and use in one command (without global installation)
npx rns-domain-manager --help
# Register a domain directly
npx rns-domain-manager rns:register mydomain --owner 0xYourAddress --network testnet --dry-runLocal Development (For Contributors)
# Clone the repository
git clone https://github.com/yourusername/rns-domain-manager.git
cd rns-domain-manager
# Install dependencies
npm install
# Build the project
npm run build
# Use locally
node dist/index.js --help2. Configuration
# Copy environment template
cp .env.example .env
# Edit .env with your settingsRequired .env settings:
# Your private key (with 0x prefix)
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
# RPC endpoints
RPC_URL_TESTNET=https://public-node.testnet.rsk.co
RPC_URL_MAINNET=https://public-node.rsk.co3. Test the CLI
# Check help
rsk --help
# Test domain availability (dry run)
rsk rns:register mydomain --owner 0xYourAddress --network testnet --dry-run📋 Commands
Register Domain
Register a new .rsk domain:
rsk rns:register <label> --owner <address> [options]Options:
--owner <address>- Owner address (required)--years <n>- Registration duration in years (default: 1)--network <net>- Network: testnet or mainnet (default: testnet)--dry-run- Check availability and price without registering--json- Output in JSON format
Examples:
# Check availability and price
rsk rns:register mydomain --owner 0xCdC20B8B31f4AD4a996D1425aDF7f786BB94b0c3 --network testnet --dry-run
# Register for 1 year
rsk rns:register mydomain --owner 0xCdC20B8B31f4AD4a996D1425aDF7f786BB94b0c3 --network testnet
# Register for 2 years with JSON output
rsk rns:register mydomain --owner 0xCdC20B8B31f4AD4a996D1425aDF7f786BB94b0c3 --network testnet --years 2 --jsonTransfer Domain
Transfer ownership of an existing domain:
rsk rns:transfer <domain> --to <address> [options]Options:
--to <address>- Recipient address (required)--network <net>- Network: testnet or mainnet (default: testnet)--json- Output in JSON format
Examples:
# Transfer domain
rsk rns:transfer mydomain.rsk --to 0xNewOwnerAddress --network testnet
# Transfer with JSON output
rsk rns:transfer mydomain.rsk --to 0xNewOwnerAddress --network testnet --json🌐 Networks
Testnet (Default)
- Chain ID: 31
- Purpose: Testing and development
- Tokens: tRBTC (gas) + tRIF (registration)
- Cost: 2 tRIF per year
- Explorer: https://explorer.testnet.rsk.co
Mainnet
- Chain ID: 30
- Purpose: Production use
- Tokens: RBTC (gas) + RIF (registration)
- Cost: 2 RIF per year
- Explorer: https://explorer.rsk.co
💰 Token Requirements
Testnet
- tRBTC: For gas fees (small amount needed)
- tRIF: 2 tokens per year of registration
Mainnet
- RBTC: For gas fees (small amount needed)
- RIF: 2 tokens per year of registration
Getting Testnet Tokens:
- tRBTC: RSK Testnet faucets
- tRIF: RSK Testnet faucets or testnet DEXs
🔧 Contract Addresses
Testnet Contracts
- Registry:
0x7d284aaac6e925aad802a53c0c69efe3764597b8 - RIF Token:
0x19f64674d8a5b4e652319f5e239efd3bc969a1fe - RSK Owner:
0xca0a477e19bac7e0e172ccfd2e3c28a7200bdb71 - FIFS Registrar:
0x90734bd6bf96250a7b262e2bc34284b0d47c1e8d
Mainnet Contracts
- Registry:
0xcb868aeabd31e2b66f74e9a55cf064abb31a4ad5 - RIF Token:
0x2acc95758f8b5f583470ba265eb685a8f45fc9d5 - RSK Owner:
0x45d3e4fb311982a06ba52359d44cb4f5980e0ef1 - FIFS Registrar:
0xd9c79ced86ecf49f5e4a973594634c83197c35ab
📖 Usage Examples
Complete Registration Flow
# 1. Check if domain is available
rsk rns:register myawesome --owner 0xYourAddress --network testnet --dry-run
# Output: {"domain": "myawesome.rsk", "available": true, "years": 1, "priceWei": "2000000000000000000"}
# 2. Register the domain
rsk rns:register myawesome --owner 0xYourAddress --network testnet
# Output: {"domain": "myawesome.rsk", "network": "testnet", "chainId": 31, "commitTxHash": "...", "registerTxHash": "..."}Check Your Balance
# Check your wallet balances (example script)
node -e "
const { ethers } = require('ethers');
const provider = new ethers.providers.JsonRpcProvider('https://public-node.testnet.rsk.co', 31);
const wallet = new ethers.Wallet('YOUR_PRIVATE_KEY', provider);
async function checkBalance() {
const tRBTCBalance = await wallet.getBalance();
console.log('tRBTC:', ethers.utils.formatEther(tRBTCBalance));
const rifContract = new ethers.Contract('0x19f64674d8a5b4e652319f5e239efd3bc969a1fe',
['function balanceOf(address) view returns (uint256)'], provider);
const rifBalance = await rifContract.balanceOf(wallet.address);
console.log('tRIF:', ethers.utils.formatEther(rifBalance));
}
checkBalance();
"🔍 Troubleshooting
Common Issues
1. "PRIVATE_KEY not set in .env"
- Ensure your private key starts with
0x - Check the
.envfile exists and is readable
2. "Missing RPC URL"
- Add the appropriate RPC URL to your
.envfile - Testnet:
https://public-node.testnet.rsk.co - Mainnet:
https://public-node.rsk.co
3. "Transaction may fail or may require manual gas limit"
- Usually means insufficient RIF tokens for registration
- Check your token balance (need 2 RIF per year)
4. "bad address checksum"
- Ensure addresses are properly checksummed
- Use tools like ethers.js to get correct checksum
Getting Help
# General help
rsk --help
# Command-specific help
rsk rns:register --help
rsk rns:transfer --help🛠️ Development
Project Structure
src/
├── index.ts # CLI entry point
├── config.ts # Network configuration
├── types.ts # TypeScript definitions
├── lib/
│ ├── rns.ts # RNS SDK wrapper
│ └── ui.ts # Output utilities
└── commands/
└── rns/
├── register.ts # Registration command
└── transfer.ts # Transfer commandBuild & Run
# Development mode
npm run dev
# Build for production
npm run build
# Lint code
npm run lint📦 NPM Package
This CLI is available as an NPM package for easy installation:
- Package: rns-domain-manager
- Install:
npm install -g rns-domain-manager - Usage:
rsk --help
Package Stats
- Size: ~8KB (lightweight)
- Dependencies: Minimal and secure
- Compatibility: Node.js 14+
📄 License
MIT
🤝 Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
🎯 Support
- Issues: GitHub Issues
- NPM: Package Page
Happy domain registering! 🎉
