Bitcoin how to create a new account via RPC

1k Views Asked by At

I am running docker container with bitcoin node and want to create a new account, but I can't find good documentation about bitcoin RPC methods.

2

There are 2 best solutions below

1
On BEST ANSWER

To create account using RPC run:

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

I've found it here - Bitcoin cryptocurrency node administration guide

Also, if you running docker container don't forget to publish container's port (like docker run -p "127.0.0.1:8332:8332")

1
On

You can create a new Bitcoin address by running the following command:

bitcoin-cli getnewaddress

You can also do the same using cURL:

curl --user myrpcusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

More information here