blockchain / service-my-wallet-v3

Blockchain Wallet API Service
https://blockchain.info/api/blockchain_wallet_api
GNU Affero General Public License v3.0
912 stars 520 forks source link

unexpected error #309

Open nshkg opened 6 years ago

nshkg commented 6 years ago

Service v0.26.0, Node v8.5.0

Hi. i use service for create wallet and many another operation. But when i try to make payment i receive

console 1514135112779 - error: [object Object]

http_resp

500: 
{
    "error": "Unexpected error, please try again"
}

my request http://localhost:8000/merchant/:guid/payment?password=:password&api_code=:api_key&to=:dest_addr&amount=1000

how can i fix it?

thongtd commented 6 years ago

I got same issue. How can i fix. Thanks

gyanjaiswal commented 6 years ago

I got same issue when i send BTC . How can i fix. please help me

diabolusss commented 6 years ago

Hello to everyone. I struggled with this error a lot like you do. Official support is poor, actually it doesn't help even if they answers. So, after a bunch of experiments we have found out that this error is thrown in multiple situations. However, we have experimented only with outgoing payments, so this observations are true at least for them. 1) Like @Lillojohn said in related post when doing outgoing payment you must define "from" parameter, too. Yes, i know that in API description it's optional:

http://localhost:3000/merchant/$guid/payment?password=$main_password&second_password=$second_password&to=$address&amount=$amount&from=$from&fee=$fee

$main_password Your Main Blockchain Wallet password $second_password Your second Blockchain Wallet password if double encryption is enabled. $to Recipient Bitcoin Address. $amount Amount to send in satoshi. > $from Send from a specific Bitcoin Address (Optional) $fee Transaction fee value in satoshi (Must be greater than default fee) (Optional)

In real life it's not. At least for now.

2) Interesting thing about this parameter is that only its index lead to a successful transaction, not an address or xpub.

3) And, of course, index you set must have enough(amount + static\dynamic fee) currency for a successful transaction.

4) For example, if your super account($guid) have multiple sub accounts with shared currency between them and you want\need to send all currency you have somewhere else - you can't do that in one transaction. Instead, you must handle each separate sub account using its index.

5) Low transaction amount value causes this error, too. I've found that that happens for values below 550 satoshies.

6) Low fee value causes "Error signing and pushing transaction" error. This value is dynamic, but i caught it for values below 250 satoshies.

7) If sub account index doesn't exist you will get "Error building transaction" error. For example, you have 1 sub account and you pass "from":1. Remember indexing starts with 0.

8) Instead of setting "fee" you can set "fee_per_byte".

Final conclusion is that blockchain.info service is highly unstable and i wouldn't recommend to use it.

Related: #306, #314, #306, #296, ...

yagamidev commented 6 years ago

@diabolusss Hey Please what do you recommend to use then ? Thnks

diabolusss commented 6 years ago

 @yagamidev Sorry, I have had no options and was forced to use it, so i haven't actually searched for alternatives. But, if we have had investigated it  more deeply at first place, then i think that this problem would have been avoided. At this point  i can recommend you to search for alternative that have active official support, i.e. support that answers on questions fast enough and answers thoughtfully. Good luck.  

----- Reply to message ----- Subject: Re: [blockchain/service-my-wallet-v3] unexpected error (#309) Date: 2 марта 2018 г., 11:52:33 From: yagamidev notifications@github.com To: blockchain/service-my-wallet-v3 service-my-wallet-v3@noreply.github.com

/<![CDATA[/ p.c1 {color: #666; font-size: small} /]]>/

@diabolusss Hey Please what do you recommend to use then ? Thnks

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/blockchain/service-my-wallet-v3","title":"blockchain/service-my-wallet-v3","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/blockchain/service-my-wallet-v3"}},"updates":{"snippets":[{"icon":"PERSON","message":"@yagamidev in #309: @diabolusss Hey\r\nPlease what do you recommend to use then ?\r\nThnks"}],"action":{"name":"View Issue","url":"https://github.com/blockchain/service-my-wallet-v3/issues/309#issuecomment-369875696"}}}

 

yagamidev commented 6 years ago

Alight. Thanks you though, we can even think that the support of this project is you :smile:

yagamidev commented 6 years ago

Hey, @diabolusss When I run the stuff on localhost I don't get error anymore for paymentn but when I Run the service on a VPS and try to use it with the ip I set, then I get the error, you know why ? THnks

diabolusss commented 6 years ago

First of all you should be more descriptive, i.e. run service with log level debug and provide it's output. How do you make request, where from... I have found that the easiest way for testing requests is using browser plugin - "Restlet Client REST API TESTING". Just to avoid possible bugs in api.

 

yagamidev commented 6 years ago

Its output is " error: [object Object] " I make the request from my local machine using a form (A web application ). When submitting the form, the request is now send to the service running on the VPS, and it ouput the error mentioned above. But when I run the service on my local machine ie http://localhost:3000/merchant .... and submit the form the payment went well.

diabolusss commented 6 years ago

Have you added VPS real wold ip to Blockhain wallet whitelist? If not then it could be the cause. If that wouldn't help you then try to run request directly from VPS machine(it would be localhost then) and start service in debug mode if you haven't done that already.   

 

RScottLewis commented 5 years ago

Enable API Access by way of enabling IP Restrictions and whitelisting your ip address. And, don't miss the from field. These two thing fixed it for me. curl http://localhost:3030/merchant/myguid/payment?password=myPass\&to=1LxbAcXSdzZwKGgypV5UFa1CQ9wyJEPenK\&amount=20000\&from=0

najeh22 commented 5 years ago

How many I have coin

kennethdlai commented 5 years ago

??

yoryi commented 4 years ago

subi mi servicio heroku pero no me funciona obtengo estos errores. alguien me puede ayudar?

Captura de Pantalla 2020-07-15 a la(s) 10 37 40 p  m