<p>I am getting this error "Not enough signatures: 1 for 2 inputs" always while using create transaction API for BTC,LTC,DASH.</p>

<p>Before few days ago its was working fine. But Now I am getting Error After hitting transaction.</p>

<p>Please Help me out from this.</p>

<p>Response from API:-</p>

<pre><code>{
  "tx": {
    "block_height": -1,
    "block_index": -1,
    "hash": "ccfd3d55f02db753ccd29b0a3a648d409bc974dd2f24bbcc3c07e5a9362813bb",
    "addresses": [
      "1vkfV2m6C6r9dbkbXCpv8Fg2jugXJarm1",
      "1EdZpspFLCu6YvcAbtPsQCe2tP2JyhpxTy"
    ],
    "total": 10000,
    "fees": 26300,
    "size": 126,
    "preference": "high",
    "relayed_by": "35.177.118.140",
    "received": "2019-08-02T06:13:34.972349221Z",
    "ver": 1,
    "double_spend": false,
    "vin_sz": 2,
    "vout_sz": 1,
    "confirmations": 0,
    "inputs": [
      {
        "prev_hash": "261be3b9c33523078ca92b67c48d1f1dfb60e37749982a6a965ebae62812bb36",
        "output_index": 1,
        "output_value": 6300,
        "sequence": 4294967295,
        "addresses": [
          "1vkfV2m6C6r9dbkbXCpv8Fg2jugXJarm1"
        ],
        "script_type": "pay-to-pubkey-hash",
        "age": 587750
      },
      {
        "prev_hash": "dc0856ee2eb1c019dbd8b979059c86c448d13fb401c5ba68e190c19d5c112b25",
        "output_index": 0,
        "output_value": 30000,
        "sequence": 4294967295,
        "addresses": [
          "1vkfV2m6C6r9dbkbXCpv8Fg2jugXJarm1"
        ],
        "script_type": "pay-to-pubkey-hash",
        "age": 587872
      }
    ],
    "outputs": [
      {
        "value": 10000,
        "script": "76a914958402d8b99f6a3a3e9a252c3c7e9c07ca9840da88ac",
        "addresses": [
          "1EdZpspFLCu6YvcAbtPsQCe2tP2JyhpxTy"
        ],
        "script_type": "pay-to-pubkey-hash"
      }
    ]
  },
  "tosign": [
    "015327ccd713ab76908cbf5631efe1f3f63a5622abb6bff91e14269cd6252cdb",
    "2daa5d0565e6c1df62705b0b6a34cf38221fca5cd123c2c2cf7e0af866d67ed7"
  ],
  "signatures": [
    ""
  ],
  "pubkeys": [
    ""
  ]
}
stdClass Object ( [error] =&gt; Not enough signatures: 1 for 2 inputs )
</code></pre>

<p><strong><em>Please check the code :-</em></strong></p>

<pre><code>$sell_btcbt = '10000';//10000
$sellbtcadd='1EdZpspFLCu6YvcAbtPsQCe2tP2JyhpxTy';
$btccurrentaddress = '13WMhJwu4FUmz3HjXrB3MWZ3TDstdcHe3L';
    $transact_data = '{"inputs":[{"addresses": ["'. $btccurrentaddress .'"]}],"outputs":[{"addresses": ["'. $sellbtcadd .'"], "value": '.$sell_btcbt.'}]}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.blockcypher.com/v1/btc/main/txs/new?token=1a9daeb78d924879a1d5a84391b6daef&amp;sd=");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $transact_data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
$blockcypher_tx1 = curl_exec($ch);

$blockcypher_tx =(json_decode($blockcypher_tx1));
    if($blockcypher_tx == '' || empty($blockcypher_tx)){
    echo 'Error on creating blockcypher transaction';
    die;
}

