<p>You can use <a href="https://bitcoin.org/en/developer-reference#signrawtransaction" rel="nofollow noreferrer"><code>signrawtransaction</code></a>, this method accept an array of private keys as an argument. </p>

<p>Parameter #3—private keys for signing:</p>

<blockquote>
  <p>An array holding private keys. <em>If any keys are provided, only they
  will be used to sign the transaction (even if the wallet has other
  matching keys).</em> If this array is empty or not used, and wallet support
  is enabled, keys from the wallet will be used</p>
</blockquote>

CC BY-SA 3.0
2018-01-30T06:29:00.533Z
Can you provide me some ways to create txid in rawtransaction
Ajit Soman
CC BY-SA 3.0
2018-01-30T06:31:03.627Z
@AjitSoman there is a lot of examples, in [the documentation](https://bitcoin.org/en/developer-reference#rpcs)
Roman Kiselenko
CC BY-SA 3.0
2018-01-30T06:19:14.893Z
2018-01-30T06:19:14.893Z
Roman Kiselenko
<p><strong>EDIT: based on OPs request, I put examples in here:</strong></p>

<p>there are a lot of examples for different tx types on bitcoin.org, in the <a href="https://bitcoin.org/en/developer-examples#simple-spending" rel="nofollow noreferrer">developer examples</a>. Basically you will need three steps. Assuming you are on OpenBSD/MacOS/Linux, you can go this way:</p>

<p><strong>1.) createrawtransaction</strong> - this is what you have already, and it looks ok. I don't know if the previous tx ID or v_out is correct, assuming you know the details, your string is ok (otherwise check with "bitcoin-cli -regtest listunspent", and adopt TX_ID and V_OUT accordingly). I also assume, that the address is one which is in your wallet. Otherwise you might just create an address, and proceed afterwards like this:</p>

<pre><code>UTXO_TXID=dbdc2e2c7f143af70c5e7e8725f55d226b3c058d7bf34a303‌
UTXO_VOUT=1
NEW_ADDRESS=n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV
bitcoin-cli -regtest createrawtransaction '''
    [
      {
        "txid": "'$UTXO_TXID'",
        "vout": '$UTXO_VOUT'
      }
    ]
    ''' '''
    {
      "'$NEW_ADDRESS'": 1
    }'''
</code></pre>

<p>you provide this returned hex string to another variable: </p>

<pre><code>RAW_TX=01000...
</code></pre>

<p><strong>2.) signrawtransaction</strong> - the previous command returns a hex string, that you will use to sign the transaction - again, see the docs. First I verify my created tx, and then sign: </p>

<pre><code>bitcoin-cli -regtest decoderawtransaction $RAW_TX
bitcoin-cli -regtest signrawtransaction $RAW_TX
</code></pre>

<p>again you assign the result to a variable: </p>

<pre><code>SIGNED_RAW_TX=01000...
</code></pre>

<p><strong>3.) sendrawtransaction</strong> - again you take the hexstring of the previous command as parameter, and/or see the docs.</p>

<pre><code>bitcoin-cli -regtest sendrawtransaction $SIGNED_RAW_TX
</code></pre>

<p>and maybe a verification as step 4:</p>

<pre><code>bitcoin-cli -regtest generate 1
</code></pre>

<p>this generates a block, and you can see on the $NEW_ADDRESS, if funds have been transferred. </p>

<p>I just entered the two keywords here in the search function, and also found a lot of answers. </p>

CC BY-SA 3.0
2018-01-30T10:46:14.540Z
Can you provide me some ways to create txid in rawtransaction. It would be better if you can post it to your answer
Ajit Soman
CC BY-SA 3.0
2018-02-26T12:01:58.110Z
is there any single command available in bitcoin core that is equivalent to `createrawtransaction,signrawtransaction,sendrawtransaction`
Ajit Soman
CC BY-SA 3.0
2018-02-26T19:16:56.497Z
I am not aware of such a command...
pebwindkraft
CC BY-SA 3.0
2018-01-30T09:35:11.030Z
2018-01-30T11:06:45.363Z
2018-01-30T11:06:45.363Z
pebwindkraft
<p>I have a address- <code>n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV</code>, amount  that i want to send-<code>1 BTC</code> and i have a <code>private key</code>. How can i create a raw transaction using it and broadcast it to blockchain using bitcoin core.</p>

<p>I have tried this command:</p>

<pre><code>bitcoin-cli createrawtransaction '[{"txid":"dbdc2e2c7f143af70c5e7e8725f55d226b3c058d7bf34a303‌​091b3c6a514848c","vo‌​ut":1}]' '{"n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV":1}' 
</code></pre>

<p>and this: <code>bitcoin-cli sendrawtransaction XXX</code></p>

CC BY-SA 3.0
2018-01-30T06:13:39.943Z
I have tried this command :bitcoin-cli createrawtransaction '[{"txid":"dbdc2e2c7f143af70c5e7e8725f55d226b3c058d7bf34a303091b3c6a514848c","vout":1}]' '{"n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV":1}'

