0

i am having a trouble with bitcoind REST API endpoint for retrieving transaction info. According to the documentation it should return confirmations among the retrieved data. But my bitcoind do not have this present in the response. I have rest=1 and txindex=1 so everything probably should be ok.

I have picked a random txid to demonstrate the response

This is what i got from the REST API tx endpoint ( with truncated vin/vout ):

{
    "hash": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e", 
    "vout": [ ... ], 
    "weight": 896, 
    "hex": "0100000001e96d13340057a99320702b9482a93114fb7ed0d27345242dd61a6ba967fe70a5010000006b483045022100833c21acd4e87aec7f794804606ef1699db2a5cc420f80af500243a43970cb8a0220617b9f55e2c6383f3093a4683af9fcdaad668b66e942553a6928b07e241141120121035deb8e150be5ccbfcca2a978d9bc3e2990afb61d08b49ce0494f39b10173c828ffffffff02dc9b68000000000017a91418b3b7d346e3f32cc4b3e0617fdf61e23d5ea2cc87cc8e6f1a000000001976a9140ae8e97489b9412f3f2ca6a63882f762174b368788ac00000000", 
    "blockhash": "0000000000000000000d5cfef192ed15ed37881cd5f0930d5613ac92a6b1b6e6", 
    "vin": [ ... ], 
    "txid": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e", 
    "version": 1, 
    "locktime": 0, 
    "vsize": 224, 
    "size": 224
}

And this is what i got from the bitcoin-cli getrawtransaction 669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e 1 ( with truncated vin/vout ):

{
  "txid": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e",
  "hash": "669a1302ee3ccb482cc545f56cca9112a2d24a7959f1da18f87603640ff9288e",
  "version": 1,
  "size": 224,
  "vsize": 224,
  "weight": 896,
  "locktime": 0,
  "vin": [ ... ],
  "vout": [ ... ],
  "hex": "0100000001e96d13340057a99320702b9482a93114fb7ed0d27345242dd61a6ba967fe70a5010000006b483045022100833c21acd4e87aec7f794804606ef1699db2a5cc420f80af500243a43970cb8a0220617b9f55e2c6383f3093a4683af9fcdaad668b66e942553a6928b07e241141120121035deb8e150be5ccbfcca2a978d9bc3e2990afb61d08b49ce0494f39b10173c828ffffffff02dc9b68000000000017a91418b3b7d346e3f32cc4b3e0617fdf61e23d5ea2cc87cc8e6f1a000000001976a9140ae8e97489b9412f3f2ca6a63882f762174b368788ac00000000",
  "blockhash": "0000000000000000000d5cfef192ed15ed37881cd5f0930d5613ac92a6b1b6e6",
  "confirmations": 5,
  "time": 1558449750,
  "blocktime": 1558449750
}

Is there something i am doing wrong that I do not get the confirmations from the REST API endpoint as said in docs?

Bitcoind version v0.17.0.0

0

The documentation is incorrect. confirmations, time and blocktime are not fields in the output of the rest API. You aren't doing anything wrong; those fields don't exist.

  • 1
    Thanks a lot Andrew. I thought so, but I had to ask. If I may have one more question, do you know about a way to get transaction confirmation via REST API? Most probably there is no way, but anyway .. – Jakub May 22 at 8:53
  • You can look up the blockhash with the rest API and it will tell you the number of confirmations for that block. The transaction will then also have the same number of confirmations. .. The rest API should probably be changed to match getrawtransaction. – Andrew Chow May 22 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.