{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "signpsbt",
  "title": "Command to sign a wallet's inputs on a provided bitcoin transaction (PSBT).",
  "description": [
    "**signpsbt** is a low-level RPC command which signs a PSBT as defined by BIP-174.",
    "",
    "By default, all known inputs are signed, and others ignored: with *signonly*, only those inputs are signed, and an error is returned if one of them cannot be signed.",
    "",
    "Note that the command will fail if there are no inputs to sign, or if the inputs to be signed were not previously reserved."
  ],
  "request": {
    "required": [
      "psbt"
    ],
    "additionalProperties": false,
    "properties": {
      "psbt": {
        "type": "string",
        "description": [
          "The psbt to be signed."
        ]
      },
      "signonly": {
        "type": "array",
        "description": [
          "Input numbers to sign."
        ],
        "items": {
          "type": "u32"
        }
      }
    }
  },
  "response": {
    "required": [
      "signed_psbt"
    ],
    "additionalProperties": false,
    "properties": {
      "signed_psbt": {
        "type": "string",
        "description": [
          "The fully signed PSBT."
        ]
      }
    }
  },
  "errors": [
    "On failure, one of the following error codes may be returned:",
    "",
    "- -32602: Error in given parameters, or there aren't wallet's inputs to sign, or we couldn't sign all of *signonly*, or inputs are not reserved."
  ],
  "author": [
    "Vincenzo Palazzo [vincenzo.palazzo@protonmail.com](mailto:vincenzo.palazzo@protonmail.com) wrote the initial version of this man page,",
    "but many others did the hard work of actually implementing this rpc command."
  ],
  "see_also": [
    "lightning-fundpsbt(7)",
    "lightning-sendpsbt(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:signpsbt#1",
        "method": "signpsbt",
        "params": {
          "psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000910000"
        }
      },
      "response": {
        "signed_psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000111000"
      }
    },
    {
      "request": {
        "id": "example:signpsbt#2",
        "method": "signpsbt",
        "params": [
          "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000101000"
        ]
      },
      "response": {
        "signed_psbt": "cHNidP8BAgQCAAAAAQMEbwAAAAEEAQpsbt121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000121000"
      }
    }
  ]
}
