MrBe-lo MrBe-lo -4 years ago 66
PHP Question

Signing bitcoin on blockcypher : "error": "Not enough signatures: 0 for 1 inputs"

I'm using blockcypher to make transactions. I've followed all the necessary steps but when I try and send the transaction I get back an error message, " error: Not enough signatures: 0 for 1 inputs".

Signer (tosign & private key)

go run signer.go 697817584637d858b16ceb4dbecddfb7afc2da67992263ccffa2891bf69bb229 8f16d5bae3c2e4b6923d5a7da8194088f1813f5b22900b9a648d7ef8a38d0be0

Output Signature

3044022005b5ee7e4bac8a16a1ed59b4132a5ed51633718425b2813430bff0dbf238b35602203b3345c013f0f6555b029bed886ace99cbf416300d6007775d8a4772205e5a0b


Bitcoin Sender Information

private key:8f16d5bae3c2e4b6923d5a7da8194088f1813f5b22900b9a648d7ef8a38d0be0, public key:029602113dd7851c8095434c4019258462aa30c16df6d146b9c4d039f1c5392f03,
address: mzrycPJMEjQ4WNv7rZVZepb6Lse63Xt4Ue,
wif: cSNrA5tkpCpRLdXHrSy3mYdWRWPGFTYd53Z9tERz5DSprUx7JGZM


Bitcoin Receiver Information

private key:f392289723ef4a6dfef8fef7a76daea1cce8c572ed73d3b05e15271bfae70a01, public key:020e3dc996e6cab4df26770b01b8f135322de2ef52c0b394e5c49dcf981d700db7,
address: mmzsfMgMk4hejzv5ahuQULnMGQC4n7Wm3H,
wif: cVkAus4uxWXhvcJVKovCj9Fpx2U2rftq7QVBU2vDsbQoZuwirtu9


Sending Transaction

curl -d '{
"tx": {
"block_height": -1,
"block_index": -1,
"hash": "f54241d7525acba9d1a2ba270c9e1627810676a95909f0d1c7f800dde1b33adf",
"addresses": [
"mzrycPJMEjQ4WNv7rZVZepb6Lse63Xt4Ue",
"mmzsfMgMk4hejzv5ahuQULnMGQC4n7Wm3H"
],
"total": 300400,
"fees": 99600,
"size": 119,
"preference": "high",
"relayed_by": "158.223.165.35",
"received": "2017-06-11T16:21:01.407862694Z",
"ver": 1,
"lock_time": 0,
"double_spend": false,
"vin_sz": 1,
"vout_sz": 2,
"confirmations": 0,
"inputs": [
{
"prev_hash": "d2cb465b74e3f57d64b584962ee557d9a623d38befd570e14686438cc25279ee",
"output_index": 0,
"script": "",
"output_value": 400000,
"sequence": 4294967295,
"addresses": [
"mzrycPJMEjQ4WNv7rZVZepb6Lse63Xt4Ue"
],
"script_type": ""
}
],
"outputs": [
{
"value": 10,
"script": "76a914471888d19d0148ab072d3707712e8de8f4dc724788ac",
"addresses": [
"mmzsfMgMk4hejzv5ahuQULnMGQC4n7Wm3H"
],
"script_type": "pay-to-pubkey-hash"
},
{
"value": 300390,
"script": "76a914d433cec679da5579b3fff61eefbb0ce70ae9221a88ac",
"addresses": [
"mzrycPJMEjQ4WNv7rZVZepb6Lse63Xt4Ue"
],
"script_type": "pay-to-pubkey-hash"
}
]
},
"tosign": [
"697817584637d858b16ceb4dbecddfb7afc2da67992263ccffa2891bf69bb229"
]
}, "tosign": [ "697817584637d858b16ceb4dbecddfb7afc2da67992263ccffa2891bf69bb229" ], "signatures": ["3044022005b5ee7e4bac8a16a1ed59b4132a5ed51633718425b2813430bff0dbf238b35602203b3345c013f0f6555b029bed886ace99cbf416300d6007775d8a4772205e5a0b"], "pubkeys": ["029602113dd7851c8095434c4019258462aa30c16df6d146b9c4d039f1c5392f03" ] }' https://api.blockcypher.com/v1/btc/test3/txs/send?token=fcd13b49d1a4469e865707205e2022bc


I used my own token, but I've censored it for this post.

If someone is able to help with this issue I would appreciate it highly.

Answer Source

Looks like there's something wrong with your JSON document. The signatures and pubkeys arrays should be at the same level as the "tosign" we return. What you posted is actually invalid JSON, there's another "tosign" with the signatures and pubkeys outside of the main document. Looks like you just did an append. Should be something like:

{
  "tx": { ... },
  "tosign": ["..."],
  "pubkeys": ["..."],
  "signatures": ["..."]
}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download