Bitcoin implementations provide a simple command interface for interacting with the full node via JSON-RPC.
There’s one endpoint which receives the command and its arguments via HTTP. The default port for it is 8332
. Further information on how to configure it can be found in the bitcoin.conf example.
To get a list of the available commands, you might use the bitcoin-cli
and a running bitcoin full node. Eg. this is the output of my local regtest setup:
Available Commands
$> bitcoin-cli help == Blockchain == getbestblockhash getblock "blockhash" ( verbosity ) getblockchaininfo getblockcount getblockhash height getblockheader "hash" ( verbose ) 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 verifychain ( checklevel nblocks ) verifytxoutproof "proof" == Control == getinfo getmemoryinfo help ( "command" ) stop uptime == Generating == generate nblocks ( maxtries ) generatetoaddress nblocks address (maxtries) == Mining == getblocktemplate ( TemplateRequest ) getminingcandidate coinbase (optional, default false) getmininginfo getnetworkhashps ( nblocks height ) prioritisetransaction <txid> <priority delta> <fee delta> submitblock "hexdata" ( "jsonparametersobject" ) submitminingsolution "<json string>" == Network == addnode "node" "add|remove|onetry" clearbanned disconnectnode "[address]" [nodeid] getaddednodeinfo ( "node" ) getconnectioncount getexcessiveblock getnettotals getnetworkinfo getpeerinfo listbanned ping setban "subnet" "add|remove" (bantime) (absolute) setexcessiveblock blockSize setnetworkactive true|false settxnpropagationfreq freq == Rawtransactions == createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,"data":"hex",...} ( locktime ) decoderawtransaction "hexstring" decodescript "hexstring" fundrawtransaction "hexstring" ( options ) getrawtransaction "txid" ( verbose ) sendrawtransaction "hexstring" ( allowhighfees ) signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype ) == Util == createmultisig nrequired ["key",...] estimatefee nblocks signmessagewithprivkey "privkey" "message" validateaddress "address" verifymessage "address" "signature" "message" == Wallet == abandontransaction "txid" addmultisigaddress nrequired ["key",...] ( "account" ) backupwallet "destination" dumpprivkey "address" dumpwallet "filename" encryptwallet "passphrase" getaccount "address" getaccountaddress "account" getaddressesbyaccount "account" getbalance ( "account" minconf include_watchonly ) getnewaddress ( "account" ) getrawchangeaddress getreceivedbyaccount "account" ( minconf ) getreceivedbyaddress "address" ( minconf ) gettransaction "txid" ( include_watchonly ) getunconfirmedbalance getwalletinfo importaddress "address" ( "label" rescan p2sh ) importmulti "requests" "options" importprivkey "bitcoinprivkey" ( "label" ) ( rescan ) importprunedfunds importpubkey "pubkey" ( "label" rescan ) importwallet "filename" keypoolrefill ( newsize ) listaccounts ( minconf include_watchonly) listaddressgroupings listlockunspent listreceivedbyaccount ( minconf include_empty include_watchonly) listreceivedbyaddress ( minconf include_empty include_watchonly) listsinceblock ( "blockhash" target_confirmations include_watchonly) listtransactions ( "account" count skip include_watchonly) listunspent ( minconf maxconf ["addresses",...] [include_unsafe] ) listwallets lockunspent unlock ([{"txid":"txid","vout":n},...]) move "fromaccount" "toaccount" amount ( minconf "comment" ) removeprunedfunds "txid" sendfrom "fromaccount" "toaddress" amount ( minconf "comment" "comment_to" ) sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] ) sendtoaddress "address" amount ( "comment" "comment_to" subtractfeefromamount ) setaccount "address" "account" settxfee amount signmessage "address" "message"
You may try that out with a simple command line tool called curl
:
Curl Example
curl --data-binary '{"jsonrpc":"1.0","id":"curltext","method":"getblockchaininfo","params":[]}' -H 'content-type:text/plain;' http://username:[email protected]:8332/