/LensExtractScript

A node script to find all Lens in a CSV user addresses

Primary LanguageJavaScript

CSV Data Extraction and Analysis using Alchemy SDK

This repository contains a Node.js script for extracting and analyzing data from a CSV file using the Alchemy SDK, a powerful blockchain development tool. The script is designed to process a CSV file containing Ethereum addresses, retrieve NFT (Non-Fungible Token) information for each address, and save the results in a new CSV file. Table of Contents

Prerequisites
Installation
Configuration
Usage
Understanding the Code
Contributing
License

Prerequisites

Before you can use this script, make sure you have the following prerequisites:

Node.js: This script is built using Node.js, so you must have Node.js installed on your system. You can download it from nodejs.org.

API Key: You will need an API key from Alchemy to access their services. If you don't have one, you can sign up and obtain an API key at alchemyapi.io.

CSV File: Prepare a CSV file with Ethereum addresses. The script will extract NFT information for each address.

Dependencies: This script uses several Node.js libraries. You can install them using npm (Node Package Manager) with the following commands:

bash

npm install fs
npm install csv-parser
npm install csv-writer
npm install alchemy-sdk

Installation

Clone this repository to your local machine or download the script file.

Install the required dependencies as mentioned in the "Prerequisites" section.

Configuration

Before running the script, you need to configure your API key and other parameters. Here's how to do it:

Open the script (index.js) in a code editor.

Replace YOUR_API_KEY_HERE with your actual Alchemy API key:

javascript

const config = {
  apiKey: "YOUR_API_KEY_HERE",
  network: Network.MATIC_MAINNET,
};

Adjust other parameters in the script as needed. For instance, you can customize the input and output CSV file paths, column names, and more.

Usage

To use the script, follow these steps:

Prepare your CSV file with Ethereum addresses. Ensure that it has a header row with column names.

Save the CSV file in the same directory as the script or specify the correct file path in the csvFilePath variable.

Open your terminal and navigate to the directory containing the script.

Run the script using the following command:

bash

node index.js

The script will start reading the CSV file and extracting NFT information for each Ethereum address. The results will be saved in a new CSV file named output.csv.

Once the process is complete, you'll see a message indicating that the CSV file has been written successfully.

Understanding the Code

If you want to understand how the code works in more detail, here are some key points:

The script reads the input CSV file and iterates through the rows, extracting Ethereum addresses.

It uses the Alchemy SDK to fetch NFT information for each Ethereum address, excluding SPAM filters.

The retrieved NFT data is structured and saved in the extractedData array.

Finally, the script writes the extracted data to an output CSV file.

Contributing

Feel free to contribute to this repository by submitting issues, feature requests, or pull requests. Your contributions are welcome. License

This script is open-source and available under the MIT License. You can use and modify it as needed for your projects.

This README should provide a clear and detailed explanation of the script's purpose, prerequisites, configuration, and usage. You can further customize it to include any additional details or instructions specific to your project.