andrewhong5297 / blocknative_stream_to_sql

template for getting your mempool subscription into a sqlite database for further data analysis and stuff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting Started

Make sure to use this repo as a template, click that big green button at the top right.

  1. Create a subscription and filters in mempool explorer for the addresses you want to track. The docs explain filters well (careful about specific versus global)
  2. Setup your sqlite db or whatever other preferred data storage you want with express (backend.js). You will need a POST endpoint later for the mempool to stream data to, have it just console.log(req.body) for now.
  3. Add in ngrok to your express app, make sure to run ngrok authtoken before you run node server/backend.js.
  4. Start up your ngrok + express server with node server/backend.js
  5. Go to your local ngrok dashboard and copy the https link of the public ngrok link found under the inspect tab.
  6. Then go to blocknative accounts page and use that link (and be sure to add the POST endpoint to the end of the link) to create a webhook following this gif tutorial. Instead of the address added in the tutorial, add whichever address you want to track. This should match with the ones you already created subscriptions and filters for in step 1.
  7. Use newest db explorer for sqlite here and check the sqlite db to see if everything is working (for me that was running SELECT * FROM mempool). You will need to adjust the CREATE and INSERT statements for the variables you want to parse from the POST request.
  8. ???
  9. profit

If you have any issues with the connection, use the inspect tab of the ngrok dashboard to see what is going wrong.

Feel free to open any issues or dm me on twitter (same username) if you have any questions.

About

template for getting your mempool subscription into a sqlite database for further data analysis and stuff


Languages

Language:JavaScript 100.0%