Welcome to Langchain, a powerful tool for building AI models to analyze smart contracts and scrape data on vulnerabilities. This README will guide you through the process of setting up the Langchain environment, utilizing open-source data sources such as Spearbit and ConsenSys, and combining them into a vector database. Additionally, we'll explore the integration of the FAISS search engine by Facebook for efficient querying.
P.S This was done a year ago, and I forgotten to upload this repo, do update if required! (Decided to release to public if you want to play around)
Before you begin, ensure that you have the following installed on your machine:
- Python 3.x
- Pip (Python package installer)
- Git
-
Clone the Langchain repository to your local machine:
git clone https://github.com/your-username/langchain.git
-
Navigate to the Langchain project directory:
cd langchain -
Install the required Python packages:
pip install -r requirements.txt
Langchain leverages open-source data on vulnerabilities, including Spearbit and ConsenSys. Ensure that you have access to these datasets or replace them with your preferred data sources.
Visit the Spearbit GitHub repository to obtain the latest version of the Spearbit dataset. Follow the provided instructions to download and preprocess the data.
Explore the ConsenSys GitHub repository for smart contract vulnerability data. Download and preprocess the ConsenSys dataset according to the provided guidelines.
Combine the processed data from Spearbit and ConsenSys into a unified vector database. Use the provided scripts in the data_processing directory to achieve this.
python data_processing/combine_data.pyLangchain employs the FAISS search engine by Facebook for efficient and fast vector searches. Follow these steps to integrate FAISS into your project:
-
Download and install FAISS from the official GitHub repository.
-
Integrate FAISS into your Langchain project by updating the necessary configurations in the
config.yamlfile. -
Implement FAISS-based search functionality using the provided scripts in the
faiss_integrationdirectory.
Execute the Langchain AI model to analyze smart contracts and detect vulnerabilities:
python langchain_model.pyWe welcome contributions from the community! If you discover issues or have suggestions for improvements, please open a GitHub issue or submit a pull request.
Langchain acknowledges and appreciates the contributions of the open-source communities behind Spearbit, ConsenSys, and FAISS.
Happy coding! 🚀