This project implements a role-based whitelist authorizer using the JAM SDK (https://hackmd.io/@polkadot/jamsdk). It allows managing authorized addresses, user roles (admin, participant, observer), and includes an interactive game where participants answer questions. The results are supervised by observers and administrators.
This program uses the JAM SDK to implement a role-based and whitelist authorization system. It includes the following features:
- Roles: Admin, participant, and observer.
- Whitelist: Only authorized addresses can perform certain actions.
- Interactive Game: Participants answer questions defined by the admin.
- Results: Results of the game are monitored by observers or admins.
The project is modular and extensible, allowing you to add new questions, roles, or functionalities.
The JAM SDK provides several key tools and structures that are used in this project. Below is a description of how these components are integrated into the current code, along with suggestions for additional functionalities that could be implemented in the future::
- Description: This crate contains basic types and structures needed for working with services and authorizers in JAM.
- Components Used:
Authorizer
: Represents the JAM system's authorizer. It contains two main fields:code_hash
: A hash representing the program code.param
: A parameter that can store additional information (e.g., the admin's address).
CodeHash
: Represents a 32-byte hash used to validate whether a hash belongs to a list of valid hashes.AuthParam
: A parameter used to store additional data related to authorization.
- Usage in the Project:
Authorizer
is used to manage the validation of authorized addresses.- A
CodeHash
is dynamically generated based on the admin's name and used to verify the authenticity of operations. AuthParam
is extended with the admin's address to track who performed certain actions.
- Description: Provides common functionalities for working with the PVM (Parity Virtual Machine).
- Current Usage:
- Not explicitly used in the current code.
- Future Suggestion: It could be used to ensure that data generated by the authorizer is compatible with the PVM runtime environment. For example, you could implement specific serialization/deserialization functions to handle data in the format required by the PVM.
- Description: A basic service useful for creating initial configurations (genesis) in JAM.
- Usage in the Project:
- Cloned as a reference to understand how to configure a basic service in JAM.
- Future Suggestion: It could be used to define an initial configuration that includes predefined addresses for the admin, participant, and observer.
- Description: A basic authorizer that allows testing without authorization restrictions.
- Current Usage:
- Not explicitly used in the current code.
- Future Suggestion: It could be used as a starting point to implement more advanced test cases. For example, it could be integrated to test scenarios where no authorization is required.
- Description: A CLI tool that allows building PVM code blobs for services or authorizers.
- Current Usage:
- Not explicitly used in the current code.
- Future Suggestion: It could be used to compile the custom authorizer into a deployable PVM blob.
The project is organized into two main folders, each containing the same functionality but written in different languages:
-
JAMspanish
Folder:- Contains the code written in Spanish.
- Ideal for Spanish-speaking developers or users who prefer documentation and comments in Spanish.
-
JAMenglish
Folder:- Contains the code written in English.
- Suitable for English-speaking developers or users who prefer documentation and comments in English.
Both folders include the same structure and functionality, ensuring consistency across languages.