> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uniblock.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# signrawtransactionwithkey

> Signs inputs of a raw transaction using the provided private keys and optionally previous output data.

### Parameters

<ParamField query="chainId" type="string" default="bitcoin-testnet" required>
  Unique identifier for a blockchain network.
</ParamField>

<ParamField body="id" type="number" default={1} required>
  Request identifier used to match responses.
</ParamField>

<ParamField body="jsonrpc" type="string" default="2.0" required>
  JSON-RPC version.
</ParamField>

<ParamField body="method" type="string" default="signrawtransactionwithkey" required>
  JSON-RPC method name.
</ParamField>

<ParamField body="params" type="object" default={["",[],[],""]} placeholder="[&#x22;&#x22;,[],[],&#x22;&#x22;]" required>
  Parameters: \[rawTx, privKeys, prevTxs?, sighashType?].

  Positional parameters for <code>signrawtransactionwithkey</code>:

  <ul>
    <li><code>params\[0]</code>: Raw transaction hex.</li>
    <li><code>params\[1]</code>: Private keys in WIF format.</li>
    <li><code>params\[2]</code>: Optional previous transaction outputs used for signing.</li>
    <li><code>params\[3]</code>: Optional signature hash type (e.g., ALL).</li>
  </ul>
</ParamField>

### Returns

<ResponseField name="result" type="object">
  Signed transaction result containing hex and completion flag.
</ResponseField>

<RequestExample>
  ```bash Curl theme={null}
  curl --request POST \
    --url https://api.uniblock.dev/uni/v1/json-rpc?chainId=bitcoin-testnet \
    --header 'content-type: application/json' \
    --data '{
      "id": 1,
      "jsonrpc": "2.0",
      "method": "signrawtransactionwithkey",
      "params": [
        "",
        [],
        [],
        ""
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "jsonrpc": "2.0",
    "id": 1,
    "result": {}
  }
  ```
</ResponseExample>
