Bitcoin Forum
December 14, 2024, 12:29:28 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Outdated API code translation  (Read 85 times)
mahurovihamilo (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 2


View Profile
May 17, 2024, 12:55:45 AM
 #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.
pooya87
Legendary
*
Offline Offline

Activity: 3668
Merit: 11107


Crypto Swap Exchange


View Profile
May 17, 2024, 03:50:58 AM
Merited by NeuroticFish (2)
 #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.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
mahurovihamilo (OP)
Jr. Member
*
Offline Offline

Activity: 34
Merit: 2


View Profile
May 17, 2024, 09: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...
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!