logo

Cryptonodes Cheatsheet

#Bitcoin & BitcoinCash & Litecoin & Dash

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

More:

Bitcoin RPC API

Private key extraction

Bitcoin

To extract a private key of an address, run:

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

Litecoin && Dash

To extract private keys of all available addresses on the node, run:

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

You'll find the wallet dump in the file specified previously.

#Ripple

Create an Account

To create new XRP account, You should first generate a key pair and XRP Ledger address:

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

Now someone who already has an account in the XRP Ledger should send XRP to the address you generated. The first time you receive XRP at your own XRP Ledger address, you must pay the account reserve (currently 20 XRP), which locks up that amount of XRP indefinitely.

More:

Ripple RPC API

#Ethereum

Create an Account

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["passphrase"],"id":42}' rpcuser:[email protected]:ip

#Parity

Get created Accounts information

curl --data '{"method":"parity_allAccountsInfo","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Test an Account's password

curl --data '{"method":"parity_testPassword","params":["*account address*","*account_password*"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

Export an Account

To export an account you need to know the passphrase for the account you want to export Export is done in JSON format. You can then save this JSON into a file and import it to Metamask.

  1. Curl a Parity node to get the JSON response
curl --data '{"method":"parity_exportAccount","params":["*account address*","*account_password*"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 | jq -c .result

This will return the json that has to be saved to a file.

  1. Import the saved file to Metamask

Metamask Import

Change an Account's password

curl --data '{"method":"parity_changePassword","params":["*accout address*","*old_password*", "*new_password*"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545

More: