{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "newaddr",
  "title": "Command for generating a new address to be used by Core Lightning",
  "description": [
    "The **newaddr** RPC command generates a new address which can subsequently be used to fund channels managed by the Core Lightning node.",
    "",
    "The funding transaction needs to be confirmed before funds can be used.",
    "",
    "To send an on-chain payment from the Core Lightning node wallet, use `withdraw`."
  ],
  "request": {
    "required": [],
    "additionalProperties": false,
    "properties": {
      "addresstype": {
        "type": "string",
        "description": [
          "It specifies the type of address wanted; currently *bech32* (e.g. `tb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg` on bitcoin testnet or `bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej` on bitcoin mainnet), or *p2tr* taproot addresses. The special value *all* generates all known address types for the same underlying key."
        ],
        "default": "*p2tr* address",
        "enum": [
          "bech32",
          "p2tr",
          "all"
        ]
      }
    }
  },
  "response": {
    "required": [],
    "additionalProperties": false,
    "properties": {
      "p2tr": {
        "added": "v23.08",
        "type": "string",
        "description": [
          "The taproot address."
        ]
      },
      "bech32": {
        "type": "string",
        "description": [
          "The bech32 (native segwit) address."
        ]
      }
    }
  },
  "errors": [
    "If an unrecognized address type is requested an error message will be returned."
  ],
  "author": [
    "Felix [fixone@gmail.com](mailto:fixone@gmail.com) is mainly responsible."
  ],
  "see_also": [
    "lightning-listfunds(7)",
    "lightning-fundchannel(7)",
    "lightning-withdraw(7)",
    "lightning-listtransactions(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:newaddr#1",
        "method": "newaddr",
        "params": {}
      },
      "response": {
        "bech32": "bcrt1qwx6am26cuw38y4863pd6swrce2g8mzhaxr9xp8"
      }
    },
    {
      "request": {
        "id": "example:newaddr#2",
        "method": "newaddr",
        "params": {
          "addresstype": "p2tr"
        }
      },
      "response": {
        "p2tr": "bcrt1p2gppccw6ywewmg74qqxxmqfdpjds3rpr0mf22y9tm9xcc0muggwsea9nkf"
      }
    }
  ]
}
