3

I'm building an app to display information pertaining to individual Bitcoin addresses.

I've been using the blockchain.info API to get data regarding the final_balance, total_received, and total_sent.

But I'm having a little trouble figuring out how to retrieve data on transaction fees.

Looking at the json when querying an address (for example 1CK6KHY6MHgYvmRQ4PAafKYDrg1ejbH1cE) I'm assuming I would need to iterate through the hash of transactions it returns, and use the hash of the transaction with the value "result" > 0?

I'm just not certain how to differentiate between spending and receiving when looking at the json.

1

The API blockchain.info provides for the address details does a ton of processing at it's backend (by accessing the blockchain for which they must have maintained a separate db for quick fetches). As far as the transaction fee is concerned, it can be calculated by finding the difference in the inputs and outputs of a transaction. This is somewhat tricky because the vin (input) for any transaction points to the output of another transaction. But the point being you can find the difference and the transaction fee.

I suggest you query the blockchain using the core Bitcoin API and maintain your own database as per your convenience. The blockchain.info API is kind of a dependency for the app and if their server goes down, so does your app. So maintaining a custom formatted data on your side is a good way to go and also ensures responsiveness.

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.