Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txs/new; inputs->addresses is must pay-to-pubkey-hash address? #395

Open
ddswez opened this issue Jun 19, 2022 · 3 comments
Open

txs/new; inputs->addresses is must pay-to-pubkey-hash address? #395

ddswez opened this issue Jun 19, 2022 · 3 comments

Comments

@ddswez
Copy link

ddswez commented Jun 19, 2022

When i use the api:
https://api.blockcypher.com/v1/btc/test3/txs/new
If the parameter looks like that, the result is normal
{ "inputs": [{ "addresses": [ "mhCcmGJ8dFzenpz9p4DQM8gWHW62LNPUzN" ] }], "outputs": [{ "addresses": [ "2N8SH6dNdfi6T4UeATox4NsU7eJ3s3ZmTTj" ], "value": 10 }] }

** 1. An error will be reported if I change the inputs address to pay-to-script-hash address**

request:
{"inputs":[{"addresses": ["2N8SH6dNdfi6T4UeATox4NsU7eJ3s3ZmTTj"]}],"outputs":[{"addresses":["mhCcmGJ8dFzenpz9p4DQM8gWHW62LNPUzN"], "value": 10}]}

response:
"errors": [
    {
      "error": "Error building input: Cannot use P2SH as input without 'script_type' set to 'multisig-n-of-m'"
    },
    {
      "error": "Not enough funds in 1 inputs to pay for 1 outputs, missing -10."
    },
    {
      "error": "Not enough funds after fees in 0 inputs to pay for 1 outputs, missing -8810."
    },
    {
      "error": "Error validating generated transaction: Transaction missing input or output."
    }
  ]

** 2. Then I try to add “script_type” to the argument and still get an error.**

reqest:
{"inputs":[{"addresses": ["2N8SH6dNdfi6T4UeATox4NsU7eJ3s3ZmTTj"],"script_type": "pay-to-script-hash"}],"outputs":[{"addresses":["mhCcmGJ8dFzenpz9p4DQM8gWHW62LNPUzN"], "value": 10}]}

response:
{
  "errors": [
    {
      "error": "Error building input: Cannot use P2SH as input without 'script_type' set to 'multisig-n-of-m'"
    },
    {
      "error": "Not enough funds in 1 inputs to pay for 1 outputs, missing -10."
    },
    {
      "error": "Not enough funds after fees in 0 inputs to pay for 1 outputs, missing -8810."
    },
    {
      "error": "Error validating generated transaction: Transaction missing input or output."
    }
  ],
  "tx": {
    "block_height": -1,
    "block_index": -1,
    "hash": "8d9346abe91b6dfe9f57df853bfe38309749b1dad36a9ef3410aa450b539746b",
    "addresses": [
      "mhCcmGJ8dFzenpz9p4DQM8gWHW62LNPUzN"
    ],
    "total": 10,
    "fees": 0,
    "size": 44,
    "vsize": 44,
    "preference": "low",
    "relayed_by": "39.108.86.138",
    "received": "2022-06-19T13:50:35.870756092Z",
    "ver": 1,
    "double_spend": false,
    "vin_sz": 0,
    "vout_sz": 1,
    "confirmations": 0,
    "inputs": [],
    "outputs": [
      {
        "value": 10,
        "script": "76a914127875f1bfeef15a909066fe7827970fb7abdbc188ac",
        "addresses": [
          "mhCcmGJ8dFzenpz9p4DQM8gWHW62LNPUzN"
        ],
        "script_type": "pay-to-pubkey-hash"
      }
    ]
  }
}

I wonder if the API input parameter does not support p2sh addresses. Or I sent the wrong parameters
thank you

@08epouu1
Copy link

0x5601d6fb7290c1C7D289ca165c3eE01cb891bAE2

@DERDBJJ
Copy link

DERDBJJ commented Aug 15, 2023

Mda

@ngn999
Copy link

ngn999 commented Mar 15, 2024

Same error here.
Even more, this API can't handle p2tr utxo:

curl -X POST -d '{"inputs":[{"addresses": ["tb1pt9xcq7n5tx5kvxy2z8gnesm45gjlf2wna63semweds54u8alaqaq7w0tla"]}],"outputs":[{"addresses": ["tb1q8386hk4jkjt9yp9ukpu9pd59vw0nmz50nl59w4"], "value": 1000}]}' 'https://api.blockcypher.com/v1/btc/test3/txs/new'
error code: 502%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@ngn999 @ddswez @08epouu1 @DERDBJJ and others