{"id":23541703,"url":"https://github.com/icefirelabs/sovereignaisearch-oasis-protocol","last_synced_at":"2025-08-05T23:17:35.938Z","repository":{"id":260107488,"uuid":"880275237","full_name":"IceFireLabs/SovereignAISearch-oasis-Protocol","owner":"IceFireLabs","description":"SovereignAISearch empowers users with complete control over AI search results, ensuring decentralized storage and privacy.","archived":false,"fork":false,"pushed_at":"2024-12-02T14:58:18.000Z","size":13623,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T04:35:11.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IceFireLabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-29T12:43:39.000Z","updated_at":"2024-12-14T10:50:10.000Z","dependencies_parsed_at":"2024-12-26T05:28:04.947Z","dependency_job_id":"743ae344-0d25-4d0a-a86e-7fcf4ec80a29","html_url":"https://github.com/IceFireLabs/SovereignAISearch-oasis-Protocol","commit_stats":null,"previous_names":["blockcraftsman/sovereignsearch-oasis-protocol","icefirelabs/sovereignaisearch-oasis-protocol","blockcraftsman/sovereignaisearch-oasis-protocol"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/IceFireLabs/SovereignAISearch-oasis-Protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceFireLabs%2FSovereignAISearch-oasis-Protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceFireLabs%2FSovereignAISearch-oasis-Protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceFireLabs%2FSovereignAISearch-oasis-Protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceFireLabs%2FSovereignAISearch-oasis-Protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IceFireLabs","download_url":"https://codeload.github.com/IceFireLabs/SovereignAISearch-oasis-Protocol/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IceFireLabs%2FSovereignAISearch-oasis-Protocol/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268987962,"owners_count":24340777,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-26T05:28:05.495Z","updated_at":"2025-08-05T23:17:30.890Z","avatar_url":"https://github.com/IceFireLabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SovereignAISearch-oasis-Protocol\n\n## Project Description\nSovereignAISearch-oasis-Protocol is a decentralized AI search protocol designed to provide users with a secure, privacy-preserving, and personalized search experience. The protocol leverages smart contracts and blockchain technology to ensure that user search data is not collected and exploited by centralized entities, while delivering efficient and AI-driven search results.\n\nSovereignAISearch-oasis-Protocol represents a paradigm shift in search technology, prioritizing user data sovereignty and privacy through smart contracts and blockchain technology. This next-generation search engine empowers users with control over their information and offers an efficient, secure, and AI-driven search solution.\n\n## Key Features\n- **Decentralized AI Search**: Utilizes blockchain technology to provide a trustless AI search service, ensuring the security and privacy of user data.\n- **Smart Contract Support**: Manages search requests and results through smart contracts, ensuring transparent and tamper-proof search records.\n- **User CIDS Management**: Users can add and manage their own CIDS (Content Identifier Strings) and use these identifiers in their searches.\n- **Multi-Author Support**: Supports multiple authors to set and view their own messages, ensuring the diversity and credibility of information.\n- **Advanced AI Capabilities**: Leverages AI to analyze user behavior and preferences, offering highly personalized search results.\n- **Decentralized Storage**: Ensures user data sovereignty by storing search data across a decentralized network using the Storcha platform.\n\n\n## Smart Contract Architecture\n\n### Overview\nThe `SovereignAISearchStorage` smart contract is designed to manage user profiles and search history securely and efficiently. The contract ensures that user data is stored and retrieved in a decentralized manner, maintaining user privacy and data sovereignty.\n\n### Architecture Diagram\n```mermaid\nflowchart TB\n    subgraph Contract[\"SovereignAISearchStorage\"]\n        direction TB\n        \n        subgraph DataStructures[\"Data Structures\"]\n            SR[SearchResult Struct]\n            UP[UserProfile Struct]\n        end\n\n        subgraph Mappings[\"Storage Mappings\"]\n            M1[userProfiles]\n            M2[userSearchHistory]\n        end\n\n        subgraph Functions[\"Public Functions\"]\n            F1[createUserProfile]\n            F2[storeSearchResult]\n            F3[getSearchHistory]\n            F4[getRecentSearches] \n            F5[getUserStats]\n            F6[searchHistoryByKeyword]\n        end\n\n        subgraph Events[\"Events\"]\n            E1[SearchResultStored]\n            E2[UserProfileCreated]\n        end\n\n        subgraph Internal[\"Internal\"]\n            I1[contains function]\n        end\n    end\n\n    User((User)) --\u003e F1 \u0026 F2 \u0026 F3 \u0026 F4 \u0026 F5 \u0026 F6\n    \n    F1 --\u003e M1\n    F2 --\u003e M2\n    F3 --\u003e M2\n    F4 --\u003e M2\n    F5 --\u003e M1\n    F6 --\u003e M2\n    F6 --\u003e I1\n```\n\n### Detailed Architecture\n\n#### UserProfile Mapping\n- **UserProfile**: Stores user-specific information such as search count, user status, and last search timestamp.\n- **Mapping**: Maps user addresses to their respective `UserProfile` structs.\n\n#### SearchResult Mapping\n- **SearchResult**: Stores individual search results, including query, result hash CID, timestamp, encryption status, encryption key, and search score.\n- **Mapping**: Maps user addresses to arrays of `SearchResult` structs, representing the user's search history.\n\n#### Events\n- **SearchResultStored**: Emitted when a new search result is stored, capturing the user address, query, and timestamp.\n- **UserProfileCreated**: Emitted when a new user profile is created, capturing the user address and timestamp.\n\n#### Modifiers\n- **onlyActiveUser**: Ensures that only active users can perform certain actions, such as storing search results or retrieving search history.\n\n#### Functions\n- **createUserProfile**: Allows users to create a new profile, initializing their search count, status, and last search timestamp.\n- **storeSearchResult**: Enables users to store new search results, updating their search history and profile statistics.\n- **getSearchHistory**: Retrieves paginated search history for the user, based on page size and page number.\n- **getRecentSearches**: Retrieves the most recent search results for the user, based on the specified count.\n- **getUserStats**: Retrieves the user's search statistics, including total searches and last search timestamp.\n- **searchHistoryByKeyword**: Searches the user's search history for results containing a specific keyword.\n- **contains**: A helper function to check if a string contains a substring, used for keyword search functionality.\n\n### Workflow Description\n\n```mermaid\nflowchart TB\n    Start(Start) --\u003e CreateProfile[Create User Profile]\n    CreateProfile --\u003e ProfileCheck{Profile exists?}\n    ProfileCheck --\u003e|No| Initialize[Initialize Profile\u003cbr\u003eSet active status\u003cbr\u003eReset counters]\n    ProfileCheck --\u003e|Yes| Error[Return Error]\n    Initialize --\u003e Ready[Profile Ready]\n    \n    Ready --\u003e Operations[User Operations]\n    \n    Operations --\u003e Store[Store Search Result]\n    Store --\u003e ValidateUser{User Active?}\n    ValidateUser --\u003e|Yes| SaveSearch[Save Search Data\u003cbr\u003eUpdate Profile Stats]\n    ValidateUser --\u003e|No| AccessDenied[Access Denied]\n    \n    Operations --\u003e Retrieve[Retrieve History]\n    Retrieve --\u003e R1[Get Search History\u003cbr\u003ePaginated Results]\n    Retrieve --\u003e R2[Get Recent Searches\u003cbr\u003eLatest Results]\n    \n    Operations --\u003e Search[Search by Keyword]\n    Search --\u003e MatchResults[Match Keyword\u003cbr\u003ein History]\n    \n    Operations --\u003e Stats[Get User Stats]\n    Stats --\u003e ReturnStats[Return Search Count\u003cbr\u003e\u0026 Last Search Time]\n    \n    SaveSearch --\u003e EmitEvent[Emit SearchResultStored]\n    Initialize --\u003e EmitProfile[Emit UserProfileCreated]\n\n    style Start fill:#f9f,stroke:#333\n    style Ready fill:#9f9,stroke:#333\n    style Operations fill:#99f,stroke:#333\n    style AccessDenied fill:#f99,stroke:#333\n    style Error fill:#f99,stroke:#333\n```\n\n1. **User Profile Creation**:\n   - The user invokes the `createUserProfile` function to initialize their profile.\n   - The contract creates a new `UserProfile` struct for the user, setting their status to active and initializing their search count and last search timestamp.\n\n2. **Storing Search Results**:\n   - The user invokes the `storeSearchResult` function to store a new search result.\n   - The contract appends the new `SearchResult` to the user's search history and updates their profile statistics.\n\n3. **Retrieving Search History**:\n   - The user invokes the `getSearchHistory` or `getRecentSearches` function to retrieve their search history.\n   - The contract retrieves the requested search results from the user's search history and returns them.\n\n4. **Searching by Keyword**:\n   - The user invokes the `searchHistoryByKeyword` function to search their search history for results containing a specific keyword.\n   - The contract iterates through the user's search history, checking each query for the keyword, and returns matching results.\n\n5. **Retrieving User Statistics**:\n   - The user invokes the `getUserStats` function to retrieve their search statistics.\n   - The contract retrieves the user's profile and returns their total search count and last search timestamp.\n\n\n## Prerequisites\nTo build and test the SovereignAISearch-oasis-Protocol, you need the following tools:\n- `solc` (Solidity compiler)\n- `abigen` (Go Ethereum ABI generator)\n- Go (version 1.16 or later)\n\nIf you're on Ubuntu, you can install `solc` and `abigen` with:\n```shell\nmake install-deps\n```\n\n## Building\nTo build the project, simply run:\n```shell\nmake\n```\n\n## Testing\nTo run the end-to-end test, you should first start the Sapphire Localnet in Docker:\n```shell\nmake run-localnet\n```\n\nAfter it has finished starting up, you can run the end-to-end test:\n```shell\nmake test\n```\n\nThis will deploy the contract, activate a user profile, store a CID (Content Identifier) in it, retrieve it, and check if the retrieved CID matches the stored one.\n\n## Running\nBefore deploying the contract or interacting with it, you should store your account's hex-encoded private key in an environment variable (the `0x` prefix is optional):\n```shell\nexport PRIVATE_KEY=...\n```\n\n### Deploying the Contract\nYou can deploy the contract on different networks by invoking:\n```shell\n./SovereignAISearch-oasis-Protocol deploy --network sapphire-localnet # Sapphire Localnet\n./SovereignAISearch-oasis-Protocol deploy --network sapphire-testnet  # Sapphire Testnet\n./SovereignAISearch-oasis-Protocol deploy --network sapphire          # Sapphire Mainnet\n```\n\nThe deployed contract's address is printed to the standard output if the deployment is successful. You can store it in an environment variable, as you will need it to interact with the contract.\n\n### Activating User Profile\nTo activate a user profile in the deployed contract:\n```shell\n./SovereignAISearch-oasis-Protocol createUserProfile --network sapphire-localnet ${CONTRACT_ADDR}\n```\n\n### Storing CID Information\nTo store CID information inside the deployed contract:\n```shell\n./SovereignAISearch-oasis-Protocol storeCID --network sapphire-localnet ${CONTRACT_ADDR} \"do you know oasisprotocol web3 project?\" \"bafybeiekjfdzkn3bk4uzs3zlpuzdrmqyrht5joehnqvr6r7shlde5fbe7e\" \"false\" \"\" \"100\"\n```\n\n### Retrieving CID Information\nTo retrieve the CID information from the deployed contract:\n```shell\n./SovereignAISearch-oasis-Protocol getCID --network sapphire-localnet ${CONTRACT_ADDR} \"bafybeiekjfdzkn3bk4uzs3zlpuzdrmqyrht5joehnqvr6r7shlde5fbe7e\"\n```\n\n## Debugging\nFor debugging purposes, you can also run the localnet in debug mode with:\n```shell\nmake run-localnet-debug\n```\n\n## Contributing\nWe welcome contributions to SovereignAISearch-oasis-Protocol! Please read our [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to the project.\n\n## License\nSovereignAISearch-oasis-Protocol is licensed under the [Apache 2.0 License](LICENSE).\n\n# Ecological partners\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://z1labs.ai/\"\u003e\u003cimg src=\"./docs/images/logo-symbol-black.svg\" width=\"100px;\" alt=\"Zero1 Labs\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eZero1 Labs\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://oasisprotocol.org/\"\u003e\u003cimg src=\"./docs/images/oasis.png\" width=\"100px;\" alt=\"Oasis\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eOasis\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficefirelabs%2Fsovereignaisearch-oasis-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficefirelabs%2Fsovereignaisearch-oasis-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficefirelabs%2Fsovereignaisearch-oasis-protocol/lists"}