Create the Transaction Graph
- Create the edges file using the following steps
- Run the following commands to enter the
psql
shell.sudo su postgres psql
- Run the following query to write the edges file to disk.
\COPY (SELECT keyimage_id, output_id FROM xmr_bigraph_edges) TO '/tmp/edges-1541236.txt' WITH DELIMITER ' ';
- Run the following commands to enter the
- Each row in the
edges-1541236.txt
file represents an edge. Thekeyimage_id
andoutput_id
values 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
edges-1541236.txt
file to thescripts/monero
directory. - Compile the
create_csparse_edges.cpp
file located in thescripts/monero
directory. 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 1541236
Reading edge file Finished reading edge file Number of key images: 23164745 Number of outputs: 25126033 Number of vertices: 48290778 Number of edges: 58791856 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.
-
csparse-edges-1541236.txt
The 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.
-
index-keyimageid-map-1541236.txt
This 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.
-
index-outputid-map-1541236.txt
This 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