156 lines
3.9 KiB
Markdown
156 lines
3.9 KiB
Markdown
# RIN Wallet RPC Scripts
|
|
|
|
This directory contains scripts for interacting with the RIN cryptocurrency wallet via RPC.
|
|
|
|
## Prerequisites
|
|
|
|
- `curl` and `jq` must be installed on your system
|
|
- RIN wallet/node must be running with RPC enabled
|
|
- RPC credentials must be configured
|
|
|
|
## Scripts
|
|
|
|
### send_rin.sh
|
|
Send RIN to another wallet address.
|
|
|
|
```bash
|
|
./send_rin.sh <recipient_address> <amount> [rpc_user] [rpc_password] [rpc_host] [rpc_port]
|
|
```
|
|
|
|
**Example:**
|
|
```bash
|
|
./send_rin.sh rin1qm5qg07qh0fy3tgxc3ftfgq0fujgfgm4n6ggt5f 100.0
|
|
```
|
|
|
|
### check_balance.sh
|
|
Check wallet balance.
|
|
|
|
```bash
|
|
./check_balance.sh [account] [rpc_user] [rpc_password] [rpc_host] [rpc_port]
|
|
```
|
|
|
|
**Example:**
|
|
```bash
|
|
./check_balance.sh # Check all accounts
|
|
./check_balance.sh myaccount # Check specific account
|
|
```
|
|
|
|
### get_transaction.sh
|
|
Get details of a specific transaction.
|
|
|
|
```bash
|
|
./get_transaction.sh <transaction_id> [rpc_user] [rpc_password] [rpc_host] [rpc_port]
|
|
```
|
|
|
|
**Example:**
|
|
```bash
|
|
./get_transaction.sh a1b2c3d4e5f6...
|
|
```
|
|
|
|
### rpc_call.sh
|
|
General-purpose RPC call script for any RIN RPC method.
|
|
|
|
```bash
|
|
./rpc_call.sh <method> [param1] [param2] ... [rpc_user] [rpc_password] [rpc_host] [rpc_port]
|
|
```
|
|
|
|
**Examples:**
|
|
```bash
|
|
./rpc_call.sh getinfo
|
|
./rpc_call.sh getnewaddress myaccount
|
|
./rpc_call.sh listtransactions "*" 10
|
|
./rpc_call.sh validateaddress rin1qm5qg07qh0fy3tgxc3ftfgq0fujgfgm4n6ggt5f
|
|
./rpc_call.sh loadwallet
|
|
```
|
|
|
|
### list_wallets.sh
|
|
List all loaded wallets with balance, transaction count, and used addresses.
|
|
|
|
```bash
|
|
./list_wallets.sh
|
|
```
|
|
|
|
### load_wallet.sh
|
|
Load a specific wallet by name.
|
|
|
|
```bash
|
|
./load_wallet.sh main
|
|
./load_wallet.sh my-wall
|
|
```
|
|
|
|
### set_web_wallet.sh
|
|
Set which wallet the web interface should use.
|
|
|
|
```bash
|
|
./set_web_wallet.sh main
|
|
```
|
|
|
|
### find_address.sh
|
|
Check if an address belongs to any loaded wallet.
|
|
we need to see what is this address.
|
|
|
|
```bash
|
|
./find_address.sh rin1qvj0yyt9phvled9kxflju3p687a4s7kareglpk5
|
|
```
|
|
|
|
|
|
|
|
### dump_wallet.sh
|
|
Create a secure backup of all private keys in a wallet.
|
|
|
|
```bash
|
|
./dump_wallet.sh
|
|
```
|
|
|
|
### restore_wallet.sh
|
|
Restore a wallet from a backup dump file.
|
|
|
|
```bash
|
|
./restore_wallet.sh ~/rin_wallet_backups/rin_wallet_backup_20230923.txt
|
|
./restore_wallet.sh ~/rin_wallet_backups/rin_wallet_backup_20230923.txt my_restored_wallet
|
|
```
|
|
|
|
### restore_from_seed.sh
|
|
Restore a wallet from just the master private key.
|
|
|
|
```bash
|
|
# Auto-generate wallet name
|
|
./restore_from_seed.sh "xprv9s21ZrQH143K3bjynHVk6hBTZLmV9wjqWScL3UyENBYK6RaFo75zu5jnWQtBi932zKbD7c2WARWLJNjBbE3Td2Cc44ym3dmp343qKKFXwxS"
|
|
|
|
# Specify custom wallet name
|
|
./restore_from_seed.sh "xprv9s21ZrQH143K3bjynHVk6hBTZLmV9wjqWScL3UyENBYK6RaFo75zu5jnWQtBi932zKbD7c2WARWLJNjBbE3Td2Cc44ym3dmp343qKKFXwxS" my_restored_wallet
|
|
```
|
|
|
|
## Default RPC Configuration
|
|
|
|
- **Host:** localhost
|
|
- **Port:** 8332
|
|
- **User:** rinrpc
|
|
- **Password:** password
|
|
|
|
You can override these defaults by providing them as the last arguments to any script.
|
|
|
|
## Common RPC Methods
|
|
|
|
- `getbalance [account]` - Get account balance
|
|
- `getinfo` - Get wallet info
|
|
- `getnewaddress [account]` - Generate new address
|
|
- `sendtoaddress <address> <amount>` - Send coins
|
|
- `listtransactions [account] [count]` - List transactions
|
|
- `gettransaction <txid>` - Get transaction details
|
|
- `validateaddress <address>` - Validate address
|
|
- `getaddressesbyaccount [account]` - Get addresses for account
|
|
|
|
## Security Notes
|
|
|
|
- These scripts send credentials in plain text (HTTP Basic Auth)
|
|
- Consider using HTTPS or local connections only
|
|
- Update default RPC credentials for production use
|
|
- Store scripts securely and avoid hardcoding sensitive information
|
|
|
|
|
|
|
|
<!-- get txnL -->
|
|
curl -X POST -H "Content-Type: application/json" \
|
|
-d '{"jsonrpc": "1.0", "id":"gettx", "method": "gettransaction", "params": ["bcf19926894272e5f6d9a6cceedeac4bff0a2b23c496f660d168ded8fd49a462"]}' \
|
|
http://rinrpc:745ce784d5d537fc06105a1b935b7657903cfc71a5fb3b90@127.0.0.1:9556/wallet/main |