logo

Bitcoin cryptocurrency node administration guide

#Create a new account

curl -H "Content-Type: application/json" --data '{"method": "getnewaddress"}' rpcuser:[email protected]: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:[email protected]: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:[email protected]:port

#General Blockchain info

curl -H "Content-Type: application/json" --data '{"method": "getinfo"}' rpcuser:[email protected]:port

#Account info

To get account by address:

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

To get addresses associated with account:

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

To get account balance:

curl -H "Content-Type: application/json" --data '{"method": "getbalance", "params": ["billy"]}' rpcuser:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]:port'

#More

Bitcoin RPC API