Chain47 - AI agents for SIA

Introduction

Project Name: chain47 - AI agents for SIA

Name of the organization or individual submitting the proposal: Mert Köklü

Describe your project

chain47-sia is a TypeScript framework that enables AI agents to interact seamlessly with the Sia network. Built on modern AI technologies like LangChain and integrating deeply with Sia’s infrastructure, chain47-sia provides a powerful toolkit for creating intelligent agents that can autonomously manage decentralized storage operations on the Sia network.

The framework provides complete coverage of renterd, hostd, and walletd APIs, enabling everything from file uploads and host configuration to wallet management through natural language interaction. Whether you’re a storage user, host, or developer, chain47-sia simplifies interaction with the Sia network without compromising on functionality or security.

Who benefits from your project?

1.Storage Users (Renters)

  • Simplified interaction with Sia through natural language
  • Automated optimization of storage costs and redundancy
  • Intelligent contract management and renewal
  • Easy monitoring of storage health and status

2.Storage Providers (Hosts)

  • Automated host setup and configuration
  • Dynamic pricing optimization
  • Performance monitoring and alerting
  • Simplified contract and collateral management

3.Developers

  • Comprehensive framework for building AI-powered Sia applications
  • Extensive documentation and examples
  • Plugin architecture for extending functionality
  • Testing framework for reliable development

4.Sia Ecosystem

  • Increased accessibility through AI-powered interfaces
  • Higher adoption potential through simplified UX
  • More robust network through intelligent automation

How does the project serve the Foundation’s mission of user-owned data?

chain47-sia strengthens Sia’s mission of user-owned data by making decentralized storage more approachable through natural language interaction while maintaining the network’s core principles of user control and privacy. The framework enables users to manage their data through intuitive AI-powered interfaces without compromising Sia’s trustless model or requiring intermediaries.

The project preserves Sia’s privacy-first approach by processing AI interactions locally when possible and avoiding central data collection. All storage operations remain fully controlled by users, with the AI serving only to simplify interaction and optimize decisions around storage contracts, redundancy, and cost management.

Are you a resident of any jurisdiction on following list? No

Will your payment bank account be located in any jurisdiction on following list? No

Grant Specifics

Core Features

Sia Network Operations

  • Complete Integration: Full support for all Sia network operations from renterd, hostd, and walletd APIs.

    • Full support for renterd API (file management, contract handling)
    • hostd API integration (host setup, configuration, pricing)
    • walletd API implementation (transaction management, balance tracking)
    • Cross-component synchronization and state management
  • Intelligent Contract Management: Advanced system for automating storage contract creation, renewal, and monitoring. Handles contract formation fees, collateral management, and proof submission.

  • Storage Optimization: Smart algorithms for optimizing storage redundancy, cost efficiency, and host selection based on scoring metrics.

  • Host Interaction System: Comprehensive toolkit for host operations including volume management, host announcements, and pricing optimization.

LangChain Integration

  • Tools: Purpose-built LangChain tools for all Sia operations:

    • Storage management (upload, download, redundancy)
    • Wallet operations (transfers, balance checks)
    • Contract handling (formation, renewal, proof submission)
    • Host management (setup, configuration, pricing)
  • Memory Management: Specialized storage patterns for maintaining context about:

    • Active storage contracts
    • File health and redundancy status
    • Host performance metrics
  • LangGraph Workflows: Complex operation orchestration for:

    • Multi-step file uploads with encryption
    • Host setup and configuration
    • Contract negotiation and formation
    • Health checks and repair processes

Multi-Component Integration

  • Unified API Layer: Seamless integration with Sia’s core components: renterd, hostd, and walletd.
  • Response Streaming: Real-time streaming of model responses to provide immediate feedback. Supports both text completion and chat completion models.

Safety System

  • Operation Validation: Comprehensive checks for:

    • Contract parameters and collateral
    • Storage redundancy requirements
    • Host reliability metrics
  • Resource Management: Configurable limits for:

    • Storage allocation
    • Contract formation
    • Collateral commitments
    • Bandwidth usage

