hexonaut / bitcoin-transaction

Send Bitcoins from one wallet to another. This is designed to be as simple to use as possible.
MIT License
50 stars 37 forks source link

Internal Server Error #18

Open RTISCOOL opened 5 years ago

RTISCOOL commented 5 years ago

When trying to send a transaction I am getting the error: Error: Internal Server Error(…)

Here is my code:

All variables resolve to their proper values (e.g. privKeyWIF, $("#sendAddress").val(), db.get("address"))

bitcoinTransaction.sendTransaction({ from: db.get("address"), to: $("#sendAddress").val(), privKeyWIF: privKeyWIF, btc: btcAmount, network: "mainnet", fee: "halfHour" }).catch(function(error) { console.log(error) if(error == "You do not have enough in your wallet to send that much."){ alert("You are sending more than you have! \n (Keep in mind you need to supply a miner fee)") clearSend(); setError(); }else if(error == "BitCoin amount must be larger than the fee. (Ideally it should be MUCH larger)"){ alert("You are not sending enough! (Bitcoin amount is smaller than the fee!)") clearSend(); setError(); }else{ alert("There was an error sending your transaction. Please try again later.") clearSend(); setError(); } }).then(function() { if(!getError()){ console.log("transaction sent;") alert("The transaction has been sent successfully. \n It should be confirmed within the next few minutes.") clearSend() } });

hexonaut commented 5 years ago

Sounds like an issue with one of the providers. Since these are free Bitcoin services, they may not be fully reliable. Look at the network tab in Chrome developer tools and find which request is failing. There should be requests to:

providers.fees.mainnet.earn;
providers.utxo.mainnet.blockexplorer;
providers.pushtx.mainnet.blockchain;
RTISCOOL commented 5 years ago

Should I switch them all to their second option?

hexonaut commented 5 years ago

I would first see which one is the problem then yes try the secondary option. If it is the fees endpoint then unfortunately there is only one endpoint for that one. You can override the automatic fee calculation by setting a number measured in sats / byte if that is the case.