and this:

bitcoin-cli sendrawtransaction XXX
Ajit Soman
CC BY-SA 3.0
2018-01-30T06:14:12.497Z
But i want to perform transaction using specific private key
Ajit Soman
CC BY-SA 3.0
2018-01-30T06:14:36.473Z
I don't  want to import private key in wallet
Ajit Soman
<transactions><bitcoin-core><bitcoind><createrawtransaction><sendrawtransaction>
Create a raw transaction and broadcast it to blockchain using bitcoin core
Ajit Soman
# Create a raw transaction and broadcast it to blockchain using bitcoin core

(Asked by: username_0 on 2018-01-30)

I have a address- `n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV`, amount that i want to send-`1 BTC` and i have a `private key`. How can i create a raw transaction using it and broadcast it to blockchain using bitcoin core.

I have tried this command:

```
bitcoin-cli createrawtransaction '[{"txid":"dbdc2e2c7f143af70c5e7e8725f55d226b3c058d7bf34a303‌​091b3c6a514848c","vo‌​ut":1}]' '{"n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV":1}' 

```

and this: `bitcoin-cli sendrawtransaction XXX`

**Tags:** transactions, bitcoin-core, bitcoind, createrawtransaction, sendrawtransaction

> **Comments:**
> **username_0**: I have tried this command :bitcoin-cli createrawtransaction '[{"txid":"dbdc2e2c7f143af70c5e7e8725f55d226b3c058d7bf34a303091b3c6a514848c","vout":1}]' '{"n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV":1}'  and this:  bitcoin-cli sendrawtransaction XXX  
> **username_0**: But i want to perform transaction using specific private key  
> **username_0**: I don't  want to import private key in wallet  

---

## 2 answers

### Answer by username_2 on 2018-01-30. Score: 4 | Accepted answer

**EDIT: based on OPs request, I put examples in here:**

there are a lot of examples for different tx types on bitcoin.org, in the [developer examples](https://bitcoin.org/en/developer-examples#simple-spending). Basically you will need three steps. Assuming you are on OpenBSD/MacOS/Linux, you can go this way:

**1.) createrawtransaction** - this is what you have already, and it looks ok. I don't know if the previous tx ID or v\_out is correct, assuming you know the details, your string is ok (otherwise check with "bitcoin-cli -regtest listunspent", and adopt TX\_ID and V\_OUT accordingly). I also assume, that the address is one which is in your wallet. Otherwise you might just create an address, and proceed afterwards like this:

```
UTXO_TXID=dbdc2e2c7f143af70c5e7e8725f55d226b3c058d7bf34a303‌
UTXO_VOUT=1
NEW_ADDRESS=n3xYQtxvVwpBPSbgGsGRdMWz1YTUjakiMV
bitcoin-cli -regtest createrawtransaction '''
    [
      {
        "txid": "'$UTXO_TXID'",
        "vout": '$UTXO_VOUT'
      }
    ]
    ''' '''
    {
      "'$NEW_ADDRESS'": 1
    }'''

```

you provide this returned hex string to another variable:

```
RAW_TX=01000...

```

**2.) signrawtransaction** - the previous command returns a hex string, that you will use to sign the transaction - again, see the docs. First I verify my created tx, and then sign:

```
bitcoin-cli -regtest decoderawtransaction $RAW_TX
bitcoin-cli -regtest signrawtransaction $RAW_TX

```

again you assign the result to a variable:

```
SIGNED_RAW_TX=01000...

```

**3.) sendrawtransaction** - again you take the hexstring of the previous command as parameter, and/or see the docs.

```
bitcoin-cli -regtest sendrawtransaction $SIGNED_RAW_TX

```

and maybe a verification as step 4:

```
bitcoin-cli -regtest generate 1

```

this generates a block, and you can see on the $NEW\_ADDRESS, if funds have been transferred.

I just entered the two keywords here in the search function, and also found a lot of answers.

> **Comments:**
> **username_0**: Can you provide me some ways to create txid in rawtransaction. It would be better if you can post it to your answer  
> **username_0**: is there any single command available in bitcoin core that is equivalent to `createrawtransaction,signrawtransaction,sendrawtransaction`  
> **username_2**: I am not aware of such a command...  

---

### Answer by username_1 on 2018-01-30. Score: 1

You can use [`signrawtransaction`](https://bitcoin.org/en/developer-reference#signrawtransaction), this method accept an array of private keys as an argument.

Parameter #3—private keys for signing:

> An array holding private keys. *If any keys are provided, only they
> will be used to sign the transaction (even if the wallet has other
> matching keys).* If this array is empty or not used, and wallet support
> is enabled, keys from the wallet will be used

> **Comments:**
> **username_0**: Can you provide me some ways to create txid in rawtransaction  
> **username_1**: @username_0 there is a lot of examples, in [the documentation](https://bitcoin.org/en/developer-reference#rpcs)  

---

