Coming from ethereum background, I am used to the underlying ethereum tx concept where tx id is not available (returns null) until it is being mined. And after the tx is being mined it have three status which are pending, success and failure, which refers to the transaction state.
Is this the same as bitcoin as I could not see the state of transaction in bitcoin. I can't find any status of the transaction in txid of api returns (i use insight api). How could i ensure that the transaction is in pending/complete state and how can i ensure that the transaction is success or failure. I am thinking of checking 6 confirmations but I don't think that this is a "safe" and proper way as confirmation numbers varies.
To summarize
1) How do i ensure that a transaction is in pending or completed state
2) How do i ensure that a transaction is in success or failure state after completed.
What I did in ethereum to confirm the transaction is completed and success:
1) Keep looping and call the txid api every x seconds to get tx detail until it returns non-null object
2) if it returns an object, i can check the status (which is success or failure) to confirm that the transaction is success.
How it is done in bitcoin way?
Sample output of insights api tx:
{
"txid": "",
"version": 2,
"locktime": 0,
"vin": [
...
],
"vout": [
...
],
"blockhash": "0000000000000000000586ebc988140383fd557f9bbc09ca0ac10cff2cb0fafd",
"blockheight": 525860,
"confirmations": 9,
"time": 1528080051,
"blocktime": 1528080051,
"valueOut": 3.27637624,
"size": 290,
"valueIn": 3.27737624,
"fees": 0.001
}