{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "listtransactions",
  "title": "Command to get the list of transactions that was stored in the wallet.",
  "description": [
    "The **listtransactions** command returns transactions tracked in the wallet. This includes deposits, withdrawals and transactions related to channels. A transaction may have multiple types, e.g., a transaction may both be a close and a deposit if it closes the channel and returns funds to the wallet."
  ],
  "categories": [
    "readonly"
  ],
  "request": {
    "required": [],
    "additionalProperties": false,
    "properties": {}
  },
  "response": {
    "required": [
      "transactions"
    ],
    "additionalProperties": false,
    "properties": {
      "transactions": {
        "type": "array",
        "items": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "hash",
            "rawtx",
            "blockheight",
            "txindex",
            "locktime",
            "version",
            "inputs",
            "outputs"
          ],
          "properties": {
            "hash": {
              "type": "txid",
              "description": [
                "The transaction id."
              ]
            },
            "rawtx": {
              "type": "hex",
              "description": [
                "The raw transaction."
              ]
            },
            "blockheight": {
              "type": "u32",
              "description": [
                "The block height of this tx."
              ]
            },
            "txindex": {
              "type": "u32",
              "description": [
                "The transaction number within the block."
              ]
            },
            "locktime": {
              "type": "u32",
              "description": [
                "The nLocktime for this tx."
              ]
            },
            "version": {
              "type": "u32",
              "description": [
                "The nVersion for this tx."
              ]
            },
            "inputs": {
              "type": "array",
              "description": [
                "Each input, in order."
              ],
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "txid",
                  "index",
                  "sequence"
                ],
                "properties": {
                  "txid": {
                    "type": "txid",
                    "description": [
                      "The transaction id spent."
                    ]
                  },
                  "index": {
                    "type": "u32",
                    "description": [
                      "The output spent."
                    ]
                  },
                  "sequence": {
                    "type": "u32",
                    "description": [
                      "The nSequence value."
                    ]
                  }
                }
              }
            },
            "outputs": {
              "type": "array",
              "description": [
                "Each output, in order."
              ],
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "index",
                  "amount_msat",
                  "scriptPubKey"
                ],
                "properties": {
                  "index": {
                    "type": "u32",
                    "description": [
                      "The 0-based output number."
                    ]
                  },
                  "amount_msat": {
                    "type": "msat",
                    "description": [
                      "The amount of the output."
                    ]
                  },
                  "scriptPubKey": {
                    "type": "hex",
                    "description": [
                      "The scriptPubKey."
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "errors": [
    "On failure, one of the following error codes may be returned:",
    "",
    "- -32602: Error in given parameters."
  ],
  "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-newaddr(7)",
    "lightning-listfunds(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "request": {
        "id": "example:listtransactions#1",
        "method": "listtransactions",
        "params": {}
      },
      "response": {
        "transactions": [
          {
            "hash": "txid7000170001700017000170001700017000170001700017000170001",
            "rawtx": "02000000000101lstx70001700017000170001700017000170001700017000170001700017000170001700017000170001700017000170001700017000170001700017000170001700017000170001700017000170001700017000170001",
            "blockheight": 0,
            "txindex": 0,
            "locktime": 549000100,
            "version": 2,
            "inputs": [
              {
                "txid": "txid600116001160011600116001160011600116001160011600116001160011",
                "index": 1,
                "sequence": 2158511000
              }
            ],
            "outputs": [
              {
                "index": 1,
                "amount_msat": 201998901100,
                "scriptPubKey": "scriptpubkey01010101010101010101010101010101010101010101010101010101"
              }
            ]
          },
          {
            "hash": "txid7000270002700027000270002700027000270002700027000270002",
            "rawtx": "02000000000101lstx70002700027000270002700027000270002700027000270002700027000270002700027000270002700027000270002700027000270002700027000270002700027000270002700027000270002700027000270002",
            "blockheight": 102,
            "txindex": 1,
            "locktime": 549000200,
            "version": 2,
            "inputs": [
              {
                "txid": "txid600126001260012600126001260012600126001260012600126001260012",
                "index": 1,
                "sequence": 2158512000
              }
            ],
            "outputs": [
              {
                "index": 1,
                "amount_msat": 201998902100,
                "scriptPubKey": "scriptpubkey02010201020102010201020102010201020102010201020102010201"
              },
              {
                "index": 2,
                "amount_msat": 201998902200,
                "scriptPubKey": "scriptpubkey02020202020202020202020202020202020202020202020202020202"
              }
            ]
          }
        ]
      }
    }
  ]
}
