Skip to main content

Wallet RPC Methods

Wallet RPCs provide functionality for managing wallets, creating and signing transactions, address management, and balance queries.
Wallet RPCs require the wallet component to be compiled in and at least one wallet to be loaded. Use the /wallet/<walletname>/ endpoint when multiple wallets are loaded.

Wallet Management

createwallet

Creates a new wallet.
# Create standard descriptor wallet
bitcoin-cli createwallet "mywallet"

# Create encrypted watch-only wallet
bitcoin-cli -named createwallet wallet_name="watchonly" disable_private_keys=true passphrase="secret"
name
string
Wallet name
warning
string
Warning messages (if any)

loadwallet

Loads an existing wallet.
bitcoin-cli loadwallet "mywallet"

unloadwallet

Unloads a wallet from memory.
bitcoin-cli -rpcwallet="mywallet" unloadwallet

listwallets

Returns a list of currently loaded wallets.
bitcoin-cli listwallets
result
array
Array of wallet names (strings)

getwalletinfo

Returns information about the wallet.
bitcoin-cli -rpcwallet="mywallet" getwalletinfo
walletname
string
Wallet name
walletversion
number
Wallet version
format
string
Database format (bdb, sqlite)
balance
number
Total confirmed balance in BTC
unconfirmed_balance
number
Unconfirmed balance in BTC
immature_balance
number
Immature coinbase balance
txcount
number
Total number of transactions
keypoolsize
number
Number of keys in keypool
unlocked_until
number
Timestamp wallet is unlocked until (encrypted wallets only)
descriptors
boolean
Whether wallet uses descriptors

Balance and UTXO Queries

getbalance

Returns the total available balance.
# Get total balance
bitcoin-cli -rpcwallet="mywallet" getbalance

# Get balance with at least 6 confirmations
bitcoin-cli -rpcwallet="mywallet" getbalance "*" 6
result
number
Total balance in BTC

getbalances

Returns detailed balance information.
bitcoin-cli -rpcwallet="mywallet" getbalances
mine
object
Balances from outputs the wallet can sign
  • trusted: Confirmed balance
  • untrusted_pending: Unconfirmed balance
  • immature: Immature coinbase balance
watchonly
object
Watch-only balances (same structure as mine)

listunspent

Returns array of unspent transaction outputs (UTXOs).
# List all UTXOs with at least 6 confirmations
bitcoin-cli -rpcwallet="mywallet" listunspent 6

# List UTXOs for specific address
bitcoin-cli -rpcwallet="mywallet" listunspent 1 9999999 '["bc1q..."]'
txid
string
Transaction ID
vout
number
Output index
address
string
Bitcoin address
amount
number
Amount in BTC
confirmations
number
Number of confirmations
spendable
boolean
Whether output is spendable
solvable
boolean
Whether output is solvable
safe
boolean
Whether output is safe to spend

Address Management

getnewaddress

Generates a new receiving address.
# Generate bech32 address
bitcoin-cli -rpcwallet="mywallet" getnewaddress

# Generate with label
bitcoin-cli -rpcwallet="mywallet" getnewaddress "payment1"
result
string
New Bitcoin address

getrawchangeaddress

Generates a new address for receiving change.
bitcoin-cli -rpcwallet="mywallet" getrawchangeaddress

getaddressinfo

Returns information about a given address.
bitcoin-cli -rpcwallet="mywallet" getaddressinfo "bc1q..."
address
string
The bitcoin address
ismine
boolean
Whether address belongs to wallet
iswatchonly
boolean
Whether address is watch-only
isscript
boolean
Whether address is a script
pubkey
string
Public key for address
label
string
Address label
hdkeypath
string
HD keypath (if address is from HD wallet)

Sending Transactions

sendtoaddress

Sends bitcoin to a given address.
# Send 0.1 BTC
bitcoin-cli -rpcwallet="mywallet" sendtoaddress "bc1q..." 0.1

# Send with fee subtracted from amount
bitcoin-cli -rpcwallet="mywallet" sendtoaddress "bc1q..." 0.1 "" "" true
result
string
Transaction ID

sendmany

Sends bitcoin to multiple addresses in one transaction.
bitcoin-cli -rpcwallet="mywallet" sendmany "" '{"bc1q...":0.1,"bc1p...":0.2}'
result
string
Transaction ID

send

Experimental RPC for creating and sending transactions with advanced options.
bitcoin-cli -rpcwallet="mywallet" send '[{"bc1q...":0.1}]' null "economical"

Transaction History

listtransactions

Returns list of transactions for the wallet.
# List last 100 transactions
bitcoin-cli -rpcwallet="mywallet" listtransactions "*" 100

gettransaction

Returns detailed information about an in-wallet transaction.
bitcoin-cli -rpcwallet="mywallet" gettransaction "txid"
amount
number
Amount in BTC (negative for sends)
fee
number
Transaction fee (negative, only for sends)
confirmations
number
Number of confirmations
blockhash
string
Block hash containing transaction
txid
string
Transaction ID
time
number
Transaction time
hex
string
Raw transaction hex

Wallet Encryption

encryptwallet

Encrypts wallet with a passphrase. This is a one-time operation.
bitcoin-cli -rpcwallet="mywallet" encryptwallet "mypassphrase"
After encryption, the wallet will shut down. You must restart bitcoind to use the encrypted wallet.

walletpassphrase

Unlocks wallet for a period of time.
bitcoin-cli -rpcwallet="mywallet" walletpassphrase "mypassphrase" 60

walletpassphrasechange

Changes wallet passphrase.
bitcoin-cli -rpcwallet="mywallet" walletpassphrasechange "old" "new"

walletlock

Locks an encrypted wallet.
bitcoin-cli -rpcwallet="mywallet" walletlock