This document provides an overview of the core services that power the Hedera network. Each service plays a crucial role in ensuring the efficient, secure, and scalable operation of the Hedera public ledger. Below, you'll find a description of each service along with its key functions and how it fits into the overall architecture of Hedera.
hedera-app-spi
defines the SPI (service provider interface) for service
modules. This section gives a brief outline of what each of the different APIs
are intended for.
- Hedera Consensus Service (HCS)
- Hedera Token Service (HTS)
- Hedera Smart Contract Service
- Hedera File Service
- Hedera Network Service
- Hedera Schedule Service
- Hedera Util Service
- Address Book Service
The Service
interface is implemented by each service module, for each
conceptual "service" it provides. Typically, a service module has a single
implementation of Service
, but the hedera-token-service
is more complicated
and may have several services. For example, it may have a TokenService
and a
CryptoService
. For simplicity in mapping concepts to code, we have a Service
subtype for each different service in our protobuf schema definitions.
The actual implementation class for a service is in the corresponding
implementation. For example, the hedera-token-service-api
module defines an
CryptoService
interface that extends from Service
, while the
hedera-token-service
implementation module defines an implementation class
such as CryptoServiceImpl
.
The hedera-app
module has access to all modules, including implementation
modules, and uses this ability to create, at construction time, instances of
each service implementation. We could have instead used a reflection-based
approach with ServiceLoader
to try to load services dynamically, but we found
the resulting code to be difficult to understand.
By design, we strive for simple code that we can easily debug with stack traces
that are short and obviously meaningful.
The downside to this design is that it requires changes to code to add or remove
new service module implementations.
We accept this downside for the time being. A future revision may institute a *
simple* DI solution that does not depend on reflection, outside from what the
ServiceLoader
does.
Each Service
implementation takes in its constructor a StateRegistry
which
is used for setting up the service state in the merkle tree. The Service
implementation also acts as a factory for TransactionHandler
s,
PreTransactionHandler
s, and QueryHandler
s, and the main entrypoint into all
API provided by the service module.
See also the Service Modules document for more information on how to create a new service module.
The Hedera Consensus Service (HCS) provides decentralized consensus ordering with high throughput and low-latency finality. It enables the creation of verifiable and auditable event logs, distributed ledgers, and fair, fast, and secure transaction ordering.
- Decentralized Consensus: Offers a tamper-proof log of messages, ensuring transparency and trust.
- Message Ordering: Provides a fair and trusted timestamp for each transaction.
- Event Streaming: Allows subscribers to listen to the ordered stream of messages in real-time.
- Supply Chain Tracking
- Decentralized Applications (dApps)
- Audit Logs
**Full Documentation: ** Consensus Service
The Hedera Token Service (HTS) enables the creation, management, and transfer of native tokens on the Hedera network. It supports a wide variety of use cases, including fungible and non-fungible tokens (NFTs).
- Token Creation: Supports the creation of tokens with customizable properties such as supply, decimal places, and freeze, wipe, and KYC status.
- Transfers and Ownership: Securely manage token transfers and ownership, including bulk transfers.
- Minting and Burning: Efficiently mint and burn tokens as needed.
- Asset Tokenization
- Loyalty Programs
- NFTs and Digital Collectibles
Full Documentation: Token Service
The Hedera Smart Contract Service allows developers to deploy and interact with smart contracts on the Hedera network, enabling decentralized applications ( dApps) with complex logic and automated processes.
- Contract Deployment: Deploy smart contracts written in Solidity.
- Contract Execution: Execute contract functions with predictable and secure results.
- Interoperability: Integrate with other services like HTS and HCS for enhanced functionality.
- Decentralized Finance (DeFi)
- Automated Workflows
- Tokenized Assets
Full Documentation: Smart Contract Service
The Hedera File Service (HFS) provides a decentralized file storage solution, allowing users to create, update, and delete files on the Hedera network. It's often used in conjunction with other services to store data such as contract bytecode or token metadata.
- File Management: Create, update, and delete files on the network.
- Storage of Smart Contracts: Store smart contract bytecode and other associated data.
- Data Availability: Ensure data is available and tamper-proof across the network.
- Document Management
- Data Storage for dApps
- Smart Contract Storage
Full Documentation: File Service
The Hedera Network Service encompasses the foundational components that ensure the security, scalability, and reliability of the Hedera network. It includes the mechanisms for managing accounts, processing transactions, and ensuring network integrity.
- Account Querying: Allows querying of user accounts, but not modification or deletion.
- Transaction Processing: Handle the validation and processing of transactions across the network.
- Network Security: Ensure the overall security and stability of the network through various cryptographic and consensus mechanisms.
- User Account Management
- Secure Transactions
- Network Governance
**Full Documentation: ** Network Service
The Hedera Schedule Service allows users to schedule transactions to be executed at a later time or once certain conditions are met. This enables more complex workflows and deferred operations in decentralized applications.
- Transaction Scheduling: Schedule transactions to be executed in the future or upon the fulfillment of specific conditions.
- Conditional Execution: Define conditions under which scheduled transactions are executed, providing flexibility and control.
- Execution Guarantees: Ensure that scheduled transactions are executed as per the defined conditions, adding reliability to deferred operations.
- Recurring Payments
- Conditional Smart Contract Execution
- Automated Workflows
Full Documentation: Schedule Service
The Util Service in Hedera provides various utility functions that support the core operations of other services. This includes common tasks such as logging, validation, and data manipulation that are essential across different components of the Hedera network.
- Logging and Monitoring: Facilitates detailed logging and monitoring of operations across different services.
- Data Validation: Ensures data integrity by performing validation checks.
- Common Utilities: Provides a set of shared utilities that simplify the development and maintenance of other services.
- Service Support Functions
- Data Integrity Checks
- Operational Monitoring
Full Documentation: Util Service
The AddressBook Service manages the network’s address book, which contains details about the nodes that participate in the Hedera network. This service ensures that the address book is consistently updated and accessible for network operations.
- Node Information Management: Maintains up-to-date information about all nodes in the network, including their public keys and IP addresses.
- Address Book Updates: Handles updates to the address book as nodes are added, removed, or changed.
- Network Communication: Facilitates communication between nodes by providing the necessary connection information.
- Node Discovery and Management
- Network Configuration
- Secure Node Communication
**Full Documentation: ** Address Book Service