cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Importing and visualizing transactions

Hi there,

I'm quite new to the neo4j community and environment. I'm currently checking it out because I think neo4j is the solution to my problem.

I want to visualize transaction data of Ethereum. The CSV im using just has 5 columns, From, To, Amount, Date, and TXhash.

The from column has the addres from which it was sent,
the to column has the address to which it was sent,
the amount column has the amount which was sent,
date has the data on which it was sent,
TXhash is an unique identified for the transaction.

I've watched this vid

to lean how to import CSV data, I've managed to import the address, but can't figure out how to create a transaction between the "from" address to the "to" address.

My approach was,

First create a constraint to ensure uniqueness of the addresses with
CREATE CONSTRAINT ON (a:Address) ASSERT a.name IS UNIQUE;

Then I've loaded the CSV data

LOAD CSV WITH HEADER FROM 'file///:data.csv' AS line WITH line LIMIT 1000
MERGE (a:Address {name: line.from})

So now I have all the nodes (addresses), what is the proper way to set a transaction between nodes?

1 REPLY 1

Similar, you just have to find the start and end with MATCH and then create the relationships between them

USING PERIODIC COMMIT
LOAD CSV WITH HEADER FROM 'file///:data.csv' AS line
MERGE (a:Address {name: line.from});
USING PERIODIC COMMIT
LOAD CSV WITH HEADER FROM 'file///:data.csv' AS line
MERGE (a:Address {name: line.to});
USING PERIODIC COMMIT
LOAD CSV WITH HEADER FROM 'file///:data.csv' AS line
MATCH (a:Address {name: line.from})
MATCH (b:Address {name: line.to})
CREATE (a)-[tx:TRANSFERRED]->(b)
SET tx.amount = toFloat(line.amount), tx.date=datetime(line.date), tx.hash=line.txHash;