<p>You almost have it, you just need to make sure you are creating a transaction with an output that your wallet can sign.</p>

<p>Example (on regtest)</p>

<pre><code>bitcoin-cli -regtest addmultisigaddress 2 '["02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d","03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0","0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8"]'
￼
{
  "address": "2NA1HC31wqFexbpp8bGB6rsMR5Lz9SrUKkt",
  "redeemScript": "522102983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d2103548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0210218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa853ae"
}
￼
bitcoin-cli -regtest getnewaddress
￼
2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63
￼
bitcoin-cli -regtest generatetoaddress 110 2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63
￼
[
  "7e974615714bdcee6f4c69ea158b92fe2c0b728742110737e7ff13d9e8eb49ad",
  ...
]
￼
bitcoin-cli -regtest listunspent
￼
[
  ...
  {
    "txid": "9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff",
    "vout": 0,
    "address": "2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63",
    "label": "",
    "redeemScript": "0014821824c23b9c82fa639789bc3314194d1e44ec4a",
    "scriptPubKey": "a914c1499c99d26f5bb7101f1213747bf730c4b9346287",
    "amount": 50.00000000,
    "confirmations": 102,
    "spendable": true,
    "solvable": true,
    "desc": "sh(wpkh([29b8db74/0'/0'/0']03557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee))#25k8n2ql",
    "safe": true
  }
]
￼
bitcoin-cli -regtest createrawtransaction '[{"txid" : "9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff","vout":0}]' '{"2NA1HC31wqFexbpp8bGB6rsMR5Lz9SrUKkt":49.999}'
￼
0200000001ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000000ffffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d48700000000
￼
bitcoin-cli -regtest signrawtransactionwithwallet 0200000001ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000000ffffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d48700000000
￼
{
  "hex": "02000000000101ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000017160014821824c23b9c82fa639789bc3314194d1e44ec4affffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d487024730440220249224a99d24a0ae1d91328ea2e8da0936916ea31a28e35013de003af72f658d02201c48618283ac00a8c5b362e8ade530f4cfacd396a99ab78081cea2d18ad8d165012103557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee00000000",
  "complete": true
}

bitcoin-cli -regtest sendrawtransaction 02000000000101ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000017160014821824c23b9c82fa639789bc3314194d1e44ec4affffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d487024730440220249224a99d24a0ae1d91328ea2e8da0936916ea31a28e35013de003af72f658d02201c48618283ac00a8c5b362e8ade530f4cfacd396a99ab78081cea2d18ad8d165012103557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee00000000

8b0cd4413dad3e1f02f7344236ba4b3d1994c3cd3bbdda1acc9b2d2c0e184453
</code></pre>

CC BY-SA 4.0
2019-07-26T16:23:05.617Z
Thank you very much!! Could you please also tell me what would I do differently if I did not want P2SH but a simple locking script?
Δήμητρα Γεωργίου
CC BY-SA 4.0
2019-07-26T16:37:16.463Z
no problem! I don't think there is a built-in way to do that in Bitcoin Core, you'll have to use createrawtransaction but instead of using address in the output section, use raw hex data that you've created with the raw scripts: https://bitcoincore.org/en/doc/0.18.0/rpc/rawtransactions/createrawtransaction/
JBaczuk
CC BY-SA 4.0
2019-07-26T16:56:00.823Z
so it will be something like this: bitcoin-cli -regtest createrawtransaction "[{\"txid\":\"9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff\",\"vout\":0}]" "[{\"data\":hex}]". Do you also know how would I state the amount of BTC spent and what is this hexadecimal value? Again thank you so much!
Δήμητρα Γεωργίου
CC BY-SA 4.0
2019-07-26T17:03:31.913Z
Yeah, but that's a lot more involved, you could search for how a transaction  is built and how multisig scripts are built
JBaczuk
CC BY-SA 4.0
2019-07-26T14:13:28.917Z
2019-07-26T14:13:28.917Z
JBaczuk
<p>I would like to create a Bitcoin transaction with a single input and a single 2-of-3 multisig output that pays 1 BTC to any 2 of the following 3 keys: 
<em>02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d</em>, <em>03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0</em>, and 
<em>0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8</em>. </p>

<p>I just want a syntactically valid transaction, the reference to the UTXO <strong>does not</strong> have to exist. </p>

<p>Could you please guide me through the steps?</p>

CC BY-SA 4.0
2019-07-26T13:08:10.970Z
are you using the Bitcoin Core cli, or looking for a step by step in terms of how it is done?
JBaczuk
CC BY-SA 4.0
2019-07-26T13:30:18.313Z
Thank you for answering. I tried with bitcoin-cli but I could not continue. I have done this: *createmultisig 2 '["02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d","03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0","0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8"]'......./bitcoind createrawtransaction '[{"txid" : "d6f72aab8ff86ff6289842a0424319bf2ddba85dc7c52757912297f948286389","vout":0}]' '{"3DjMQ5f21bGg2LBhxwHAMW1MzoKH8TJ8eS":1}'*
Δήμητρα Γεωργίου
CC BY-SA 4.0
2019-07-26T13:45:37.560Z
that should work, what is the issue?
JBaczuk
CC BY-SA 4.0
2019-07-26T14:00:35.227Z
I do not know how to continue. I have to sign it then I think but I cannot use signrawtransaction. I have to use another one but I got stuck.
Δήμητρα Γεωργίου
<transactions><raw-transaction><multi-signature>
Create a 2-of-3 multisig raw transaction
Δήμητρα Γεωργίου
# Create a 2-of-3 multisig raw transaction

