The idea is you could take this document and feed it to an ai agent and it would understand a ton about Hive. I'm not done with this project but wanted to share where i was at and see what people think. (of the idea and what would be next)
I have been thinking of working on some Hive Projects myself independent of PeakD.com at least to play and gain some dev skills in this new world of developer ai tools.
Also sometimes i brainstorm PeakD, Peak.open features with ChatGPT and I can't just depend that the model has been trained perfectly.
One of the best methods for working with a ChatGPT or any LLM is to first be responsible for the data it is working with. Train it yourself. But where is the most thorough information... and not just thorough but concise so it doesn't overwhelm the context limits of the LLM model?
Welcome to the Condensed Hive Blockchain Resource, a comprehensive and self-contained manual designed specifically for AI agents and developers aiming to build applications on the Hive blockchain. This document provides detailed, actionable information to help you fully understand and utilize Hive's functionalities without relying on external resources.
The Hive blockchain is a decentralized platform that facilitates the creation and management of decentralized applications (dApps). Built on a robust and scalable architecture, Hive offers various functionalities essential for developers and AI agents to interact seamlessly with the blockchain.
When a user initiates an action on the Hive blockchain, such as posting content, voting, or transferring tokens, this action is bundled into a transaction. The transaction process on Hive works as follows:
KEY NOTES ON INFO ADDED TO CHAIN
RESOURCE CREDITS
Applications interfacing with the Hive blockchain require a connection to a Hive node. A Hive node is essentially a server that runs the blockchain software, and it provides the necessary API endpoints and communication channels for developers and applications to send and receive data from the Hive blockchain, such as reading blockchain data, broadcasting transactions, and managing dApp functionalities. Nodes play a critical role in maintaining the network's integrity, validating transactions, and ensuring that the blockchain remains decentralized.
There are two main types of nodes that developers can use: public nodes and private nodes.
Public nodes are nodes that are made available to the general public by individuals or organizations who run them for the benefit of the Hive community. These nodes are essential for developers who do not wish to maintain their own infrastructure but still need reliable access to the blockchain. By connecting to a public node, developers can read data from the blockchain, broadcast transactions, and access various Hive services (e.g., posting content, voting, retrieving account details).
Public nodes are usually accessible via HTTPS, and they allow developers to interact with the Hive blockchain without worrying about managing the complexities of maintaining a node themselves. However, it is important to note that some public nodes can sometimes be down or have varying performance. The availability and responsiveness of a public node may depend on factors such as server load, geographic location, and maintenance schedules. Developers may experience slower response times if they are geographically distant from the node they are trying to connect to or if the node is experiencing high traffic. Because of all these factors it is important and wonderful to have a lot of highly capable server nodes available to provide options and decentralization. There are even tools like beacon.peakd.com to assist with what nodes are operating well and what functions each node provides.
Public nodes are an excellent starting point for developers, but they do come with limitations, especially if you require consistent, high-performance access to the blockchain. In such cases, running your own private node might be more suitable.
A private node is a dedicated server that runs the Hive blockchain software exclusively for your use. Running a private node offers greater control and customization, such as the ability to configure custom API endpoints, ensure higher reliability, optimize performance for specific use cases, and handle increased transaction throughput without relying on public infrastructure. This can be particularly beneficial for projects that need guaranteed uptime, low latency, or specific customization that is not available through public nodes.
3.3 Node Setup
If you are considering a private node or creating a public node you should have an idea of how they are setup also as this will help you understand the impact of your project on public nodes.
Recommendation: The recommended approach for setting up a private node is to deploy a pre-built Docker container. Below are the steps and requirements for setting up a private node.
Understanding the type of server setup required for running a Hive node helps developers grasp the underlying infrastructure that supports Hive's blockchain technology.
Typically, a Hive node involves:
These specifications are indicative of the types of demands placed on servers operating as Hive nodes. The high requirements are necessary to ensure nodes can provide reliable, consistent access to blockchain data, handle the network's load, and support the variety of applications and interactions that make Hive a vibrant decentralized ecosystem.
Running a Hive node with Docker is an option that simplifies deployment by packaging all the necessary components (e.g., blockchain software, dependencies like specific libraries, networking settings, and environment variables) into a containerized environment. This approach is particularly beneficial for developers who want to quickly set up a node without manually installing and configuring each element (e.g., dependencies, networking settings, environment variables). Docker containers provide a consistent environment, making it easier to maintain and replicate nodes across different systems (e.g., deploying on cloud servers like AWS, running locally on development machines, or setting up in on-premise data centers).
Using Docker allows for easier management of dependencies, scalability, and isolation from other processes running on the server. It is a popular choice because it reduces setup complexity and ensures that the node environment remains consistent, which is crucial for both development and production. By using Docker, developers can take advantage of pre-built images and scripts to get a Hive node running efficiently, reducing the time required for configuration and setup.
ZFS is recommended for its compression and snapshot features, which help optimize storage efficiency and provide a robust backup mechanism. The setup involves configuring ZFS to use advanced compression, allowing significant data size reduction without compromising performance, and utilizing snapshots for easy rollback and data recovery in case of issues. These features make ZFS particularly useful for managing the large volumes of blockchain data involved in running a Hive node, ensuring both stability and space optimization.
Synchronizing your node with the Hive blockchain can be achieved through various methods to optimize speed and efficiency.
Using a snapshot can significantly reduce synchronization time by providing a pre-synced version of the blockchain state, allowing the node to start from an advanced point instead of downloading and verifying every block from the beginning.
Download Snapshot:
wget -c <https://gtg.openhive.network/get/snapshot/snapshot_filename>
A trusted block_log file can expedite the syncing process by providing an external log of verified blockchain blocks. This allows the node to use the pre-recorded data, effectively skipping the process of downloading blocks from peers and verifying them individually, which significantly speeds up synchronization.
The Hive Testnet allows developers to test applications without impacting the mainnet. It provides a sandbox environment where developers can safely experiment with new features, identify and fix bugs, and test upgrades or changes before they go live. This also allows Hive to make upgrades to the blockchain software more smoothly, as new implementations can be thoroughly vetted for stability and compatibility in a controlled environment.
The public testnet is maintained for rapid application testing.
18dcf0a285365fc58b71f18b3d3fec954aa0c141c44e4e5cb4cf777b9eab274etestnet.openhive.network:2001https://testnet.openhive.networkNote: Use your mainnet account and keys cautiously on the testnet to prevent compromising your mainnet account.
To run a private testnet node using Docker:
docker run -d -p 8090:8090 inertia/tintoy:latest
On the Hive blockchain, an account is not merely a username—it is the core entity through which all interactions people or apps can have with the blockchain. All user decided operations, from posting content to transferring tokens, must be initiated by an account.
Accounts are created by other accounts, there is a limited cost and there are naming rules for accounts including limit of 16 characters. Also no two accounts can be named the same.
Accounts on Hive are defined by their permissions and control over specific blockchain actions through a combination of keys and authorities. A role of an account is to act as a custodian of resources (e.g., Hive tokens, content, voting decisions) and to manage access to those resources through cryptographic mechanisms.
At the heart of account functionality on Hive are keys and authorities. Both define what an account can do, but they operate on different levels.
Keys in the Hive blockchain are cryptographic tools that provide proof of ownership and the ability to execute transactions. Each Hive account is usually associated with four distinct types of cryptographic keys, each designed to manage different levels of access. The private key is what grants authority to act on the blockchain, and the public key serves as the identifier that proves who controls the private key without revealing it.
While keys determine direct access to an account’s functions, authorities define who (or what) is allowed to perform actions on behalf of the account. Authorities allow the delegation of specific permissions to another account without revealing or sharing private keys.
In the Hive blockchain, an account’s ability to perform operations is defined by the combination of keys and authorities it holds or delegates. The Hive blockchain operates under a strict hierarchy of permissions, where the ability to execute actions depends on the keys being used and the authorities granted to others.
@peakd.app), which then delegates that authority to HiveSigner (e.g., @hivesigner), so HiveSigner can broadcast transactions on behalf of the app, all without needing to expose private keys.Hive supports hierarchical structures for managing account authorities, enabling greater flexibility and security. One of the most secure forms of authority delegation is multi-signature accounts, where multiple keys or accounts must approve a transaction before it can be executed. This structure adds layers of security, ensuring that no single party can act alone on behalf of an account, especially for critical or high-value actions.
This is not a common feature but allows for projects and accounts to share the burden of authorizing a transaction. This is similar to how companies or organizations often have majority votes in order to sign off on an action.
Authentication in Web3 differs from traditional Web2 methods. Hive employs secure methods to authenticate users without exposing private keys, which provides a major security advantage. In Web2, authentication often involves sending passwords or other sensitive information to a centralized server, making it susceptible to data breaches. In contrast, Hive's approach allows users to keep their private keys entirely on their own devices, using them only to sign transactions locally. This means that private keys are never transmitted across the internet, significantly reducing the risk of key theft or hacking. This method of signing transactions ensures that users maintain complete control over their account security, and it is a key reason why blockchain authentication is considered more resilient against many traditional cyber threats.
HiveKeychain and PeakVault are essential tools for developers working on Hive projects that require secure and seamless interactions with the blockchain, the majority of Hive blockchain users depend on one of these wallets. HiveKeychain and PeakVault store private keys locally on the user's device, allowing users to sign transactions and interact with Hive-based dApps without exposing their private keys to external threats. They serve as crucial layers of security that enable safe blockchain interactions without compromising user control over their accounts. This benefits both user and applications in experience and security. HiveKeychain additionally has a mobile wallet application, extending functionality beyond browser use.
HiveKeychain and PeakVault act as gateways between users and Hive-based applications, they help users make transactions and get information on the blockchain. When developers build Hive dApps, these wallets provide a mechanism that allows users to securely sign and authorize blockchain transactions.
These wallets store private keys encrypted locally, meaning keys are never shared over the network or exposed to third-party services. When a user interacts with a dApp/website (e.g., peakd.com or splinterlands.com), these wallets (HiveKeychain and PeakVault) prompt the user to manually approve transactions. This approval process involves accessing the private keys locally only to generate the required signature for the transaction. Once signed, the transaction is sent directly to the Hive blockchain. By keeping private keys entirely on the user's device, developers can ensure that sensitive information is never at risk of interception during communication with external applications.
Here is how a typical integration flow works and what developers need to know:
User Account Setup: Users initially add their Hive accounts to the wallet extension and input their keys (Posting, Active, Memo). The private keys are encrypted and stored locally, ensuring that sensitive information remains secure and inaccessible to external parties. The keys are only accessible when the wallet is unlocked (usually with a password), and the wallet cannot be used while it remains locked.
Transaction Preparation: Hive-based websites or dApps generate the blockchain transaction payload and send a formatted request to the wallet (HiveKeychain or PeakVault) for the user's review and authorization.
User Authorization: The wallet prompts the user to manually approve or reject the transaction. Upon approval, the wallet uses the locally stored private keys to sign the transaction, ensuring only the account owner can initiate it and providing full user control.
(Note: Wallets have an option for users to auto-sign transactions of a specific type or all posting transactions. Active key transactions are always approved manually.)
Broadcasting Transactions: Once confirmed and signed, the wallet broadcasts the transaction to Hive nodes. Block producers (witnesses) on the Hive network verify and add the transaction to the blockchain, ensuring the integrity of the decentralized network.
This approach provides several benefits for developers:
Unlike other authentication methods like HiveSigner or HiveAuth, HiveKeychain and PeakVault do not rely on a centralized service to facilitate logins. Instead, they function entirely as client-side solutions, allowing users to retain full control over their keys and each transaction they make. This provides enhanced security and control for users who prioritize keeping their private information local.
HiveAuth, for example, focuses on a decentralized key management approach but may require more setup compared to the straightforward integration of HiveKeychain and PeakVault's browser tools. HiveSigner, on the other hand, offers a simpler mobile experience but compromises on security and ease of user setup.
While HiveKeychain and PeakVault provide robust security, there are still some potential risks that developers and users need to consider:
hive-wallet-sdk allows developers to handle every Hive wallet (Peak Vault, MetaMask and Keychain) without the need to write duplicate code.HiveSigner is an OAuth2-based authentication and authorization service that allows users to interact with the Hive blockchain without exposing their private keys to applications. Its primary advantage lies in enabling applications to request posting operations or perform specific actions while maintaining the user's key security. By using a system of double delegation of posting authority, HiveSigner improves security by ensuring that apps never need to access or manage the user’s private keys directly.
Authorities and Tokens
@peakd.app), and the application then grants posting authority to HiveSigner (e.g., @hivesigner). This allows HiveSigner to broadcast transactions securely on behalf of the app without any private keys being exposed.Security Mechanisms:
App Integration:
Use Cases:
User Control: