I wanted to highlight a problem we all suffer from when using third party API's. Let's say you want to make an ethereum transaction. Normally the API will return a txid when the request is successful. But in my example the request has an unknown error. No txid is returned from the API.
When an API call fails for any reason the standard assumption is that the transaction wasn't successful. In my experience with almost every API this assumption is completely wrong. The transaction could still be successful even though the API returns an error. I've seen this multiple times with bitcoind and exchange API's.
So when we receive an error creating a transaction we want to figure out if the transaction was successful or not. Otherwise you might end up sending the transaction multiple times. The problem here is that we don't have a txid to do a simple transaction lookup.
Ideally I want to give my own reference ID with every transaction. This way I don't have to rely on the txid that is given to me by the API. Sadly this isn't a parameter in the current json-rpc API.
I solved this problem in bitcoind by using the "comment" field for my own reference ID. I than iterate through the last X amount of transaction and I try to find a match with the transaction comment and reference ID.
Any suggestions on how to solve this problem with Ethereum?