(Asked by: username_0 on 2019-07-26)

I would like to create a Bitcoin transaction with a single input and a single 2-of-3 multisig output that pays 1 BTC to any 2 of the following 3 keys:
*02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d*, *03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0*, and
*0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8*.

I just want a syntactically valid transaction, the reference to the UTXO **does not** have to exist.

Could you please guide me through the steps?

**Tags:** transactions, raw-transaction, multi-signature

> **Comments:**
> **username_1**: are you using the Bitcoin Core cli, or looking for a step by step in terms of how it is done?  
> **username_0**: Thank you for answering. I tried with bitcoin-cli but I could not continue. I have done this: *createmultisig 2 '["02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d","03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0","0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8"]'......./bitcoind createrawtransaction '[{"txid" : "d6f72aab8ff86ff6289842a0424319bf2ddba85dc7c52757912297f948286389","vout":0}]' '{"3DjMQ5f21bGg2LBhxwHAMW1MzoKH8TJ8eS":1}'*  
> **username_1**: that should work, what is the issue?  
> **username_0**: I do not know how to continue. I have to sign it then I think but I cannot use signrawtransaction. I have to use another one but I got stuck.  

---

## 1 answers

### Answer by username_1 on 2019-07-26. Score: 1 | Accepted answer

You almost have it, you just need to make sure you are creating a transaction with an output that your wallet can sign.

Example (on regtest)

```
bitcoin-cli -regtest addmultisigaddress 2 '["02983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d","03548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0","0218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa8"]'
￼
{
  "address": "2NA1HC31wqFexbpp8bGB6rsMR5Lz9SrUKkt",
  "redeemScript": "522102983a79d2de8e504d00ddd2343b582acef7e17ed91b308ade8dff027a92e7716d2103548ca1916957bc06dd1c6e3639ebf7b2c3c8b1715915433c1d37cab56fb26ef0210218a240a599ba437cb1458966eb456d9f848e5bdef45ea0ee4ec31fc40aa4ffa853ae"
}
￼
bitcoin-cli -regtest getnewaddress
￼
2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63
￼
bitcoin-cli -regtest generatetoaddress 110 2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63
￼
[
  "7e974615714bdcee6f4c69ea158b92fe2c0b728742110737e7ff13d9e8eb49ad",
  ...
]
￼
bitcoin-cli -regtest listunspent
￼
[
  ...
  {
    "txid": "9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff",
    "vout": 0,
    "address": "2NAsEawSCjsjJjtAZcpP9jhXojqNUevjo63",
    "label": "",
    "redeemScript": "0014821824c23b9c82fa639789bc3314194d1e44ec4a",
    "scriptPubKey": "a914c1499c99d26f5bb7101f1213747bf730c4b9346287",
    "amount": 50.00000000,
    "confirmations": 102,
    "spendable": true,
    "solvable": true,
    "desc": "sh(wpkh([29b8db74/0'/0'/0']03557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee))#25k8n2ql",
    "safe": true
  }
]
￼
bitcoin-cli -regtest createrawtransaction '[{"txid" : "9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff","vout":0}]' '{"2NA1HC31wqFexbpp8bGB6rsMR5Lz9SrUKkt":49.999}'
￼
0200000001ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000000ffffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d48700000000
￼
bitcoin-cli -regtest signrawtransactionwithwallet 0200000001ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000000ffffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d48700000000
￼
{
  "hex": "02000000000101ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000017160014821824c23b9c82fa639789bc3314194d1e44ec4affffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d487024730440220249224a99d24a0ae1d91328ea2e8da0936916ea31a28e35013de003af72f658d02201c48618283ac00a8c5b362e8ade530f4cfacd396a99ab78081cea2d18ad8d165012103557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee00000000",
  "complete": true
}

bitcoin-cli -regtest sendrawtransaction 02000000000101ffb0c8cc224b19a22297d5943626246360ee22020c1157f673caced7a598929c0000000017160014821824c23b9c82fa639789bc3314194d1e44ec4affffffff01606b042a0100000017a914b7d6fcff0fe015a393f8baee424ba82c4e18c6d487024730440220249224a99d24a0ae1d91328ea2e8da0936916ea31a28e35013de003af72f658d02201c48618283ac00a8c5b362e8ade530f4cfacd396a99ab78081cea2d18ad8d165012103557ff8751b55175307c0550460694dfe3c84598672fe5b9c53dca71bcb9122ee00000000

8b0cd4413dad3e1f02f7344236ba4b3d1994c3cd3bbdda1acc9b2d2c0e184453

```

> **Comments:**
> **username_0**: Thank you very much!! Could you please also tell me what would I do differently if I did not want P2SH but a simple locking script?  
> **username_1**: no problem! I don't think there is a built-in way to do that in Bitcoin Core, you'll have to use createrawtransaction but instead of using address in the output section, use raw hex data that you've created with the raw scripts: https://bitcoincore.org/en/doc/0.18.0/rpc/rawtransactions/createrawtransaction/  
> **username_0**: so it will be something like this: bitcoin-cli -regtest createrawtransaction "[{\"txid\":\"9c9298a5d7ceca73f657110c0222ee606324263694d59722a2194b22ccc8b0ff\",\"vout\":0}]" "[{\"data\":hex}]". Do you also know how would I state the amount of BTC spent and what is this hexadecimal value? Again thank you so much!  
> **username_1**: Yeah, but that's a lot more involved, you could search for how a transaction  is built and how multisig scripts are built  

---