$to_sign1 = $blockcypher_tx-&gt;tosign[0];
$private_key = '';
$cmd = getcwd()."/signer $to_sign1 $private_key"; 
exec($cmd,$output);
$esda_sign = isset($output[0]) ? $output[0] : "jhkgdjhkfgkdgsklhsdjkghdfhgjkhdfjghjkdfghhdfjklghjklfghldfhgjkdfhgjkdfhgjkdfhgkfhjgklhfjkghjkdfhg";
if($esda_sign == 0){
echo json_encode(array('resp' =&gt; 'Error', 'msg' =&gt; 'Error to create signature'));
die;
}
$blockcypher_tx-&gt;signatures[] = $esda_sign;
$blockcypher_tx-&gt;pubkeys[]= '';
$final_string = json_encode($blockcypher_tx,TRUE);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.blockcypher.com/v1/btc/main/txs/send?token=1a9daeb78d924879a1d5a84391b6daef&amp;sd=");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $final_string); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     
$push_response = curl_exec($ch);
$push_response = json_decode($push_response);
print_R($push_response);
</code></pre>

<p>Thanks in Advance. </p>

CC BY-SA 4.0
2019-07-31T08:39:57.290Z
Can you give a minimal reproducible example?
vincenzopalazzo
CC BY-SA 4.0
2019-08-02T06:16:02.333Z
please check the response above in query.I post all the response from API.
Nandni
CC BY-SA 4.0
2019-08-02T08:38:08.877Z
I think the problem is in the code for creating the transaction, can you post it?
vincenzopalazzo
CC BY-SA 4.0
2019-08-02T09:37:03.967Z
please check  code  above  using curl method I am hitting this api.
Nandni
CC BY-SA 4.0
2019-08-02T12:26:02.220Z
Can You please correct me if I am wrong in code.Please check the code in Above query.
Nandni
CC BY-SA 4.0
2019-08-02T12:38:18.067Z
I'm looking [this example](https://www.blockcypher.com/dev/bitcoin/data/samples/create-tx.html) and the your code is the same, right?
vincenzopalazzo
CC BY-SA 4.0
2019-08-02T12:55:36.130Z
i'm using curl with php in above code.
Nandni
CC BY-SA 4.0
2019-08-02T18:39:12.150Z
Sorry I don't know PHP and for run your code I have a need on the token, I hope the example help you
vincenzopalazzo
CC BY-SA 4.0
2019-08-05T07:59:01.090Z
Thanks for your response.I find the solution.Now my code is working.
Nandni
CC BY-SA 4.0
2019-08-05T15:49:04.443Z
I'm happy for you, if you post your solution in the answer you can help some people with the same problem
vincenzopalazzo
<api><createrawtransaction><blockcypher>
Issue while using create transaction API of blockcypher?
Nandni
# Issue while using create transaction API of blockcypher?

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

I am getting this error "Not enough signatures: 1 for 2 inputs" always while using create transaction API for BTC,LTC,DASH.

Before few days ago its was working fine. But Now I am getting Error After hitting transaction.

Please Help me out from this.

Response from API:-

```
{
  "tx": {
    "block_height": -1,
    "block_index": -1,
    "hash": "ccfd3d55f02db753ccd29b0a3a648d409bc974dd2f24bbcc3c07e5a9362813bb",
    "addresses": [
      "1vkfV2m6C6r9dbkbXCpv8Fg2jugXJarm1",
      "1EdZpspFLCu6YvcAbtPsQCe2tP2JyhpxTy"
    ],
    "total": 10000,
    "fees": 26300,
    "size": 126,
    "preference": "high",
    "relayed_by": "35.177.118.140",
    "received": "2019-08-02T06:13:34.972349221Z",
    "ver": 1,
    "double_spend": false,
    "vin_sz": 2,
    "vout_sz": 1,
    "confirmations": 0,
    "inputs": [
      {
        "prev_hash": "261be3b9c33523078ca92b67c48d1f1dfb60e37749982a6a965ebae62812bb36",
        "output_index": 1,
        "output_value": 6300,
        "sequence": 4294967295,
        "addresses": [
          "1vkfV2m6C6r9dbkbXCpv8Fg2jugXJarm1"
        ],
        "script_type": "pay-to-pubkey-hash",
        "age": 587750
      },
      {
        "prev_hash": "dc0856ee2eb1c019dbd8b979059c86c448d13fb401c5ba68e190c19d5c112b25",
        "output_index": 0,
        "output_value": 30000,
        "sequence": 4294967295,
        "addresses": [
          "1vkfV2m6C6r9dbkbXCpv8Fg2jugXJarm1"
        ],
        "script_type": "pay-to-pubkey-hash",
        "age": 587872
      }
    ],
    "outputs": [
      {
        "value": 10000,
        "script": "76a914958402d8b99f6a3a3e9a252c3c7e9c07ca9840da88ac",
        "addresses": [
          "1EdZpspFLCu6YvcAbtPsQCe2tP2JyhpxTy"
        ],
        "script_type": "pay-to-pubkey-hash"
      }
    ]
  },
  "tosign": [
    "015327ccd713ab76908cbf5631efe1f3f63a5622abb6bff91e14269cd6252cdb",
    "2daa5d0565e6c1df62705b0b6a34cf38221fca5cd123c2c2cf7e0af866d67ed7"
  ],
  "signatures": [
    ""
  ],
  "pubkeys": [
    ""
  ]
}
stdClass Object ( [error] => Not enough signatures: 1 for 2 inputs )

```

