MySQL view to identify a transaction with retrived API datas

-1

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

Posted 2014-05-19T08:38:59.550

Reputation: 109

Can you add the relations between the fields in those table? Or even better the table creation script?Wizche 2014-05-19T19:11:04.553

This question appears to be off-topic because it is about using databases, and not specific to Bitcoin.Murch 2014-05-22T09:57:52.733

@Murch be serious, really? I'm asking about some API stuffs to can build a query. But anyway I will post it somewhere elsefefe 2014-05-22T10:23:18.437

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 2014-05-22T11:10:05.847

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 resultfefe 2014-05-22T11:16:44.333

Answers

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

Posted 2014-05-19T08:38:59.550

Reputation: 409

thanks for feedback I moved the topic here http://stackoverflow.com/questions/23804294/identify-bitcoin-transaction-mysql-query-problems

fefe 2014-05-25T09:39:45.270