简体   繁体   English

比特币如何通过 RPC 创建新账户

[英]Bitcoin how to create a new account via RPC

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.我正在使用比特币节点运行 docker 容器并想创建一个新帐户,但我找不到有关比特币 RPC 方法的好的文档。

To create account using RPC run:要使用 RPC 运行创建帐户:

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" )此外,如果您运行 docker 容器,请不要忘记发布容器的端口(如docker run -p "127.0.0.1:8332:8332"

You can create a new Bitcoin address by running the following command:您可以通过运行以下命令来创建新的比特币地址:

bitcoin-cli getnewaddress

You can also do the same using cURL:您也可以使用 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更多信息 在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM