比特币RPC API中文手册

区块链API
GetBestBlockHash GetBlock GetBlockChainInfo GetBlockCount GetBlockHash GetBlockHeader GetChainTips GetDifficulty GetMemPoolAncestors GetMemPoolDescendants GetMemPoolEntry GetMemPoolInfo GetRawMemPool GetTxOut GetTxOutProof GetTxOutSetInfo PreciousBlock PruneBlockChain VerifyChain VerifyTxOutProof
节点控制API
GetInfo Help Stop
区块构造与挖矿API
Generate GenerateToAddress GetBlockTemplate GetMiningInfo GetNetworkHashPS PrioritiseTransaction SubmitBlock
P2P网络通信API
AddNode ClearBanned DisconnectNode GetAddedNodeInfo GetConnectionCount GetNetTotals GetNetworkInfo GetPeerInfo ListBanned Ping SetBan SetNetworkActive
裸交易相关API
CreateRawTransaction FundRawTransaction DecodeRawTransaction DecodeScript GetRawTransaction SendRawTransaction SignRawTransaction
工具类
CreateMultiSig EstimateFee EstimatePriority GetMemoryInfo ValidateAddress VerifyMessage
钱包相关
AbandonTransaction AddWitnessAddress AddMultiSigAddress BackupWallet BumpFee DumpPrivKey DumpWallet EncryptWallet GetAccountAddress GetAccount GetAddressesByAccount GetBalance GetNewAddress GetRawChangeAddress GetReceivedByAccount GetReceivedByAddress GetTransaction GetUnconfirmedBalance GetWalletInfo ImportAddress ImportMulti ImportPrunedFunds ImportPrivKey ImportWallet KeyPoolRefill ListAccounts ListAddressGroupings ListLockUnspent ListReceivedByAccount ListReceivedByAddress ListSinceBlock ListTransactions ListUnspent LockUnspent Move RemovePrunedFunds SendFrom SendMany SendToAddress SetAccount SetTxFee SignMessage SignMessageWithPrivKey WalletLock WalletPassphrase WalletPassphraseChange

GetNewAddress

getnewaddress调用返回一个用于接收支付的新的比特币地址,如果调用时指定了 账户,那么该地址接收到的支付将计入该账户。

getnewaddress调用需要节点启用钱包支持。

参数

  • Account:新地址所属账户,可选,默认值:""
  • AddressType:地址类型,可以是legacyp2sh-segwitbech32,可以 使用-addresstype设置默认地址类型

返回值

getnewaddress调用返回一个新的地址。

示例代码

下面的命令在doc test账户中创建一个新的地址:

~$ bitcoin-cli -testnet getnewaddress "doc test"

输出结果如下:

mft61jjkmiEJwJ7Zw3r1h344D6aL1xwhma