blockchain – Api to mechanically verify the standing of a BTC transaction

0
59


To detect transaction standing in JSON format for the given bitcoin handle on blockchain.data, you’ll be able to observe these steps:

Ship a GET request to the next URL: https://blockchain.data/handle/157vxTThwznZQPGmUuSzqGci5DCZAdRDap?format=json

It will return a JSON object containing details about the given Bitcoin handle, together with the transactions related to it. Search for the “txs” area within the JSON response.

The “txs” area accommodates an array of transaction objects. Every transaction object accommodates a “hash” area that uniquely identifies the transaction, in addition to a “confirmations” area that signifies the variety of confirmations the transaction has acquired. A affirmation happens when a brand new block is added to the blockchain that features the transaction.

If the worth of the “confirmations” area is zero, the transaction is unconfirmed and its standing is pending. If the worth is bigger than zero, the transaction is confirmed and its standing is accomplished.

So, to detect the transaction standing, it’s essential verify the “confirmations” area of every transaction object within the “txs” area. If the “confirmations” area is zero, the transaction is unconfirmed, in any other case, it is confirmed.

  • If you do not have “confirmations” in response. Examine “block_height”, If not current or null the result’s unconfirmed and it is current and has quantity the result’s confirmed.

LEAVE A REPLY

Please enter your comment!
Please enter your name here