Bitcoin Forum
May 24, 2024, 03:10:54 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to determine the sender of BTC through an API  (Read 241 times)
echozzi (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
April 20, 2020, 11:28:18 AM
 #1

Assuming I was expecting two BTC transactions of the same amount from different wallet addresses. is there an available API I can use to check which of the two addresses made the transaction?
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
April 20, 2020, 02:55:34 PM
 #2

Blockcypher API includes the "sender's" address in its API response.
for example from the last block:
https://api.blockcypher.com/v1/btc/main/txs/499003ee50065a93bd786f792e3f72f99c8d308940fa1e5937178650a6a80fa2?limit=50

the "1ArgjWtWL8a2yshyeJUqtTtqgqKpZFGst5" is the sender's address. you will find each address in "inputs" list under "addresses" of that input.

ps. if the payment that you receive is important you may want to start running your own full node or at least an SPV node instead of relying on centralized services such as blockchain APIs.

There is a FOMO brewing...
echozzi (OP)
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
April 20, 2020, 03:07:45 PM
 #3

Thank you so much and our reply was helpful. However, assuming I wanted using a script on chron, to check for transations in my wallet from an address, can that be possible?
TryNinja
Legendary
*
Offline Offline

Activity: 2842
Merit: 7040


Crypto Swap Exchange


View Profile WWW
April 20, 2020, 04:47:33 PM
 #4

Thank you so much and our reply was helpful. However, assuming I wanted using a script on chron, to check for transations in my wallet from an address, can that be possible?
You could, for example, hit Blockcypher's address API endpoint[1] to get the latest transaction and then use it to hit the endpoint posted above to get the data you need. Then do the rest of the handling on your code.

[1] https://api.blockcypher.com/v1/btc/main/addrs/1ArgjWtWL8a2yshyeJUqtTtqgqKpZFGst5

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
BrewMaster
Legendary
*
Offline Offline

Activity: 2114
Merit: 1292


There is trouble abrewing


View Profile
April 20, 2020, 05:04:25 PM
 #5

Thank you so much and our reply was helpful. However, assuming I wanted using a script on chron, to check for transations in my wallet from an address, can that be possible?
You could, for example, hit Blockcypher's address API endpoint[1] to get the latest transaction and then use it to hit the endpoint posted above to get the data you need. Then do the rest of the handling on your code.

[1] https://api.blockcypher.com/v1/btc/main/addrs/1ArgjWtWL8a2yshyeJUqtTtqgqKpZFGst5

the main problem is parsing the JSON response that the API sends back which would require additional libraries that are designed to do that, and i don't think it is possible to do this with a simple script.

There is a FOMO brewing...
TryNinja
Legendary
*
Offline Offline

Activity: 2842
Merit: 7040


Crypto Swap Exchange


View Profile WWW
April 20, 2020, 06:08:32 PM
 #6

the main problem is parsing the JSON response that the API sends back which would require additional libraries that are designed to do that, and i don't think it is possible to do this with a simple script.
Not really. You can parse a JSON response with pretty much every existing programming language (python, js, php, etc...) without any additional library.

█▀▀▀











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











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
odolvlobo
Legendary
*
Offline Offline

Activity: 4326
Merit: 3235



View Profile
April 21, 2020, 07:25:42 AM
 #7

I don't know what your goal is, but it might be useful to remember that bitcoins don't have to come from an address. Also, expecting bitcoins to come from a particular address might be problematic because the sending wallet generally decides which address(es) to use.

Join an anti-signature campaign: Click ignore on the members of signature campaigns.
PGP Fingerprint: 6B6BC26599EC24EF7E29A405EAF050539D0B2925 Signing address: 13GAVJo8YaAuenj6keiEykwxWUZ7jMoSLt
lucasholder
Jr. Member
*
Offline Offline

Activity: 38
Merit: 19


View Profile WWW
April 22, 2020, 12:23:23 PM
 #8

Thank you so much and our reply was helpful. However, assuming I wanted using a script on chron, to check for transations in my wallet from an address, can that be possible?
You could, for example, hit Blockcypher's address API endpoint[1] to get the latest transaction and then use it to hit the endpoint posted above to get the data you need. Then do the rest of the handling on your code.

[1] https://api.blockcypher.com/v1/btc/main/addrs/1ArgjWtWL8a2yshyeJUqtTtqgqKpZFGst5

the main problem is parsing the JSON response that the API sends back which would require additional libraries that are designed to do that, and i don't think it is possible to do this with a simple script.

If you're writing a shell script, you can use the jq tool for parsing the response and extracting the field(s) you want: https://stedolan.github.io/jq/tutorial/
Initscri
Hero Member
*****
Offline Offline

Activity: 1554
Merit: 759


View Profile WWW
April 24, 2020, 10:20:30 AM
 #9

Thank you so much and our reply was helpful. However, assuming I wanted using a script on chron, to check for transations in my wallet from an address, can that be possible?

You're probably best mentioning the programming language you plan on using for this (whether it be PHP, python etc) and then we'll go from there. Many of us can provide examples of something that could technically be run automatically every x minutes.

----------------------------------
Web Developer. PM for details.
----------------------------------
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!