Hi folks, I'm working on a small project which requires me to get all transaction data for an address and separate the TX's into incoming (receiving), and outgoing (sending).
To get the TX's, I'm using the API at
https://www.blocktrail.com/api/docs#api_data. However, I noticed that when getting the TX's they are not separated by incoming and outgoing, so I had to devise some kind of sorting algorithm to separate them.
I came up with this:
Assuming we are looking at the transactions in/out of address X.
Assuming that an address that is not X, is "foreign"
A TX is "sent" if there is no foreign addresses in the inputs.
A TX is "received" if X doesn't appear in the inputs.
This seems to be working for the most part, but I'm getting some transactions that don't fall into these categories. Clearly, there is still a lot for me to learn about bitcoin TX's.
Some examples of these 'weird' TXs:
3418d6bdc26f43aa0cce0bf3c07d0a91f2e052f520db1f0b244938d2b8b6ff7f
d6437de71f1b5a331eb728e64ff6a36eb48bcf224973e28359ef218a530a1e6c
7b0b9486c0df9692f6b038da2c647d94793d08a0252ea0c460ee77b38ed47d1f
It looks like the block explorer considers these all being "sent", but I've never seen transactions like these before. What are these? And does anyone have some better definitions for sent/received transactions?
Thank you