The PR is in draft mode and under heavy development, but the future looks bright
https://github.com/elizaOS/eliza/pull/2390
If you want to support me, vote for me as a Hive witness.
Here is the draft README.md:
@elizaos/plugin-hive
Core Hive blockchain plugin for Eliza OS that provides essential services and actions for token operations, content interactions, and wallet management.
Overview
This plugin provides comprehensive functionality to interact with the Hive blockchain, including:
- HIVE/HBD token transfers and management
- Content creation and curation
- Account operations and wallet management
- Market operations and order management
- Following/follower relationship management
- Witness operations
- Blockchain data querying
Installation
pnpm install @elizaos/plugin-hive
Configuration
The plugin requires the following environment variables:
HIVE_ACCOUNT=your_hive_account
HIVE_POSTING_KEY=your_posting_key
HIVE_ACTIVE_KEY=your_active_key
HIVE_NETWORK=mainnet|testnet
HIVE_API_NODE=https://api.hive.blog
Usage
Import and register the plugin in your Eliza configuration:
import { hivePlugin } from "@elizaos/plugin-hive";
export default {
plugins: [hivePlugin],
// ... other configuration
};
Key Features
Token Operations
// Send HIVE tokens
const result = await eliza.execute({
action: "SEND_HIVE",
content: {
to: "recipient",
amount: "1.000 HIVE",
memo: "Payment for services",
},
});
// Convert HIVE to HBD
const result = await eliza.execute({
action: "CONVERT_HIVE",
content: {
amount: "100.000 HIVE",
},
});
Content Management
// Create a post
const result = await eliza.execute({
action: "CREATE_POST",
content: {
title: "My First Post",
body: "This is the content of my post",
tags: ["hive", "blog", "introduction"],
},
});
// Vote on content
const result = await eliza.execute({
action: "VOTE",
content: {
author: "username",
permlink: "post-permlink",
weight: 10000, // 100% upvote
},
});
API Reference
Actions
SEND_HIVE
Transfers HIVE tokens to another account.
{
action: 'SEND_HIVE',
content: {
to: string, // Recipient's Hive account
amount: string, // Amount with currency (e.g., "1.000 HIVE")
memo?: string // Optional memo
}
}
SEND_HBD
Transfers HBD tokens to another account.
{
action: 'SEND_HBD',
content: {
to: string,
amount: string, // Amount with currency (e.g., "1.000 HBD")
memo?: string
}
}
CREATE_POST
Creates a new post on the Hive blockchain.
{
action: 'CREATE_POST',
content: {
title: string,
body: string,
tags: string[],
beneficiaries?: Array<{
account: string,
weight: number
}>
}
}
Providers
Wallet Provider
Provides wallet information and portfolio tracking.
const walletInfo = await eliza.getProvider("wallet");
// Returns:
// - Account balance
// - Token balances (HIVE, HBD)
// - Estimated account value
// - Reward balance
Content Provider
Manages content-related operations.
const contentInfo = await eliza.getProvider("content");
// Returns:
// - User's posts
// - Feed content
// - Trending posts
// - Recent posts
Development
Building
pnpm run build
Testing
pnpm test
Security Best Practices
Key Management
- Store private keys securely
- Use environment variables
- Never expose keys in code
- Implement key rotation
Transaction Safety
- Validate all inputs
- Implement amount limits
- Double-check recipients
- Monitor transaction status
Content Safety
- Validate post content
- Check for spam patterns
- Implement content filters
- Monitor for abuse
Error Handling
The plugin implements comprehensive error handling for:
- Network connectivity issues
- Transaction failures
- Invalid inputs
- Rate limiting
- API node failures
- Authorization errors
Dependencies
@hiveio/dhive
: Core Hive blockchain interaction librarybignumber.js
: Precise number handlingnode-cache
: Caching implementation
Contributing
Contributions are welcome! Please see the CONTRIBUTING.md file for details.
Credits
This plugin integrates with:
- Hive Blockchain
- DHive
- The Hive Developer Community
Special thanks to:
- The Hive core development team
- The Hive community
- All contributors to this plugin
License
This plugin is part of the Eliza project. See the main project repository for license information.