<pre><code>ECKey keyA = &lt;something&gt;
ECKey keyB = &lt;something&gt;
ECKey keyC = &lt;something&gt;

Transaction aTransaction = new Transaction(params);
List&lt;ECKey&gt; keyList = ImmutableList.of(keyA, keyB, keyC);


Script script = ScriptBuilder.createMultiSigOutputScript(2, keyList); //2 of 3 multisig
Coin value = Coin.valueOf(0,10); // 0.1 btc
aTransaction.addOutput(value, script);
Wallet.SendRequest request = Wallet.SendRequest.forTx(aTransaction.addOutput);
wallet.completeTx(request); // fill in coins
</code></pre>

<p>See mikes <a href="http://bitcoinj.github.io/working-with-contracts#creating-multi-signature-outputs" rel="nofollow">documentation</a></p>

CC BY-SA 3.0
2015-06-26T11:24:42.363Z
http://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions

I want to create multisignature Address using private key
how can i secure Wallet with that
user27079
CC BY-SA 3.0
2015-12-08T08:27:14.403Z
Thanks for the code. Can you please also do it without the wallet contraption?
Jus12
CC BY-SA 3.0
2015-06-25T11:36:22.283Z
2015-06-25T11:36:22.283Z
Jonas Schnelli
<p>you have an exemple in bitcoinj documentation :</p>

<p><a href="https://bitcoinj.github.io/working-with-contracts" rel="nofollow">https://bitcoinj.github.io/working-with-contracts</a></p>

<p>Let’s see how to do it:</p>

<pre><code>// Create a random key.
ECKey clientKey = new ECKey();
// We get the other parties public key from somewhere ...
ECKey serverKey = new ECKey(null, publicKeyBytes);

// Prepare a template for the contract.
Transaction contract = new Transaction(params);
List&lt;ECKey&gt; keys = ImmutableList.of(clientKey, serverKey);
// Create a 2-of-2 multisig output script.
Script script = ScriptBuilder.createMultiSigOutputScript(2, keys);
// Now add an output for 0.50 bitcoins that uses that script.
Coin amount = Coin.valueOf(0, 50);
contract.addOutput(amount, script);

// We have said we want to make 0.5 coins controlled by us and them.
// But it's not a valid tx yet because there are no inputs.
Wallet.SendRequest req = Wallet.SendRequest.forTx(contract);
wallet.completeTx(req);   // Could throw InsufficientMoneyException

// Broadcast and wait for it to propagate across the network.
// It should take a few seconds unless something went wrong.
peerGroup.broadcastTransaction(req.tx).get();
</code></pre>

CC BY-SA 3.0
2016-02-05T21:14:04.733Z
2016-02-05T21:14:04.733Z
Badr Bellaj
<p>Can somebody help me with step-by-step list of how to create a multi signature 2-of-3 transaction using bitcoinj api?</p>

<bitcoinj>
Bitcoinj How to create multi-signature address using bitcoinj
user27079
# Bitcoinj How to create multi-signature address using bitcoinj

(Asked by: username_0 on 2015-06-25)

Can somebody help me with step-by-step list of how to create a multi signature 2-of-3 transaction using bitcoinj api?

**Tags:** bitcoinj


---

## 2 answers

### Answer by username_1 on 2015-06-25. Score: 3 | Accepted answer

```
ECKey keyA = <something>
ECKey keyB = <something>
ECKey keyC = <something>

Transaction aTransaction = new Transaction(params);
List<ECKey> keyList = ImmutableList.of(keyA, keyB, keyC);

Script script = ScriptBuilder.createMultiSigOutputScript(2, keyList); //2 of 3 multisig
Coin value = Coin.valueOf(0,10); // 0.1 btc
aTransaction.addOutput(value, script);
Wallet.SendRequest request = Wallet.SendRequest.forTx(aTransaction.addOutput);
wallet.completeTx(request); // fill in coins

```

See mikes [documentation](http://bitcoinj.github.io/working-with-contracts#creating-multi-signature-outputs)

> **Comments:**
> **username_0**: http://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions  I want to create multisignature Address using private key how can i secure Wallet with that  
> **username_2**: Thanks for the code. Can you please also do it without the wallet contraption?  

---

### Answer by username_3 on 2016-02-05. Score: 2

you have an exemple in bitcoinj documentation :

<https://bitcoinj.github.io/working-with-contracts>

Let’s see how to do it:

```
// Create a random key.
ECKey clientKey = new ECKey();
// We get the other parties public key from somewhere ...
ECKey serverKey = new ECKey(null, publicKeyBytes);

// Prepare a template for the contract.
Transaction contract = new Transaction(params);
List<ECKey> keys = ImmutableList.of(clientKey, serverKey);
// Create a 2-of-2 multisig output script.
Script script = ScriptBuilder.createMultiSigOutputScript(2, keys);
// Now add an output for 0.50 bitcoins that uses that script.
Coin amount = Coin.valueOf(0, 50);
contract.addOutput(amount, script);

// We have said we want to make 0.5 coins controlled by us and them.
// But it's not a valid tx yet because there are no inputs.
Wallet.SendRequest req = Wallet.SendRequest.forTx(contract);
wallet.completeTx(req);   // Could throw InsufficientMoneyException

// Broadcast and wait for it to propagate across the network.
// It should take a few seconds unless something went wrong.
peerGroup.broadcastTransaction(req.tx).get();

```


---

