bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 21쪽 중 3쪽
sparent access** to raw blockchain data with **enhanced insights** through tags and **CARV ID**, the D.A.T.A Framework enables AI agents to make informed decisions, learn from data, and autonomously interact with decentralized ecosystems in a trustless, efficient manner.
# Driving the Future of AI and Blockchain
The D.A.T.A framework aims to solve one of the fundamental challenges in AI-human interaction: trust and alignment of interests. By creating agents that are economically invested in their ecosystem's success and can verify user commitment through token holdings, we establish a new model for responsible AI development that naturally aligns with Web3's core principles of decentralization, transparency, and stakeholder value.
It lays the foundation for AI-driven innovation across blockchain sectors, enabling:
* **DeFi Applications**: Advanced risk assessment and liquidity management.
* **GameFi**: Adaptive player engagement and rewards distribution.
* **SocialFi**: Tailored community interactions and governance participation.
* **Decentralized Commerce**: Personalized marketing and user authentication.
With its ability to merge decentralized, autonomous, and transparent access to on-chain and off-chain information, the D.A.T.A Framework redefines how AI agents interact with the blockchain, unlocking new possibilities for intelligent automation and decision-making.These enriched data points allow AI agents to:
* **Understand Behavioral Patterns**: Recognize and predict actions of various blockchain participants.
* **Make Informed Decisions**: Assess risks, opportunities, and develop strategies based on comprehensive metrics.
* **Generate Contextual Actions**: Tailor responses and interactions based on specific attributes of users or addresses.
# Leveraging CARV SVM Chain for Privacy and Trustless Data Sharing
The D.A.T.A Framework integrates deeply with **CARV SVM Chain**, enabling new capabilities for privacy, scalability, and collaborative data sharing among AI agents:
1. **Guaranteed Privacy and Trustless Operation**:
1. **Trusted Execution Environments (TEE)**: Securely process sensitive data while ensuring privacy and preventing unauthorized access.
2. **CARV Verifier Nodes**: Validate the integrity of TEE attestations and zk-proofs, guaranteeing the trustworthiness of all AI agent operations and data usage.
2. **Data Sharing and Inheritance**:
1. **Collaborative Knowledge Building**: AI agents can share, inherit, and learn from data hosted on CARV SVM Chain, fostering collective intelligence across the ecosystem.
2. **Seamless Inter-Agent Communication**: Leverage CARV SVM Chain to enable AI agents to exchange structured and tagged data efficiently and securely.
3. **Learning and Adaptation**:
1. By accessing the wealth of data on CARV SVM Chain, AI agents can continuously improve their understanding of blockchain dynamics and user behaviors.
2. This capability allows agents to evolve and make more intelligent decisions autonomously.
# Quick Start Guide
This guide will help you set up and run your first D.A.T.A framework agent. Follow these steps to get started quickly.
### Prerequisites
* Go 1.19 or higher
* SQLite3
* Git
* Discord/Twitter/Telegram API credentials (optional)
* CARV API key
### Installation
1. Clone the repository:
```bash
git clone https://github.com/carv-protocol/d.a.t.a
cd d.a.t.a
```
2. Install dependencies:
```bash
go mod download
```
### Basic Configuration
1. Create a `.env` file in the project root:
```env
# LLM Configuration
LLM_API_KEY=your_api_key
LLM_PROVIDER=openai
# CARV Configuration
CARV_DATA_BASE_URL=https://api.carv.io
CARV_DATA_API_KEY=your_carv_api_key
# Optional Social Media Configuration
DISCORD_API_TOKEN=your_discord_token
TWITTER_API_KEY=your_twitter_key
TWITTER_API_KEY_SECRET=your_twitter_secret
TWITTER_ACCESS_TOKEN=your_twitter_access
TWITTER_TOKEN_SECRET=your_twitter_token
TELEGRAM_BOT_TOKEN=your_telegram_token
```
2. Create a basic character configuration (`src/config/character.json`):
```json
{
"name": "DataAgent",
"system": "An AI agent for Web3 data analysis",
"bio": [
"Specialized in blockchain data analysis",
"Expert in token-based interactions"
],
"style": {
"tone": ["professional", "helpful", "precise"],
"constraints": []
},
"goals": [
{
"name": "Data Analysis",
"description": "Provide accurate blockchain data analysis",
"priority": 0.8
}
],
"priority_accounts": [
{
"platform": "discord",
"id": "your_priority_account_id"
}
]
}
```
3. Update the config file (`src/config/config.yaml`)
> Config will be override by the env vars.
```
character:
# Path to character configuration file
path: "./src/config/character_data_agent.json"
database:
# Database type: "sqlite" or "postgres"
type: "sqlite"
# Database path (for SQLite) or connection string (for Postgres)
path: "./data/agent.db"
llm_config:
# LLM provider: "openai", "deepseek", etc.
provider: "deepseek"
# API key for the LLM provider
api_key: ""
# Base URL for API calls
base_url: "https://api.deepseek.com"
# Model name
model: "deepseek-chat"
data:
carvid:
# CarvID API endpoint
url: "https://api.carv.io/v1"
# API key for CarvID
api_key: "your-carvid-api-key-here"
token:
network: "base"
ticker: "carv"
```
### Running Your First Agent
1. Build the project:
```bash
go build -o data-agent ./src/cmd/agent
```
2. Run the agent:
```bash
./data-agent
```
### Basic Usage Examples
#### 1. Implementing a Custom Tool
```go
package tools
import (
"context"
"github.com/carv-protocol/d.a.t.a/src/internal/core"
)
type CustomTool struct{}
func (t *CustomTool) Initialize(ctx context.Context) error {
return nil
}
func (t *CustomTool) Name() string {
return "custom tool"
}
func (t *CustomTool) Description() string {
return "A custom tool for specific functionality"
}
func (t *CustomTool) AvailableActions() []core.Action {
return nil
}
```
#### 2. Adding a New Social Platform Integration
```go
package social
import (
"context"
"github.com/carv-protocol/d.a.t.a/src/internal/core"
)
type CustomPlatform struct {
// Your platform-specific fields
}
func (p *CustomPlatform) SendMessage(ctx context.Context, msg core.SocialMessage) error {
// Implementation
return nil
}
func (p *CustomPlatform) GetMessageChannel() <-chan core.SocialMessage {
// Implementation
return nil
}
```
### Common Operations
#### Checking Token Balance
```go
balance, err := tokenManager.FetchNativeTokenBalance(
context.Background(),
"user_id",
"platform",
)
if err != nil {
log.Printf("Error fetching balance: %v", err)
return
}
log.Printf("User balance: %f", balance.Balance)
```
#### Processing Social Messages
```go
msg := &core.SocialMessage
Type: "message",
Content: "Hello, agent!",
Platform: "discord",
FromUser: "user123",
}
processedMsg, err := agent.ProcessMessage(context.Background(), msg)
if err != nil {
log.Printf("Error processing message: %v", err)
return
}
```
### Common Issues and Solutions
1. **Database Connection Issues**
* Ensure SQLite3 is installed
* Check database path permissions
* Verify database file exists
2. **API Authentication Errors**
* Validate API keys in .env file
* Check API endpoint availability
* Confirm network connectivity
3. **Memory Management**
* Monitor memory usage
* Adjust batch sizes if needed
* Check for memory leaks
### Next Steps
1. Explore the [full documentati](/d.a.t.a.-ai-framework/introduction)
2. Join D.A.T.A [Discord community](https://discord.gg/AYyfmhMn5K)
3. Check out example implementations in the `/examples` directory
4. Learn about advanced features in the Architecture Guide
# Architecture
The D.A.T.A framework is designed with a modular, extensible architecture that enables seamless integration between AI capabilities and blockchain infrastructure. This section details the key components and their interactions.
<figure><img src="https://758822945-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6A1MZN6YkMg4U1B64H4g%2Fuploads%2Fs8wxU18WNFyGxMjvEeIt%2Fdata-architecture.png?alt=media&token=8f65737d-9777-417b-a951-873788e6cc82" alt=""><figcaption><p>Architecture</p></figcaption></figure>
#### 1. External Interaction Layer
At the framework's entry point, the External Interaction Layer manages all communications with users across various platforms:
* **Social Integration**
* Discord integration for community engagement
* Twitter for public communications and announcements
* Telegram for direct user interactions
* Standardized message processing across platforms
#### 2. Core Processing Layer
The heart of the framework, powered by DeepSeek's cognitive architecture:
* **DeepSeek Cognitive Engine**
* Chain-of-thought processing for complex reasoning
* Self-verification mechanisms for decision validation
* Reasoning pattern generation and refinement
* Continuous learning pipeline for improvement
* **Memory Manager**
* Working memory for active processing
* Long-term memory for persistent knowledge
* Context preservation across interactions
* Pattern recognition and recall
* **Task Manager**
* Task generation based on cognitive analysis
* Execution scheduling and prioritization
* Resource allocation and optimization
* Performance monitoring and adjustment
* **Action Manager**
* Action planning with multi-step validation
* Execution coordination across components
* Verification of action outcomes
* Feedback integration for improvement
#### 3. Token Layer
Manages token-related operations and stakeholder interactions:
* **Token Manager**
* Balance tracking across chains
* Token operation coordination
* Transaction validation and verification
* Asset management and optimization
* **Stakeholder Manager**
* User profile management
* Reputation system implementation
* Stakeholder preference tracking
* Interest alignment verification
#### 4. Blockchain Layer
Handles all blockchain interactions and data management:
* **CARV Data Integration**
* On-chain data collection and analysis
* Cross-chain data aggregation
* Real-time data validation
* Historical data processing
* **Wallet Manager**
* Transaction control and execution
* Multi-chain wallet management
* Security protocol implementation
* Key management and protection
### Component Interactions
The framework's components interact through well-defined pathways:
1. **External → Core**
* User inputs are processed through social integrations
* Messages are standardized and enriched with context
* DeepSeek engine analyzes and generates responses
2. **Core → Token**
* Cognitive engine informs token-related decisions
* Stakeholder data influences processing priorities
* Token status affects action execution
3. **Core → Blockchain**
* Actions are validated against blockchain state
* On-chain data informs decision-making
* Transaction outcomes provide feedback
4. **Token → Blockchain**
* Token operations are executed on-chain
* Wallet operations are coordinated
* Transaction status is monitored
# ERC-7231 (CARV ID)
The ERC 7231: Identity Aggregated NFT, pushes the boundaries of solving identity problems with Identity Aggregated NFT, i.e., the individual-authenticated aggregation of web2 and web3 identities to NFTs (SBTs included).
This standard extends [ERC-721](https://eips.ethereum.org/EIPS/eip-721) by binding individuals’ Web2 and Web3 identities to non-fungible tokens (NFTs) and soulbound tokens (SBTs). By binding multiple identities, aggregated and compossible identity information can be verified, resulting in more beneficial onchain scenarios for individuals, such as self-authentication, social overlapping, commercial value generation from user targeting, etc. By adding a custom schema in the metadata and updating and verifying the schema hash in the contract, the binding of NFT and identity information is completed.
Designing the proposal, we considered the following problems that are solved by this standard:
ERC 7231: : Identity Aggregated NFT
1. Resolve the issue of multiple ID bindings for web2 and web3. By incorporating the MultiIdentities schema into the metadata file, an authorized bond is established between user identity information and NFTs. This schema encompasses a userID field that can be sourced from a variety of web2 platforms, or a decentralized identity (DID) created on blockchain. By binding the NFT ID with the UserIDInfo array, it becomes possible to aggregate multiple identities seamlessly.
2. Users have full ownership and control of their data. Once the user has set the metadata; they can utilize the setIdentitiesRoot function to establish a secure binding between hashed userIDs objects and NFT ID. As only the user holds the authority to carry out this binding, it can be assured that the data belongs solely to the user.
3. Verify the binding relationship between data on-chain and off-chain data through signature based on [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) Through the signature method based on the [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271) protocol, the verifyIdentiesBinding function of this EIP realizes the binding of the userID and NFT owner address between the on-chain and off-chain.
1. NFT ownership validation
2. UserID format validation
3. IdentitiesRoot Consistency verification
4. Signature validation from NFT owner
As for how to verify the authenticity of the individuals’ identities, wallets, and accounts, there are various methods, such as ZK-based DID authentication on-chain, and off-chain authentication algorithms, such as auth2, openID2, etc.To learn more about this Ethereum Improvement Proposal #7231, please read [here](https://eips.ethereum.org/EIPS/eip-7231).
# Examples
The **Examples** section serves as a practical guide to demonstrate the power and versatility of the **D.A.T.A. framework** in real-world scenarios. Here, you'll find clear, actionable use cases that showcase how D.A.T.A. empowers AI agents to leverage both **on-chain and off-chain data** for intelligent decision-making. Each example is designed to provide hands-on insights into building smarter, more responsive AI systems while ensuring data privacy, trust, and interoperability.
# On-Chain Insights
In this section, we showcase how the AI Agent processes a user query and returns a structured response based on the query.
#### **User Query:**
*Which address on Ethereum was the most active in the last 24 hours.*
<figure><img src="https://758822945-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6A1MZN6YkMg4U1B64H4g%2Fuploads%2FwfGLOzecGlxz7eY538pq%2Fimage.png?alt=media&token=89d0ef6a-9e74-4412-ae1d-65bdf74f4a53" alt=""><figcaption><p>Ai Agent return result</p></figcaption></figure>
D.A.T.A framework generated query:
```json
{
"sql": {
"query": "WITH address_activity AS (\n SELECT\n from_address AS address,\n COUNT(*) AS tx_count\n FROM\n eth.transactions\n WHERE date_parse(date, '%Y-%m-%d') >= date_add('day', -1, current_date)\n GROUP BY\n from_address\n UNION ALL\n SELECT\n to_address AS address,\n COUNT(*) AS tx_count\n FROM\n eth.transactions\n WHERE\n date_parse(date, '%Y-%m-%d') >= date_add('day', -1, current_date)\n GROUP BY\n to_address\n)\nSELECT\n address,\n SUM(tx_count) AS total_transactions\nFROM\n address_activity\nGROUP BY\n address\nORDER BY\n total_transactions DESC\nLIMIT 1;",
"explanation": "This query identifies the most active Ethereum address in the last 24 hours by counting transactions where the address was either the sender (from_address) or the receiver (to_address). The results are aggregated and ordered by the total number of transactions, with the most active address returned.",
"timeRange": "Last 24 hours"
},
"analysis": {
"overview": {
"totalTransactions": "Number of transactions involving the most active address",
"timeSpan": "Last 24 hours",
"keyMetrics": ["Total transactions involving the address", "Address activity rank"]
},
"patterns": {
"transactionPatterns": ["High frequency of transactions", "Potential bot or automated activity"],
"addressBehavior": ["Possible exchange or DeFi protocol address", "High volume of incoming/outgoing transactions"],
"temporalTrends": ["Peak activity during specific hours", "Consistent transaction frequency"]
},
"statistics": {
"averages": {
"transactionsPerHour": "Average transactions per hour for the address"
},
"distributions": {
"transactionTypes": ["Incoming vs outgoing transactions", "Smart contract interactions"]
},
"anomalies": ["Unusual spikes in transaction volume", "Sudden changes in activity patterns"]
},
"insights": [
"The address may belong to a high-frequency trading bot or a centralized exchange.",
"High transaction volume could indicate market-making activity or arbitrage opportunities."
],
"recommendations": [
"Monitor the address for continued high activity to identify potential market trends.",
"Investigate the nature of transactions (e.g., DeFi interactions, NFT trades) for deeper insights."
]
}
}
```
D.A.T.A framework query result
```sql
%%%% D.A.T.A. Generated SQL query:
WITH address_activity AS (
SELECT
from_address AS address,
COUNT(*) AS tx_count
FROM
eth.transactions
WHERE date_parse(date, '%Y-%m-%d') >= date_add('day', -1, current_date)
GROUP BY
from_address
UNION ALL
SELECT
to_address AS address,
COUNT(*) AS tx_count
FROM
eth.transactions
WHERE
date_parse(date, '%Y-%m-%d') >= date_add('day', -1, current_date)
GROUP BY
to_address
)
SELECT
address,
SUM(tx_count) AS total_transactions
FROM
address_activity
GROUP BY
address
ORDER BY
total_transactions DESC
LIMIT 1;
◎ LOGS
%%%% D.A.T.A. queryResult
{
"success": true,
"data": [
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"total_transactions": "118841"
}
],
"metadata": {
"total": 1,
"queryTime": "2025-01-15T08:04:54.644Z",
"queryType": "aggregate",
"executionTime": 0,
"cached": false
}
}
```
**User Query:**
*What is the gas prive average on Ethereum last 3 days.*
<figure><img src="https://758822945-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6A1MZN6YkMg4U1B64H4g%2Fuploads%2FfDEP27dUdGB03hTsorNE%2Fimg_v3_02ii_5ec13e0a-8f04-4dc8-87e8-b32ad80ad1hu.jpg?alt=media&token=174c0033-da78-4b97-a355-4db735a61df6" alt=""><figcaption><p>Example response when Ai Agent integrate with D.A.T.A.</p></figcaption></figure>
#### **User Query:**
*Which stablecoin had the highest trading volume on Ethereum in the last 24 hours.*
<figure><img src="https://758822945-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6A1MZN6YkMg4U1B64H4g%2Fuploads%2FKWXYhyDkeQeczna1fNt0%2Fimage.png?alt=media&token=eabe2cdd-cae8-436e-8423-6b2bf1c7a384" alt=""><figcaption><p>Example response when Ai Agent integrate with D.A.T.A.</p></figcaption></figure>
# Getting Started
To get started with the **D.A.T.A Framework** plugin and access powerful on-chain and off-chain data for your AI agents, you’ll need an **authentication token** to interact with the framework's services.
1. **Join Our Community**:\
For support, collaboration, and discussions on integrating the D.A.T.A Framework with your Eliza-powered AI agents, [join our **Discord community**](https://discord.gg/fVPc884by4). Connect with other developers and get insights from the CARV team on how to make the most of the D.A.T.A features.
2. **Apply for a Test Authentication Token**:\
To get access to the data and integrate the plugin into your Eliza project, reach out to the CARV team to request a **test authentication token**. This token will enable you to start querying blockchain data, using our enhanced metrics, and fully leverage the D.A.T.A plugin.
You can apply for your test token or ask for assistance by visiting our [**Discord channel**](https://discord.gg/fVPc884by4) or contacting the CARV team through <developer@carv.io>.
***
By joining the community and applying 프로젝트로 돌아가기