Create the Transaction Graph
- Run the following query in the
psqlshell to write the edges file to disk.\COPY (SELECT keyimage_id, output_id FROM xmr_bigraph_edges) TO '/tmp/fork-nonringct-edges-2530000.txt' WITH DELIMITER ' '; - Each row in the
fork-nonringct-edges-2530000.txtfile represents an edge. Thekeyimage_idandoutput_idvalues that represent the edge are index values from the respective PostgreSQL tables. These index values do not form a contiguous range and can have gaps. But the sparse graph representations we will use work better without gaps in the index ranges.- Copy the
fork-nonringct-edges-2530000.txtfile to thescripts/monerodirectory. - Compile the
create_csparse_edges.cppfile located in thescripts/monerodirectory. Run it with the block height as argument.
The output should look like the following.cd scripts/monero g++ -O2 create_csparse_edges.cpp ./a.out 2530000 fork-nonringctReading edge file Finished reading edge file Number of key images: 19443292 Number of outputs: 20800067 Number of vertices: 40243359 Number of edges: 44196439 Creating keyimage index map Finished creating keyimage index map Creating output index map Finished creating output index map Adding edges to graph Finished adding edges to graph - Three output files are created.
-
fork-nonringct-csparse-edges-2530000.txtThe edges in this file are represented as pairs of indices starting from 0 followed by a 1. This is the CSparse format for representing sparse matrices. The 1 corresponds to the value of the matrix entry. In our case, we use this format to represent sparse bipartite graphs.
-
fork-nonringct-index-keyimageid-map-2530000.txtThis file has pairs of indices and key image IDs per line. It is to translate the result of the transaction graph analysis back to the key image ID space.
-
fork-nonringct-index-outputid-map-2530000.txtThis file has pairs of indices and output IDs per line. It is to translate the result of the transaction graph analysis back to the output ID space.
-
- Copy the