graphsense / graphsense-REST

A REST service for accessing cryptocurrency data stored in Apache Cassandra.
MIT License
10 stars 8 forks source link

Expose tx_list field in cluster_outgoing_relations #61

Closed myrho closed 2 years ago

myrho commented 2 years ago

ISSUE COPIED FROM FORKED REPO

FORMER AUTHOR: MatteoRomiti CREATED AT: 2020-10-22T06:54:06Z

The tx_list field in cluster_outgoing_relations is currently not exposed. We need it exposed to be able to quickly show the list of txs between two clusters in the dashboard.

myrho commented 2 years ago

FORMER COMMENT BY behas created at 2021-09-14T16:16:21Z:

(at)defconst how much effort (space / time) would it be to store up to X (e.g., 100) transaction IDs with each relation? It is important to get from entity relations to transactions, just as we do it for the address-to-address relations. I am considering to include this in the upcoming release.

(at)myrho any issues on the REST-level?

myrho commented 2 years ago

FORMER COMMENT BY myrho created at 2020-11-16T15:34:05Z:

Yes, that would be also possible. But it'd be nicer to have the address and cluster links views consistent.

Here is the cassandra error when querying transaction details of a tx_list with more than one item (it works if there is just one tx though):

Cannot restrict clustering columns by IN relations when a collection is selected by the query

I've reproduced the query in the mockup database:

cqlsh:btc_raw> select * from transaction where tx_prefix in ('ab188', 'ab118') and tx_hash in (0xab1880, 0xab188013); InvalidRequest: Error from server: code=2200 [Invalid query] message=\"Cannot restrict clustering columns by IN relations when a collection is selected by the query\"

Any ideas what's wrong?

myrho commented 2 years ago

FORMER COMMENT BY MatteoRomiti created at 2020-11-16T14:37:31Z:

Why is it not allowed to get a tx through IN? I remember I once managed to use it in a similar context.

Anyway, wouldn't it be enough to list the hashes of the txs and then the user can click one of them and see the details? The goal of this feature is not to provide a complete and detailed view of all the txs, but rather to have at least one pointer to link two clusters.

myrho commented 2 years ago

FORMER COMMENT BY defconst created at 2020-11-16T14:21:30Z:

However, for clusters we don't have a cluster_transactions table yet.

clusterTransactions is computed in Spark, but not written to Cassandra

myrho commented 2 years ago

FORMER COMMENT BY myrho created at 2020-11-16T14:11:36Z:

There is a problem:

The transactions between to addresses are fetched by:

  1. get tx_list from address_outgoing_relations of address A
  2. get transactions from address_transactions with address = addressA and tx_list IN the list obtained in step1
  3. make the same requets for addressB
  4. merge the two sets

However, for clusters we don't have a cluster_transactions table yet. I've tried to get the transaction data from raw.transaction but it is not allowed to do get transaction through IN:

python query = \"SELECT tx_list FROM cluster_outgoing_relations WHERE \" \ \"src_cluster_group = %s AND src_cluster = %s AND \" \ \"dst_cluster = %s\" results = session.execute(query, [entity_id_group, entity, neighbor]) if not results.current_rows: return []

    txs = [tx_hash for tx_hash in
           results.current_rows[0].tx_list]
    txs_prefix = [tx_hash.hex()[:TX_PREFIX_LENGTH] for tx_hash in txs]

    session = self.get_session(currency, 'raw')
    # TODO does not work!
    query = \"SELECT * FROM transaction WHERE \" \
            \"tx_prefix IN %s AND tx_hash IN %s\"
    results = session.execute(query, [ValueSequence(txs_prefix),
                                      ValueSequence(txs)])

What can, should we do about this? (at)graphsense/core-developers