Web Integration

  • REST API: HTTP API for integrating agent capabilities into web applications. Includes authentication, rate limiting, and request validation.

Local GUI Interface

  • Chat Interface: Local web-based chat interface for interacting with the agent. Includes message history, response formatting, and action previews.

Technical Architecture

Core Components

These are example interfaces for the core components of the chain47-sia framework to demonstrate the high-level structure and usage patterns.

SiaProvider

interface SiaProvider extends Provider {
  connect(): Promise<void>;
  getConsensus(): Promise<ConsensusInfo>;
  // Actions...
  formContract(params: ContractParams): Promise<ContractID>;
}

ActionRegistry

interface Action {
  name: string;
  description: string;
  parameters: Schema;
  execute(args: any): Promise<any>;
}

class ActionRegistry {
  registerAction(action: Action): void;
  getAction(name: string): Action;
  listActions(): Action[];
}

AgentKit

class AgentKit {
  constructor(config: AgentConfig);
  addProvider(provider: Provider): void;
  registerTools(tools: Tool[]): void;
  execute(action: string, params: any): Promise<Result>;
}

Integration Methods

1. Direct SDK Usage

import { SiaAgent } from 'chain47';

const agent = new SiaAgent({
  provider: new SiaProvider({
    renterURL: 'localhost:9980',
    hostURL: 'localhost:9982'
  }),
  wallet: new SiaWalletManager(seed)
});

2. LangChain Integration

import { createSiaTools } from 'chain47/langchain';

const tools = createSiaTools(agent);
const chain = new LangChain({
  tools,
  model: "gpt-4"
});

3. REST API

// Start REST server
const server = new SiaAgentServer({
  port: 3000,
  agent: siaAgent
});

// API endpoints
POST /api/contracts  // Contract management
GET /api/status  // System status

Usage Modes

1. Chat Mode

Interactive conversation with the AI agent.

Features:

  • Natural language interaction
  • Context awareness
  • Memory of previous interactions
  • Error explanation
  • Suggested actions

Example:

const agent = new SiaAgent({
  mode: "chat",
  memory: true
});

// User interactions
"What's my current storage usage?"
"Upload my documents folder with 3x redundancy"
"How healthy are my storage contracts?"

2. Library Mode

Direct programmatic interaction through TypeScript/JavaScript.

Features:

  • Full TypeScript support
  • Promise-based API
  • Error handling
  • Type safety
  • Event system

Example:

const agent = new SiaAgent({
  mode: "library",
  provider: new SiaProvider()
});

// Direct method calls
await agent.getStorageUsage();
await agent.uploadFolder({
  path: "./documents",
  redundancy: 3
});
await agent.checkContractHealth();

3. Autonomous Mode

Will be implemented in future. Not included in this scope.

Agent operates independently based on predefined strategies.

Features:

  • Strategy-based execution
  • Safety limits
  • Monitoring
  • Automated reporting
  • Alert system

Example:

const agent = new SiaAgent({
  mode: "autonomous",
  strategy: {
    type: "host",
    params: {
      minStoragePrice: "50 SC/TB/month",
      maxCollateral: "5000 SC",
      targetUtilization: 0.8,
      rebalanceInterval: "24h"
    }
  }
});

// Start autonomous operation
await agent.start();

4. Watch Mode

Will be implemented in future. Not included in this scope.

Monitor blockchain state and execute predefined actions.

Features:

  • Event watching
  • Address monitoring
  • Price alerts
  • Transaction tracking
  • Custom triggers

Example:

const agent = new SiaAgent({
  mode: "watch",
  triggers: [
    {
      type: "storage",
      condition: "redundancy < 2.5",
      action: "repair",
      params: {
        targetRedundancy: 3
      }
    }
  ]
});

// Start watching
await agent.startWatching();

Tech Stack

Core Framework

  • Language: TypeScript
  • Runtime: Node.js >= v18
  • Package Manager: pnpm
  • Build System: Turborepo
  • Testing: Jest + Testing Library
  • Documentation: TypeDoc
  • CI/CD: GitHub Actions

