logo

Bitcoin cryptocurrency node administration guide

#Create a new account

curl -H "Content-Type: application/json" --data '{"method": "getnewaddress"}' rpcuser:rpcpassword@ip:port

Or, you can specify account and get this address assigned to new address

curl -H "Content-Type: application/json" --data '{"method": "getnewaddress", "params": ["billy"]}' rpcuser:rpcpassword@ip:port

Where 'billy' is your account name. You can check that your account was created properly:

curl -H "Content-Type: application/json" --data '{"method": "getaddressesbyaccount", "params": ["billy"]}' rpcuser:rpcpassword@ip:port

#General Blockchain info

curl -H "Content-Type: application/json" --data '{"method": "getinfo"}' rpcuser:rpcpassword@ip:port

#Account info

To get account by address:

curl -H "Content-Type: application/json" --data '{"method": "getaccount", "params": ["bchtest:qpkgrpazps220qtnzvlvlcm62urtnq0edv7ufjr95n"]}' rpcuser:rpcpassword@ip:port

To get addresses associated with account:

curl -H "Content-Type: application/json" --data '{"method": "getaddressesbyaccount", "params": ["billy"]}' rpcuser:rpcpassword@ip:port

To get account balance:

curl -H "Content-Type: application/json" --data '{"method": "getbalance", "params": ["billy"]}' rpcuser:rpcpassword@ip:port

#Extract private key

To extract a private key of an address, run:

curl -H "Content-Type: application/json" --data '{"method": "dumpprivkey", "params": ["*address*"]}' rpcuser:rpcpassword@ip:port

#Backup

To back up the node, dump the wallet into a file of choice:

curl --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "dumpwallet", "params": ["*filename*"]}' -H 'content-type: text/plain; rpcuser:rpcpassword@ip:port'

Afterwards, upload the resulting file to a secure Object Storage bucket(AWS S3, GCS, etc.)

To restore the data later, upload the backup to the cryptonode instance and pass the resulting filename to the importwallet RPC call:

curl --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "importwallet", "params": ["*filename*"]}' -H 'content-type: text/plain; rpcuser:rpcpassword@ip:port'

#More

Bitcoin RPC API