***Please check the code :-***

```
$sell_btcbt = '10000';//10000
$sellbtcadd='1EdZpspFLCu6YvcAbtPsQCe2tP2JyhpxTy';
$btccurrentaddress = '13WMhJwu4FUmz3HjXrB3MWZ3TDstdcHe3L';
    $transact_data = '{"inputs":[{"addresses": ["'. $btccurrentaddress .'"]}],"outputs":[{"addresses": ["'. $sellbtcadd .'"], "value": '.$sell_btcbt.'}]}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.blockcypher.com/v1/btc/main/txs/new?token=1a9daeb78d924879a1d5a84391b6daef&sd=");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $transact_data); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
$blockcypher_tx1 = curl_exec($ch);

$blockcypher_tx =(json_decode($blockcypher_tx1));
    if($blockcypher_tx == '' || empty($blockcypher_tx)){
    echo 'Error on creating blockcypher transaction';
    die;
}

$to_sign1 = $blockcypher_tx->tosign[0];
$private_key = '';
$cmd = getcwd()."/signer $to_sign1 $private_key"; 
exec($cmd,$output);
$esda_sign = isset($output[0]) ? $output[0] : "jhkgdjhkfgkdgsklhsdjkghdfhgjkhdfjghjkdfghhdfjklghjklfghldfhgjkdfhgjkdfhgjkdfhgkfhjgklhfjkghjkdfhg";
if($esda_sign == 0){
echo json_encode(array('resp' => 'Error', 'msg' => 'Error to create signature'));
die;
}
$blockcypher_tx->signatures[] = $esda_sign;
$blockcypher_tx->pubkeys[]= '';
$final_string = json_encode($blockcypher_tx,TRUE);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.blockcypher.com/v1/btc/main/txs/send?token=1a9daeb78d924879a1d5a84391b6daef&sd=");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");                                                                     
curl_setopt($ch, CURLOPT_POSTFIELDS, $final_string); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     
$push_response = curl_exec($ch);
$push_response = json_decode($push_response);
print_R($push_response);

```

Thanks in Advance.

**Tags:** api, createrawtransaction, blockcypher

> **Comments:**
> **username_1**: Can you give a minimal reproducible example?  
> **username_0**: please check the response above in query.I post all the response from API.  
> **username_1**: I think the problem is in the code for creating the transaction, can you post it?  
> **username_0**: please check  code  above  using curl method I am hitting this api.  
> **username_0**: Can You please correct me if I am wrong in code.Please check the code in Above query.  
> **username_1**: I'm looking [this example](https://www.blockcypher.com/dev/bitcoin/data/samples/create-tx.html) and the your code is the same, right?  
> **username_0**: i'm using curl with php in above code.  
> **username_1**: Sorry I don't know PHP and for run your code I have a need on the token, I hope the example help you  
> **username_0**: Thanks for your response.I find the solution.Now my code is working.  
> **username_1**: I'm happy for you, if you post your solution in the answer you can help some people with the same problem  

---

## 0 answers