AI Integration

  • Framework: LangChain + LangGraph
  • Model Support:
    • OpenAI (GPT-4, GPT-3.5)
    • Anthropic (Claude)
  • Memory Management: LangChain Memory
  • Tool System: Custom LangChain Tools

Frontend

  • Framework: Next.js 14
  • UI Components: shadcn/ui
  • Styling: Tailwind CSS
  • State Management: React Query
  • Animations: Framer Motion
  • Data Visualization: Recharts
  • Code Highlighting: Prism.js

Backend

  • API Framework: NestJS
  • Validation: Zod
  • Error Handling: Winston
  • API Documentation: Swagger/OpenAPI

Sia Integration

  • Core APIs:
    • renterd API
    • hostd API
    • walletd API
  • Real-time Updates: WebSocket subscriptions
  • Data Processing: Stream-based file handling

chain47-sia GUI Interface

A web interface for natural language interaction with Sia network operations.

  • Message history with agent responses
  • Real-time streaming responses
  • Code block formatting for transactions
  • Syntax highlighting for code/transaction data
  • Message reactions for quick feedback

Example Interaction

User: "Configure my host for optimal earnings"

Agent: Let's optimize your host configuration
Current network averages:
- Storage price: 45 SC/TB/month
- Collateral: 2x storage price
- Contract length: 3 months

Recommended settings:
[View Details] [Apply] [Cancel]

User Stories

For Storage Users (Renters)

As a renter, I want to:

  • Upload files by describing them in natural language (“upload my tax documents with 3x redundancy”)
  • Check my storage status (“how much storage am I using and what’s the cost?”)
  • Monitor file health (“are my files healthy and properly backed up?”)
  • Get cost estimates (“how much will it cost to store 100GB for a year?”)

For Storage Providers (Hosts)

As a host, I want to:

  • Set up my host through conversation (“help me configure my host for optimal earnings”)
  • Optimize pricing (“analyze network prices and suggest competitive rates”)
  • Monitor performance (“show me my host stats and earnings”)

For Developers

As a developer, I want to:

  • Build AI-powered Sia apps using the TypeScript SDK
  • Add Sia storage features to my LangChain applications
  • Create custom storage automation tools
  • Integrate Sia operations into my web applications

These interactions can happen through web chat interface (UI) or programmatically through the SDK.

Project Final Deliverables

  • Complete chain47 adaptor implementation for Sia network in TypeScript with full type definitions
  • Comprehensive test suite including unit and integration tests
  • LangChain-compatible tools for all renterd, hostd, and walletd operations
  • Pre-configured prompts for renterd, hostd, and walletd operations
  • All renterd actions implementation of complete renterd API
  • All hostd operations implementation of complete hostd API
  • walletd operations implementation of complete walletd API
  • Web chat interface for interacting with the AI agent to perform Sia operations
  • REST API for remote service integration
  • Interactive chat mode for natural language interaction
  • Direct library mode for programmatic integration
  • CLI tool that wakes up the API and chat interface
  • Integration guides and API reference documentation
  • Comprehevensive documentation for building AI agents with chain47-sia

Milestones

Milestone 1: Core Framework and Base Integration

  • Estimated duration: 6 weeks
  • FTE: 1
  • Budget: $11,111 USD
  • Justification of Budget: 30 workdays x 6 hours x $61.73 = $11,111
  • Deliverables:
    • Complete TypeScript framework setup with core architecture
    • Full renterd API integration implementation
    • Initial LangChain tool development for renterd operations
    • Basic chat interface implementation
    • Development environment setup and testing framework
    • CLI tool implementation with basic commands
    • Initial documentation structure

Milestone 2: Wallet Integration and Enhanced Features

  • Estimated duration: 7 weeks
  • FTE: 1
  • Budget: $12,963 USD
  • Justification of Budget: 35 workdays x 6 hours x $61.73 = $12,963
  • Deliverables:
    • Complete walletd API integration
    • LangChain tools for wallet operations
    • Memory management system implementation
    • Validation and safety systems
    • Chat mode enhancements
    • Initial REST API implementation for core features
    • Expanded test coverage for wallet operations

