<p>I lost my guest session but I figured out the problem. </p>

<p>jsonRPCClient was not providing me any useful information as an output so serching Stack Exchange I was able to find somebody who changed the JSON library to output a useful error code.</p>

<pre>
    Add *'ignore_errors' => true* to the $opts array
    Change the error line that throws Request error to read throw new Exception('Request error: '.$response['error']['code'].' - '.$response['error']['message']);.
</pre>

<p>Then the output said that I was inputting a string and I should be inputting an array. So all I had to do, was put all the public keys into an array and plug it into the createmultisig function.</p>

<pre>
$pubkey_str = array();

$pubkey_str[] = "02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6";

$pubkey_str[] = "02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3";


$create_multisig = $bitcoin->createmultisig (2,$pubkey_str);
var_dump($create_multisig);
</pre>

<p>and this was the output</p>

<pre>
array(2) { ["address"]=> string(35) "2MtXTzX7pASPKr8VKmkyWKRNFt2o1oFxi9K" ["redeemScript"]=> string(142) "522102e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f62102f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c352ae"
</pre>

<p>Which is exactly what I expected. So maybe it was a stupid mistake on my behalf, but hopefully other people can benefit from it. </p>

CC BY-SA 3.0
2014-02-19T19:08:44.630Z
2014-02-21T13:43:04.827Z
2014-02-21T13:43:04.827Z
Bitcoin Dev Wannabee
<p>I am using bitcoind 0.8.5 with JSON to try and implement multisignature addresses locally on my server. 
But when I try and create one from my code, it keeps returning FALSE.</p>

<p><code>
$create_multisig = $bitcoin->createmultisig (2, '[ "02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6", "02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3"]');</p>

<p>var_dump($create_multisig);
</code></p>

<p>I have tried variations of the quotes, I tried putting the public keys into variables, etc.. Can somebody tell me what I am doing wrong here? It won't create the multisignature address. </p>

<p>EDIT:</p>

<p><code>
$pubkey_str = "";</p>

<p>$pubkey_str .= "\"02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6\",";</p>

<p>$pubkey_str .= "\"02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3\",";</p>

<p>$pubkey_str = substr($pubkey_str, 0, (strlen($pubkey_str)-1));</p>

<p>$pubkey_input = "'[$pubkey_str]'";</p>

<p>var_dump($pubkey_input);</p>

<p>$create_multisig = $bitcoin->addmultisigaddress (2, $pubkey_input);</p>

<p>var_dump($create_multisig);
</code></p>

<p>And the resulting output</p>

<p><code>
string(141) "'["02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6","02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3"]'" </p>

<p>bool(false) 
</code></p>

<multi-signature>
Bitcoin CreateMultiSig in PHP always returning FALSE
Bitcoin Dev Wannabee
# Bitcoin CreateMultiSig in PHP always returning FALSE

(Asked by: username_0 on 2014-02-19)

I am using bitcoind 0.8.5 with JSON to try and implement multisignature addresses locally on my server.
But when I try and create one from my code, it keeps returning FALSE.

`$create_multisig = $username_0->createmultisig (2, '[ "02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6", "02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3"]');`

var\_dump($create\_multisig);

I have tried variations of the quotes, I tried putting the public keys into variables, etc.. Can somebody tell me what I am doing wrong here? It won't create the multisignature address.

EDIT:

`$pubkey_str = "";`

$pubkey\_str .= "\"02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6\",";

$pubkey\_str .= "\"02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3\",";

$pubkey\_str = substr($pubkey\_str, 0, (strlen($pubkey\_str)-1));

$pubkey\_input = "'[$pubkey\_str]'";

var\_dump($pubkey\_input);

$create\_multisig = $username_0->addmultisigaddress (2, $pubkey\_input);

var\_dump($create\_multisig);

And the resulting output

`string(141) "'["02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6","02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3"]'"`

bool(false)

**Tags:** multi-signature


---

## 1 answers

### Answer by username_0 on 2014-02-19. Score: 1

I lost my guest session but I figured out the problem.

jsonRPCClient was not providing me any useful information as an output so serching Stack Exchange I was able to find somebody who changed the JSON library to output a useful error code.

```

    Add *'ignore_errors' => true* to the $opts array
    Change the error line that throws Request error to read throw new Exception('Request error: '.$response['error']['code'].' - '.$response['error']['message']);.

```

Then the output said that I was inputting a string and I should be inputting an array. So all I had to do, was put all the public keys into an array and plug it into the createmultisig function.

```

$pubkey_str = array();

$pubkey_str[] = "02e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f6";

$pubkey_str[] = "02f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c3";

$create_multisig = $username_0->createmultisig (2,$pubkey_str);
var_dump($create_multisig);

```

and this was the output

```

array(2) { ["address"]=> string(35) "2MtXTzX7pASPKr8VKmkyWKRNFt2o1oFxi9K" ["redeemScript"]=> string(142) "522102e280809f7a7e0fabb7404d68ef89b66e9cf63ecfffd37ef2c78d06c51d2247f62102f22be70ae35432c82e7b05846eeab1fec5b09ebe523bb98d6d6bbf1ff29d96c352ae"

```

Which is exactly what I expected. So maybe it was a stupid mistake on my behalf, but hopefully other people can benefit from it.


---

