<p>You are passing a JSON key <code>outputs</code> in the second argument to <code>fundrawtransaction</code> (named &quot;options&quot;). This is not a recognized parameter.</p>
<p>It looks like you are trying to pass a redeemscript to the command for it to be able to create a valid scriptsig. You probably want to pass this script as part of the <code>solving_data</code> key inside the &quot;options&quot; parameter. See the documentation for <code>fundrawtransaction</code>.</p>
<p>Note <code>fundrawtransaction</code> only works for legacy script though. I see you are trying to pass an <code>amount</code> key as well, i assume it's for the Bitcoin Core wallet to sign the transaction using a Segwit signature hash. You should probably use PSBT commands in the Bitcoin Core wallet instead.</p>

CC BY-SA 4.0
2023-08-14T08:14:46.703Z
2023-08-14T08:23:51.027Z
2023-08-14T08:23:51.027Z
Antoine Poinsot
<p>I'm trying to use the <code>fundrawtransaction</code> RPC command in order to create a transaction spending an HTLC output. Here is the command i've entered:</p>
<pre><code>fundrawtransaction &quot;02000000019ab30b02450c227d38d11f1e32de4139c4b14e6496e8c791615673be577691e10000000000fdffffff01a00f000000000000160014d095ce864aa19d47371c4a87c3c61a3cdd180b0b00000000&quot; &quot;{\&quot;changeAddress\&quot;: \&quot;bc1qccvnpr2rgfh4k7mcaty4dn3nesmtsyhwn5d58q\&quot;, \&quot;outputs\&quot;: [{\&quot;script\&quot;: \&quot;6352210242625461fa5e6d69921fc95973b9ad4b139cbd16bbb4dd82a59c15f90193b25567a8f1e84f1a9abb1dce8d2a0b2a1e3cbb0c5fb41baf5f8220e14e7d059b463e3b88ac76a91402ec9dcf6c138a3d8c7ae214e2ce37577766f321388670a02211af0daf491b036b0eb4ded2861dbc7b21e11c8b010f70cc282f4e9e3fb81c752ae87\&quot;, \&quot;amount\&quot;: 0}]}&quot;
</code></pre>
<p>I'm getting this error:</p>
<pre><code>Unexpected key outputs (code -3)
</code></pre>
<p>I don't understand what this error relates to.</p>

<bitcoin-core><transactions><wallet><input-script>
`fundrawtransaction` error when trying to spend an HTLC
Rafique Scott
# `fundrawtransaction` error when trying to spend an HTLC

(Asked by: username_0 on 2023-08-14)

I'm trying to use the fundrawtransaction RPC command in order to create a transaction spending an HTLC output. Here is the command i've entered:
fundrawtransaction "02000000019ab30b02450c227d38d11f1e32de4139c4b14e6496e8c791615673be577691e10000000000fdffffff01a00f000000000000160014d095ce864aa19d47371c4a87c3c61a3cdd180b0b00000000" "{\"changeAddress\": \"bc1qccvnpr2rgfh4k7mcaty4dn3nesmtsyhwn5d58q\", \"outputs\": [{\"script\": \"6352210242625461fa5e6d69921fc95973b9ad4b139cbd16bbb4dd82a59c15f90193b25567a8f1e84f1a9abb1dce8d2a0b2a1e3cbb0c5fb41baf5f8220e14e7d059b463e3b88ac76a91402ec9dcf6c138a3d8c7ae214e2ce37577766f321388670a02211af0daf491b036b0eb4ded2861dbc7b21e11c8b010f70cc282f4e9e3fb81c752ae87\", \"amount\": 0}]}"

I'm getting this error:
Unexpected key outputs (code -3)

I don't understand what this error relates to.

**Tags:** bitcoin-core, transactions, wallet, input-script


---

## 1 answers

### Answer by username_1 on 2023-08-14. Score: 1

You are passing a JSON key `outputs` in the second argument to `fundrawtransaction` (named "options"). This is not a recognized parameter.

It looks like you are trying to pass a redeemscript to the command for it to be able to create a valid scriptsig. You probably want to pass this script as part of the `solving_data` key inside the "options" parameter. See the documentation for `fundrawtransaction`.

Note `fundrawtransaction` only works for legacy script though. I see you are trying to pass an `amount` key as well, i assume it's for the Bitcoin Core wallet to sign the transaction using a Segwit signature hash. You should probably use PSBT commands in the Bitcoin Core wallet instead.


---