Milestone 3: Host Integration and Advanced Features

  • Estimated duration: 7 weeks
  • FTE: 1
  • Budget: $12,963 USD
  • Justification of Budget: 35 workdays x 6 hours x $61.73 = $12,963
  • Deliverables:
    • Complete hostd API integration
    • LangChain tools for host operations
    • Web-based chat interface implementation
    • Complete REST API implementation
    • Integration tests for host operations

Milestone 4: System Completion and Documentation

  • Estimated duration: 7 weeks
  • FTE: 1
  • Budget: $12,963 USD
  • Justification of Budget: 35 workdays x 6 hours x $61.73 = $12,963
  • Deliverables:
    • Complete system integration testing
    • Performance optimization for all components
    • Final CLI tool refinements and testing
    • Comprehensive documentation
    • Example applications and use cases
    • API reference documentation
    • Final testing and bug fixes
    • Production release

Total requested amount: $50,000

Similar Implementations

AI agents are currently very high in demand in the blockchain ecosystem. There are many projects that are working on AI agents that interact with blockchain networks. Some of them are:

Or current running hackathons:

As a long time developer of Sia ecosystem, I didn’t want Sia network to be left behind in this trend. I believe that chain47-sia will be a great addition to Sia ecosystem and will attract more developers to Sia network.

Future Plans

My previous project SiaQL was developing a GraphQL API for Sia network.

Now, chain47-sia will be using this GraphQL API to interact with Sia network. With chain47-sia, users will be able to interact with Sia network through natural language easily.

Usage modes such as autonomous mode and watch mode will be implemented in future versions of chain47-sia to provide more advanced automation and monitoring capabilities. I wanted to keep the scope of this proposal focused on the core features to ensure a successful initial release.

I am committed to maintaining and improving chain47-sia over the long term (1 year), with regular updates, bug fixes, and new features based on community feedback and evolving Sia network requirements.

Long-term Sustainability

  • Monthly feature updates based on community feedback
  • Open-source community contribution model
  • Comprehensive documentation for contributors
  • Regular sync with Sia core team for API updates
  • Public roadmap for future development
  • Bug fixes for issues

Potential risks that will affect the outcome of the project

1.API Changes

  • Risk: Sia’s APIs (renterd/hostd/walletd) could undergo significant changes
  • Mitigation: Build flexible adapters, maintain close communication with Sia team

2.AI Model Limitations

  • Risk: AI models may not always correctly interpret storage/hosting commands
  • Mitigation: Implement robust validation checks, clear error messages, confirmation steps

3.Framework Compatibility

  • Risk: LangChain or other dependencies could have breaking changes
  • Mitigation: Lock stable versions, maintain thorough test coverage

Development Information

Will all of your project’s code be open-source?

Yes, all code developed for this project will be open-source and available for community review and contribution.

Leave a link where code will be accessible for review

The project repository will be hosted on GitHub at: https://github.com/justmert/chain47

Do you agree to submit monthly progress reports?

Yes, I agree to submit detailed monthly progress reports.

Contact info

Contact Name: Mert Köklü

I worked as Intelligent Video Analytics Team Leader in a NVIDIA distributer company that develops video analytics solutions for 2 years. After diving into Web3 ecosystem, I have become a grantee for well-known protocols such as Sia, Aave, Compound, Filecoin, Web3 Foundation, and Solana demonstrating my extensive experience and expertise across multiple blockchain ecosystems.

I am also a grantee of Sia Foundation with projects:

My other grantee projects can be found on my GitHub profile: https://github.com/justmert

Email: [email protected]

Any other preferred contact methods:

If I understand correctly, this project is basically about introduction of some app that runs in background and provides API that other apps (AI agents) can hoow with to work with Sia. I also think that on its own it should provide some own control panel (that’s proably the chain-47-sia GUI interface mentioned further below) to demonstrate its features and working both as useful app and demo for developers. I would also love to see it monitor the apps (hostd, renterd, walletd) and periodically inform users about potential issues, misconfigurations (and how to fix them) and notification center. And if this all can be linked to send email/sms for most important issues that need immediate attention, you would suddenly have very strong “selling” point for this entire idea - it would be amazing tool to help users with troubleshooting.

