![]() |
A lightweight SDK providing reference implementations for Hashgraph Consensus Standards (HCS) created by Hashgraph Online. This SDK is built and maintained by Hashgraph Online, a consortium of leading Hedera Organizations within the Hedera ecosystem. 📚 Standards SDK Documentation 📖 HCS Standards Documentation |
---|
npm install @hashgraphonline/standards-sdk
For complete documentation, examples, and API references, visit:
- HCS-1: File Storage
- HCS-2: Registry and Indexing Standard
- HCS-3: Recursive File Loading
- HCS-7: Smart Hashinals
- HCS-10: Trustless Peer-to-Peer Communication for Agents and AI
- HCS-11: Decentralized Profile and Identity Standard
- HCS-20: Auditable Points
The SDK includes demo implementations that showcase various features. Follow these steps to run them:
-
Clone the repository
git clone https://github.com/hashgraph-online/standards-sdk.git cd standards-sdk
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env
-
Edit the
.env
file with your Hedera credentials:HEDERA_ACCOUNT_ID=0.0.12345 HEDERA_PRIVATE_KEY=your_private_key_here HEDERA_NETWORK=testnet REGISTRY_URL=https://moonscape.tech
Note: The SDK automatically saves agent creation progress to the
.env
file. If agent creation is interrupted, it will resume from the last successful step when you run the demo again. See.env.example
for details on the auto-generated agent state variables. -
Run the demos:
The following demo showcases inscribing a file.
# Run the inscribe demo npm run demo:inscribe
The following demo showcases registering Alice and Bob and exchanging messages between the two agents.
# Run the HCS-10 AI agent communication demo npm run demo:hcs-10
The following demo showcases a polling agent that polls an inbound topic for new messages with an OpenAI integration and simple commands.
# Run the HCS-10 polling demo npm run demo:polling-agent
The following demo showcases Foo and Bar agents exchanging messages where Foo also requires a fee to send messages to Bar's inbound topic:
# Run the HCS-10 fee demo npm run demo:hcs-10-fee
The inscribe demo (demo/inscribe-demo.ts
) showcases different file inscription capabilities:
- Text inscription using buffers
- URL-based inscriptions
- File buffer inscriptions
- Creating Hashinal NFTs from URLs
- Creating Hashinal NFTs from buffers
- Creating Hashinal NFTs from text content
Each inscription demonstrates different options and metadata capabilities.
The HCS-10 demo (demo/hcs-10/index.ts
) demonstrates trustless peer-to-peer communication between AI agents:
- Agent creation and registration (Alice and Bob)
- Agent metadata and profile management
- Connection establishment between agents
- Sending and retrieving small messages
- Sending and retrieving large messages with recursive storage
- Message data processing
- Resumable agent creation: If agent creation is interrupted, the SDK automatically resumes from where it left off using state saved in environment variables
The demo automatically handles agent funding, topic creation, and registration with the global registry. Agent creation progress is tracked in real-time and saved to the .env
file, allowing recovery from any interruption.
Please read our Contributing Guide and Code of Conduct before contributing to this project.
For bugs and feature requests, please use the issue templates.
For security concerns, please refer to our Security Policy.
See MAINTAINERS.md for a list of project maintainers.
Apache-2.0