Author

Topic: Outdated API code translation (Read 85 times)

jr. member
Activity: 34
Merit: 2
May 17, 2024, 04:57:18 PM
#3
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...
legendary
Activity: 3472
Merit: 10611
May 16, 2024, 10:50:58 PM
#2
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:
Code:
/api/v3/transactions/{{network}}/{{address}}/{{page}}
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.
jr. member
Activity: 34
Merit: 2
May 16, 2024, 07:55:45 PM
#1
Hi y'all ...

So I am trying to convert some code that uses an outdated API to any other API service but I need some help desciphering what the original code is intending to do, so here it is:


listfile="\n".join(f'wget -qO- https://chain.so/api/v2/get_tx_spent/BTC/{line.rstrip()[:]} > index.data' for line in myfile)




So I know all APIs are different, but not having access to the original API documents I am having to guess (here it is my question): What data is the code trying to access from the online block explorer?


Is it the transaction hash? is it all transactions for that wallet? is it outputs of transactions? When I know what the code is tring to find, Ill be able to replicate that for another API that I actually have access to.

Please give me your reading of it. many thanks. m.
Jump to: