Create Edges Table

  1. Run the following commands to enter the psql shell (if you are not already inside it).
    sudo su postgres
    psql
    
  2. Create the xmr_bigraph_edges table by running ONLY ONE of the following queries. These queries consider transactions upto block height 1541236.
    • Run the following query to consider all outputs (RingCT and pre-RingCT).
      CREATE TABLE xmr_bigraph_edges AS SELECT xk.id as keyimage_id, xo.id as output_id, xo.amount as output_amount, xo.index as output_index FROM (SELECT id, ring_amount, UNNEST(ring_indices) AS index FROM xmr_keyimages WHERE block_height <= 1541236) AS xk INNER JOIN xmr_outputs xo ON xk.ring_amount = xo.amount AND xk.index = xo.index;
      
    • To consider only RingCT outputs, run the following query. The difference from the previous query is the ring_amount = 0 clause.
      CREATE TABLE xmr_bigraph_edges AS SELECT xk.id as keyimage_id, xo.id as output_id, xo.amount as output_amount, xo.index as output_index FROM (SELECT id, ring_amount, UNNEST(ring_indices) AS index FROM xmr_keyimages WHERE ring_amount = 0 AND block_height <= 1541236) AS xk INNER JOIN xmr_outputs xo ON xk.ring_amount = xo.amount AND xk.index = xo.index;