2024-09-27 11:45:42 -04:00
# `x/service`
2024-09-26 18:01:49 -04:00
2024-10-21 17:02:12 -04:00
The Service module is responsible for managing the registration and authorization of services within the Sonr ecosystem. It provides a secure and verifiable mechanism for registering and authorizing services using Decentralized Identifiers (DIDs).
2024-09-27 11:45:42 -04:00
## Concepts
2024-10-21 17:02:12 -04:00
- **Service**: A decentralized service on the Sonr Blockchain with properties such as ID, authority, origin, name, description, category, tags, and expiry height.
- **Profile**: Represents a DID alias with properties like ID, subject, origin, and controller.
- **Metadata**: Contains information about a service, including name, description, category, icon, and tags.
2024-09-27 11:45:42 -04:00
2024-10-30 09:58:47 -04:00
### Dependencies
- [x/did ](https://github.com/onsonr/sonr/tree/master/x/did )
- [x/group ](https://github.com/onsonr/sonr/tree/master/x/group )
- [x/nft ](https://github.com/onsonr/sonr/tree/master/x/nft )
2024-10-21 17:02:12 -04:00
## State
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
The module uses the following state structures:
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
### Metadata
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
Stores information about services:
2024-10-30 09:58:47 -04:00
2024-10-21 17:02:12 -04:00
- Primary key: `id` (auto-increment)
- Unique index: `origin`
- Fields: id, origin, name, description, category, icon (URI), tags
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
### Profile
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
Stores DID alias information:
2024-10-30 09:58:47 -04:00
2024-10-21 17:02:12 -04:00
- Primary key: `id`
- Unique index: `subject,origin`
- Fields: id, subject, origin, controller
2024-09-27 11:45:42 -04:00
## Messages
2024-10-21 17:02:12 -04:00
### MsgUpdateParams
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
Updates the module parameters. Can only be executed by the governance account.
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
### MsgRegisterService
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
Registers a new service on the blockchain. Requires a valid TXT record in DNS for the origin.
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
## Params
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
The module has the following parameters:
2024-10-30 09:58:47 -04:00
2024-10-21 17:02:12 -04:00
- `categories` : List of allowed service categories
- `types` : List of allowed service types
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
## Query
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
The module provides the following query:
### Params
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
Retrieves all parameters of the module.
2024-09-27 11:45:42 -04:00
## Client
2024-10-21 17:02:12 -04:00
### gRPC
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
The module provides a gRPC Query service with the following RPC:
2024-10-30 09:58:47 -04:00
2024-10-21 17:02:12 -04:00
- `Params` : Get all parameters of the module
### CLI
(TODO: Add CLI commands for interacting with the module)
## Events
2024-09-27 11:45:42 -04:00
2024-10-21 17:02:12 -04:00
(TODO: List and describe event tags used by the module)
2024-09-27 11:45:42 -04:00
## Future Improvements
2024-10-21 17:02:12 -04:00
- Implement service discovery mechanisms
- Add support for service reputation and rating systems
- Enhance service metadata with more detailed information
- Implement service update and deactivation functionality
2024-09-27 11:45:42 -04:00
## Tests
2024-10-21 17:02:12 -04:00
(TODO: Add acceptance tests for the module)
2024-09-27 11:45:42 -04:00
## Appendix
2024-10-21 17:02:12 -04:00
This module is part of the Sonr blockchain project and interacts with other modules such as DID and NFT modules to provide a comprehensive decentralized service ecosystem.