-1

How would I identify a transaction taking in consideration the following

I have a user table holding user datas

++ id  | username | btc_recive_address++
----------------------------------------
++  1  | myuser   | 123kahpoiq31328   ++

order table

 ++ order_id  | user_id | amount
 ---------------------------------
 ++ h6765-a1s | 1       | 0.1 BTC
 ---------------------------------
 ++ kzg765-a1 | 1       | 0.1 BTC

and collector table which retrieves data from bitcoin API( here I identify sender with btc_recive_address)

++ block_chain      | user | amount | timestamp
--------------------------------------------------------------------------------
++ 2d37e5351196...  | 1    | 0.1    | 2014-04-09 16:21:34
--------------------------------------------------------------------------------
++ 123kjhg7231k..   | 1    | 0.1    | 2014-04-08 19:33:56
--------------------------------------------------------------------------------

and I try to assign transaction to order_id like generating a joined view from order and collector table but I have problems when the amount and user is the same

fefe
  • 109
  • 6
  • Can you add the relations between the fields in those table? Or even better the table creation script? – Wizche May 19 '14 at 19:11
  • This question appears to be off-topic because it is about using databases, and not specific to Bitcoin. – Murch May 22 '14 at 09:57
  • @Murch be serious, really? I'm asking about some API stuffs to can build a query. But anyway I will post it somewhere else – fefe May 22 '14 at 10:23
  • I think I had misunderstood your question, and therefore mistakenly voted to close. I am sorry for that, but feel that you are overreacting by being angry and deleting your question. A better course of action would be to discuss such misunderstandings and to improve potentially unclear points in the question. Could you please clarify: What API are you using, is that bitcoind on your own server? Is this all information that you have access to? As you have indicated the combination of user and amount are not unique, it will not be sufficient as a join criteria. – Murch May 22 '14 at 11:10
  • I host the client on the server and I send API requests locally. As a user on order can not send additional information about a transaction I search a way to identify a transactions. At first seems to be ok with the generated BTC recive address but on the flow I met this problem with same amount same user and I don't know if I could use some other things from API to get the desired result – fefe May 22 '14 at 11:16

1 Answers1

0

There doesnt seem to be a relationship between the "collector table" and the "order table" other than the user_id and amount. And as you said, you're having problems there are multiple transactions from the same user for the same amount. So no, this would not be possible without a better relationship to join the tables. Look in to somehow getting a time stamp for the order_id would be the most obvious way to go about resolving this issue. Without providing details as to how exactly you're obtaining this data, no one is really going to be able to help you further.

Also you should really be posting these questions on another StackExchange site, I doubt there are tons of people here with RDBMS/SQL experience.

Matt
  • 419
  • 2
  • 6
  • thanks for feedback I moved the topic here http://stackoverflow.com/questions/23804294/identify-bitcoin-transaction-mysql-query-problems – fefe May 25 '14 at 09:39