Recommended way to automatically retry sending of bitcoin via JSONRPC upon failure

1

Sometimes when sending bitcoin out, sometimes bitcoind's JSON-RPC replies with a 500 error. I'd like to safely automatically retry, but it seems that there's not way to set a nonce to safely retry.

I have some complicated ideas to be able to retry in a safe way, but I imagine something like the nonce is easiest. Any safe ways to retry out there?

Ramon Tayag

Posted 2019-02-05T05:02:57.273

Reputation: 321

Answers

0

  1. Try to figure out why you get an http error 500. Check your debug.log, double-check the command you're sending that causes the 500. Try to solve it.

  2. After you sent your Bitcoins or got an error, check if the desired recipient has been payed by fetching your wallet transactions and parsing it after the recipient and eventually the amount. Use listsinceblock or listtransactions. Eventually use the txid for performance from a successful sendrawtransaction (or send* command). Use time-range in case you reuse addresses.

  3. Make sure you flag your transaction as "sent" (in your application / user-flow logic) when you can fetch it over the listcommands (see 2.)

  4. Re-creating the payment transaction in case of a sudden crash or shutdown of your system may be done by forging, signing and sending the transaction again.

Jonas Schnelli

Posted 2019-02-05T05:02:57.273

Reputation: 5 465