GetNewAddress

Requires wallet support.

The getnewaddress RPC returns a new Pai address for receiving payments. If an account is specified, payments received with the address will be credited to that account.

Parameter #1—an account name

Name Type Presence Description
Account string Optional
(0 or 1)
The name of the account to put the address in. The default is the default account, an empty string (“”)

Parameter #2—address type

Name Type Presence Description
Address Type string Optional
(0 or 1)
The address type to use. Options are ‘legacy’, ‘p2sh-segwit’, and ‘bech32’. Default is set by -addresstype

Result—a pai address never previously returned

Name Type Presence Description
result string (base58) Required
(exactly 1)
A P2PKH address which has not previously been returned by this RPC. The address will be marked as a receiving address in the wallet. The address may already have been part of the keypool, so other RPCs such as the dumpwallet RPC may have disclosed it previously. If the wallet is unlocked, its keypool will also be filled to its max (by default, 100 unused keys). If the wallet is locked and its keypool is empty, this RPC will fail

Example

Create a new address in the “doc test” account:

pai-cli -testnet getnewaddress "doc test"

Result:

mft61jjkmiEJwJ7Zw3r1h344D6aL1xwhma

See also