Hey everyone...
I'm working on translating some code that relies on an old API into something for a different API service, but I could really use some help understanding what the original code is doing. Here’s the code:
listfile="\n".join(f'wget -qO- https://chain.so/api/v2/get_tx_spent/BTC/{line.rstrip()[:]} > index.data' for line in myfile)
I get that all APIs have their own quirks, but since I can't access the original API documentation, I'm kinda left guessing. So here’s my question: What kind of data is this code trying to pull from the block explorer online?
Is it the transaction hash? Does it pull all transactions for that specific wallet? Or is it just the outputs of certain transactions? Once I figure out what this code is aiming for, I can find a way to replicate that with another API I can actually use.
Would love to hear your thoughts on this. Thanks a ton! m.
Translating old API code
2 replies 418 views
v2 is a deprecated API version on chain.so and the `get_tx_spent` simply return the transactions related to the given address. It is replaced by the `transactions` endpoint like this:
You can see what it returns in the API docs https://chain.so/api/ the old response was similar to this one as well. It did return transaction hashes alongside some other information such as the amount transferred and the signature/witness in that transaction.
Hello pooya87
Thank you, that clarifies everything. Now I'll be able to try to replicate that call from another block explorer because chain.so now charges $150 a month to get an API key...
Related topics
- Bitcoin Core displaying coins (UTXOs) in a new tab 13
- Are you in favor of BIP-110? Let's get a Bitcoin poll going. 0
- Erlay seems to have some issues here’s a better proposal for a bitcoin protocol without invites 3
- New Optional Hourglass Implementation is Live 3
- Ways to earn some sats by contributing to bitcoin core development 5
- Exploring the Potential and Challenges of a Kardashev-Scale Bitcoin Network 3