I noticed you mention Safety System, but it sounds a bit different than Troubleshooting Assistant.

About AI model, I don’t know the pricing, but how about support for free open-source models that appeared lately?

Overall… given the fact that I hear about AI from everyone. Two of my close friends running companies even either already use AI a lot, or they consider hiring full-time developer that would only further integrate AI into company’s activities, reducing the amount of routine work and giving employees time to explore new opportunities. I use AI a lot too. And the suggested budget sounds reasonable to me. Given the fact this is not your first grant, I think this is worth considering.

If Sia is a storage for future, I think we should explore this area as something that’s rapidly evolving and at the rate people get familiar with AI agents it might surprise us how natural this way of access could become for users in the not so distant future.

I don’t know how much advancement in the AI area there will be by the time this is done, which is why I see this as experimental/dynamic development project and that’s why I don’t have many concerns. Clearly, while it sounds as something that makes sense and is doable, it wouldn’t hurt to hear opinions from someone more familiar with AI integration checking this proposal for potential blockers/issues.

But in general, I like this idea and think that it could either be approved as it is, or… proceed with smaller scope and split it into two grants. One for now that would focus on the essentials + troubleshooting. It would be very powerful since majority of non-bug problems could be instantly solved, users wouldn’t have to be frustrated, wait or look up for answers, and even bugs could be auto-reported to github with proper description and logs. The other (if the first one is successful) would continue later and could be larger grant with more features.

1 Like

Hey @Danger excellent feedback, thank you, loved it.

Let me clarify the project’s core deliverables and address your points:

What Will Be Delivered:

  1. A TypeScript framework that lets developers build AI-powered applications on Sia. Please see Chain47 - AI agents for SIA

  2. Complete coverage of renterd, hostd, and walletd APIs through both programming and natural language interfaces

  3. A web-based chat interface where users can interact with Sia using natural language. Please see GUI interface details

  4. A REST API that other applications can use to integrate Sia functionality

  5. Other components such as comprehensive documentation and examples of the project.

Key Clarification:

chain47-sia is a development framework that enables AI interaction with Sia at two levels:

  1. Developers can build AI-powered Sia applications using this framework. This means that Interact with Sia with AI

  2. End users can manage their Sia nodes or storages through natural language commands (just plain english) in our included chat interface. To give users such an interface, i need to create a cli application so that it wakes up this interface. Maybe this Coinbase Agent Kit demo interface can give an idea.

So this project is not only for developers, or not only for users. It is for both.

Regarding Troubleshooting:

The suggested troubleshooting functionality aligns perfectly my planned Watch Mode, which i have intentionally left for a future phase to keep the initial scope focused. If the Foundation wants this included in the current scope, I can revise the proposal to include automated monitoring, and notification systems. But i recommend this feature to be implemented in the next phase since this phase will cover awesome actions and already broad.

Regarding Open Source Models:

Yes! While the initial implementation focuses on OpenAI and Anthropic for reliability, the framework is model-agnostic. I can easily add support for open-source models but user needs to provide API key for every model.

Just ensure the API server setting is configurable for OpenAI and you can basically cover anything. and unless your trying to target Anthropic’s MCP spec in any way, I view the OpenAI API akin to S3, and most already speak that.

So, as long as the server and API key can be configured, it can be agnostic to the inferencing service.

1 Like

Hey @mert, thanks for your latest proposal!

This is close to mathing out to be a Large grant based on $54,000 requested and 27 weeks of work. We either would need you to commit to a seven month payment schedule or to reduce your request so that it comes to under $8,333 per month.

Let me know if either of those work and we’ll review at our next meeting.

1 Like

Hey, @steve, thank you for the explanation. It seems that my requested funding indeed passing $8,333 for a month.

27 weeks == 6,3 months
54,000 / 6,3 months = $8.571

My estimated duration for milestones will stay as is. I have no problem rounding down the price. I am now requesting a budget of $50,000 to match the standard grant requirement. This means I am requesting $7.936 per month.

50,000 / 6.20 month = $7.936

I have edited the proposal and ready to be reviewed. Thank you.