# converttopsbt

Converts a network serialized transaction to a PSBT. This should be used only with createrawtransaction and fundrawtransaction createpsbt and walletcreatefundedpsbt should be used for new applications.

### Argument #1 - hexstring

**Type:** string, required

The hex string of a raw transaction

### Argument #2 - permitsigdata

**Type:** boolean, optional, default=false

If true, any signatures in the input will be discarded and conversion

will continue. If false, RPC will fail if any signatures are present.

### Argument #3 - iswitness

**Type:** boolean, optional, default=depends on heuristic tests

Whether the transaction hex is a serialized witness transaction.

If iswitness is not present, heuristic tests will be used in decoding. If true, only witness deserialization will be tried. If false, only non-witness deserialization will be tried. This boolean should reflect whether the transaction has inputs (e.g. fully valid, or on-chain transactions), if known by the caller.

### Result

| Name | Type   | Description                                           |
| ---- | ------ | ----------------------------------------------------- |
| str  | string | The resulting raw transaction (base64-encoded string) |

**Examples**

Create a transaction:

```
bitcoin-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "[{\"data\":\"00010203\"}]"
```

Convert the transaction to a PSBT:

```
bitcoin-cli converttopsbt "rawtransaction"
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.watchdata.io/blockchain-apis/bitcoin-api/rawtransactions-rpcs/converttopsbt.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
