# Story Protocol

## Overview

Ava integrates with Story Protocol to provide decentralized IP management, licensing, and royalty distribution for AI-generated content. This integration enables proper attribution, terms enforcement, and commercial usage rights for content generated by Ava's portfolio management agents.

## Components

### ATCP-IP Provider

The ATCP-IP (Automated Token-based Content Provenance for Intellectual Property) provider serves as the bridge between Ava's AI agents and Story Protocol's on-chain IP management system. It enables:

* Creation and management of intellectual property licenses for AI-generated insights, strategies, and content
* Registration of agent outputs with proper attribution
* Enforcement of royalty payments for commercial use of IP
* Tracking of IP across the Ava ecosystem

```typescript
interface IPLicenseTerms {
  name: string;
  description: string;
  scope: string;
  transferability: boolean;
  onchain_enforcement: boolean;
  royalty_rate: number;
}

interface IPMetadata {
  license_id: string;
  issuer_id: string;
  holder_id: string;
  issue_date: number;
  version: string;
  link_to_terms: string;
  previous_license_id: string;
}
```

### Recall Storage

The Recall Storage provider enables Ava's agents to persistently store and retrieve data using the decentralized Recall protocol. This includes:

* On-chain storage of agent outputs, analysis, and decision logic
* Immutable record-keeping of portfolio actions and strategies
* Decentralized retrieval and verification of historical data
* Chain-of-thought storage for agent decision paths

Key features include:

* Encrypted storage buckets for different types of agent data
* Searchable indexed storage for fast retrieval
* Metadata tagging for organization and filtering

## How It Works

### IP Licensing Flow

1. **Content Generation**: Ava's agents generate portfolio analysis, strategies, or other valuable IP
2. **IP Registration**: Content is registered with Story Protocol via the ATCP-IP provider:

   ```typescript
   const licenseId = await atcpipProvider.mintLicense(terms, metadata);
   ```
3. **License Terms**: Clear terms are established for content usage, including:
   * Commercial vs. non-commercial use
   * Royalty rates (typically 5% default)
   * Attribution requirements
   * Transferability permissions
4. **Verification and Attribution**: Consumers of the content can verify authenticity and view attribution:

   ```typescript
   const isValid = await atcpipProvider.verifyLicense(licenseId);
   const terms = await atcpipProvider.getLicenseTerms(licenseId);
   ```

### Persistent Data Storage Flow

1. **Agent Analysis**: Ava's agents perform portfolio analysis or generate strategies
2. **Data Persistence**: Critical data is stored using the Recall Storage provider:

   ```typescript
   await recallStorage.store(key, data, metadata);
   ```
3. **Chain of Thought**: Decision-making processes are stored for transparency and auditing:

   ```typescript
   await recallStorage.storeCoT(key, thoughts, metadata);
   ```
4. **Retrieval and Search**: Data can be accessed and searched when needed:

   ```typescript
   const result = await recallStorage.retrieve(key);
   const searchResults = await recallStorage.search(query, options);
   ```

## Benefits

* **IP Protection**: Ensures proper attribution and royalty distribution for AI-generated financial insights
* **Decentralized Record-Keeping**: Creates tamper-proof records of strategies and decisions
* **Compliance**: Enables clear licensing terms for commercial use of strategies
* **Transparency**: Provides audit trails for agent decision-making
* **Interoperability**: Allows content to be securely shared across the DeFi ecosystem with proper rights management

## Future Enhancements

* Enhanced royalty distribution models for collaborative AI-generated strategies
* Integration with additional blockchains beyond the current deployments
* Advanced IP rights management for specialized portfolio strategies
* Cross-agent licensing for collaborative strategy development
* NFT-based strategy marketplaces with built-in licensing


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cryptoinnovators.gitbook.io/ava-the-defai-agent/integrations/story-protocol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
