Bitcoin core wallet RPC console commands – Bitcoin-qt client API call lists
In this article we’ll share some of the basic commands that you can use to interact with your Bitcoin core RPC console.
Bitcoin core QT client is the original Bitcoin wallet and a full node that has features most other Bitcoin wallets don’t have. It builds the backbone of the network. It offers full validation and high level of privacy, security and stability.
The wallet is available for Windows, Mac and Linux. If you don’t already have Bitcoin core installed on your computer then you can download from here. https://bitcoin.org/en/download
Before downloading and installing make sure to check your bandwidth and space. The core wallet have to fully validate transactions and blocks. At the time of writing this article the minimum disk space requirements to run a Bitcoin core is more than 600 GB. It downloads enormous amounts of data so ensure you have good Internet connection and bandwidth requirements.
See the full Bitcoin core system requirements and operation costs here: https://bitcoin.org/en/bitcoin-core/features/requirements
Also verify Bitcoin core before installing and using it.
Pro Tip: If you don’t have enough disk space then you can run Bitcoin core in prune mode.
Bitcoin core Graphical UI and CLI / API
After downloading and installing the wallet wait for it to completely sync. If you have trouble syncing your wallet then check this guide on wallet not syncing issue.
Once it has fully synced your wallet is ready to use and you can start interacting with the client.
Core wallet software has both GUI (Graphical User Interface) and a console interface. The GUI is convenient for beginners. One can view their current balance, recent transactions, send, receive Bitcoins, can adjust fees, has coin control and some other basic functions.
But to use the software to its fullest potential and to have full control over your Bitcoins you need to learn to use the console window.
Here we’ll show you how to use the debug console window on Bitcoin-qt wallet.
Now before you get into this guide and before you enter any commands on the console window we hope your wallet is encrypted and you have a backup.
To know how to encrypt check out this core wallet beginners guide. Also if you do not know then here is a guide to backup and restore core wallet.
Bitcoin core console window
In the older version of Bitcoin client you should see the debug window under Help > Debug window where you can start entering bitcoin-cli commands.
In the latest version drop down windows menu and open up console window.
You should see the following warning.
Welcome to the Bitcoin Core RPC console.
Use up and down arrows to navigate history, and Ctrl-L to clear screen.
Type help for an overview of available commands.
For more information on using this console type help-console.
WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramifications of a command.
As the warning suggests do not enter comments that you are not familiar with and do not share the information to anyone that your console window returns especially the one that involves wallet passphrase and private keys.
Bitcoin console commands
Bitcoin RPC console window accepts a variety of commands. Type help and enter. You should see the list of commands that is currently accepted by the console. We’ve shared all the available command lists below.
We’ll not get into all that in detail. Just to get familiar with the console window we’ll show you some basic commands.
> getblockcount
Returns the current best block index
653646
> getbalance
Displays your total available wallet balance
0.00000000
> getconnectioncount
Shows the number of active connection to the Bitcoin network
10
> getwalletinfo
Returns an object containing your wallet information
{ "walletname": "", "walletversion": xxxxxxx, "balance": 0.00000000, "unconfirmed_balance": 0.00000000, "immature_balance": 0.00000000, "txcount": 0, "keypoololdest": xxxxxxxxxx, "keypoolsize": xxxx, "hdseedid": "xxxxxxxxxxxxxxxxxxxxxxxxxx", "keypoolsize_hd_internal": xxxx, "unlocked_until": x, "paytxfee": 0.00000000, "private_keys_enabled": true, "avoid_reuse": false, "scanning": false }
> getblockchaininfo
Returns information about the current Bitcoin blockchain. You can use this command to identify blockchain size, difficulty etc.
{ "chain": "main", "blocks": 653527, "headers": 653587, "bestblockhash": "0000000000000000000313ef2b2930ecbc3fe05de391bc439xxxxxxxxxxxxxx", "difficulty": 19996789994446.11, "mediantime": yyyyyyyyyyyy, "verificationprogress": 0.4544565953577, "initialblockdownload": false, "chainwork": "0000000000000000000000000000000000000000454dff6n25j34597dfvjkn45", "size_on_disk": 656738766, "pruned": true, "pruneheight": 653202, "automatic_pruning": true, "prune_target_size": 576716800, "softforks": { "bip34": { "type": "buried", "active": true, "height": 227931 }, "bip66": { "type": "buried", "active": true, "height": 363725 }, "bip65": { "type": "buried", "active": true, "height": 388381 }, "csv": { "type": "buried", "active": true, "height": 419328 }, "segwit": { "type": "buried", "active": true, "height": 481824 } }, "warnings": "" }
You can also use the command
> getmininginfo
To get more precise information on the block count, current network difficulty and to find the number of transactions in the transaction pool (mempool).
{ "blocks": 653597, "difficulty": 19994576894446.11, "networkhashps": 1.24389066767887e+020, "pooledtx": 1637, "chain": "main", "warnings": "" }
There are plenty of information that you can fetch from Bitcoin core console window using the commands listed below. You don’t have to know all these commands. However if you are a developer and are looking to develop Bitcoin applications such as block explorer or mining pools then understanding these commands is essential.
The RPC console is a great way to know about the Bitcoin blockchain, network, transactions and the mining information.
Console command list
- == Blockchain ==
getbestblockhash getblock "blockhash" ( verbosity ) getblockchaininfo getblockcount getblockfilter "blockhash" ( "filtertype" ) getblockhash height getblockheader "blockhash" ( verbose ) getblockstats hash_or_height ( stats ) getchaintips getchaintxstats ( nblocks "blockhash" ) getdifficulty getmempoolancestors "txid" ( verbose ) getmempooldescendants "txid" ( verbose ) getmempoolentry "txid" getmempoolinfo getrawmempool ( verbose ) gettxout "txid" n ( include_mempool ) gettxoutproof ["txid",...] ( "blockhash" ) gettxoutsetinfo preciousblock "blockhash" pruneblockchain height savemempool scantxoutset "action" ( [scanobjects,...] ) verifychain ( checklevel nblocks ) verifytxoutproof "proof"
- == Control ==
getmemoryinfo ( "mode" ) getrpcinfo help ( "command" ) logging ( ["include_category",...] ["exclude_category",...] ) stop uptime
- == Generating ==
generatetoaddress nblocks "address" ( maxtries ) generatetodescriptor num_blocks "descriptor" ( maxtries )
- == Mining ==
getblocktemplate ( "template_request" ) getmininginfo getnetworkhashps ( nblocks height ) prioritisetransaction "txid" ( dummy ) fee_delta submitblock "hexdata" ( "dummy" ) submitheader "hexdata"
- == Network ==
addnode "node" "command" clearbanned disconnectnode ( "address" nodeid ) getaddednodeinfo ( "node" ) getconnectioncount getnettotals getnetworkinfo getnodeaddresses ( count ) getpeerinfo listbanned ping setban "subnet" "command" ( bantime absolute ) setnetworkactive state
- == Rawtransactions ==
analyzepsbt "psbt" combinepsbt ["psbt",...] combinerawtransaction ["hexstring",...] converttopsbt "hexstring" ( permitsigdata iswitness ) createpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime replaceable ) createrawtransaction [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime replaceable ) decodepsbt "psbt" decoderawtransaction "hexstring" ( iswitness ) decodescript "hexstring" finalizepsbt "psbt" ( extract ) fundrawtransaction "hexstring" ( options iswitness ) getrawtransaction "txid" ( verbose "blockhash" ) joinpsbts ["psbt",...] sendrawtransaction "hexstring" ( maxfeerate ) signrawtransactionwithkey "hexstring" ["privatekey",...] ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" ) testmempoolaccept ["rawtx",...] ( maxfeerate ) utxoupdatepsbt "psbt" ( ["",{"desc":"str","range":n or [n,n]},...] )
- == Util ==
createmultisig nrequired ["key",...] ( "address_type" ) deriveaddresses "descriptor" ( range ) estimatesmartfee conf_target ( "estimate_mode" ) getdescriptorinfo "descriptor" signmessagewithprivkey "privkey" "message" validateaddress "address" verifymessage "address" "signature" "message"
- == Wallet ==
abandontransaction "txid" abortrescan addmultisigaddress nrequired ["key",...] ( "label" "address_type" ) backupwallet "destination" bumpfee "txid" ( options ) createwallet "wallet_name" ( disable_private_keys blank "passphrase" avoid_reuse ) dumpprivkey "address" dumpwallet "filename" encryptwallet "passphrase" getaddressesbylabel "label" getaddressinfo "address" getbalance ( "dummy" minconf include_watchonly avoid_reuse ) getbalances getnewaddress ( "label" "address_type" ) getrawchangeaddress ( "address_type" ) getreceivedbyaddress "address" ( minconf ) getreceivedbylabel "label" ( minconf ) gettransaction "txid" ( include_watchonly verbose ) getunconfirmedbalance getwalletinfo importaddress "address" ( "label" rescan p2sh ) importmulti "requests" ( "options" ) importprivkey "privkey" ( "label" rescan ) importprunedfunds "rawtransaction" "txoutproof" importpubkey "pubkey" ( "label" rescan ) importwallet "filename" keypoolrefill ( newsize ) listaddressgroupings listlabels ( "purpose" ) listlockunspent listreceivedbyaddress ( minconf include_empty include_watchonly "address_filter" ) listreceivedbylabel ( minconf include_empty include_watchonly ) listsinceblock ( "blockhash" target_confirmations include_watchonly include_removed ) listtransactions ( "label" count skip include_watchonly ) listunspent ( minconf maxconf ["address",...] include_unsafe query_options ) listwalletdir listwallets loadwallet "filename" lockunspent unlock ( [{"txid":"hex","vout":n},...] ) removeprunedfunds "txid" rescanblockchain ( start_height stop_height ) sendmany "" {"address":amount} ( minconf "comment" ["address",...] replaceable conf_target "estimate_mode" ) sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount replaceable conf_target "estimate_mode" avoid_reuse ) sethdseed ( newkeypool "seed" ) setlabel "address" "label" settxfee amount setwalletflag "flag" ( value ) signmessage "address" "message" signrawtransactionwithwallet "hexstring" ( [{"txid":"hex","vout":n,"scriptPubKey":"hex","redeemScript":"hex","witnessScript":"hex","amount":amount},...] "sighashtype" ) unloadwallet ( "wallet_name" ) walletcreatefundedpsbt [{"txid":"hex","vout":n,"sequence":n},...] [{"address":amount},{"data":"hex"},...] ( locktime options bip32derivs ) walletlock walletpassphrase "passphrase" timeout walletpassphrasechange "oldpassphrase" "newpassphrase" walletprocesspsbt "psbt" ( sign "sighashtype" bip32derivs )
- == Zmq ==
getzmqnotifications
You can find the complete list of Bitcoin console commands with explanation at https://developer.bitcoin.org/reference/rpc/
Also for reference check: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
Article similar to this: