You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Draft an ADAMANT Improvement Proposal in Adamant-im/AIPs for ADAMANT Group Chats and Channels in the classic blockchain messaging model, where every message is a blockchain transaction.
The AIP should define interoperable group/community and channel semantics for ADAMANT clients and node APIs, including group identity, membership, roles, moderation, paid/free access, message fees, subscription economics, notifications, and the node architecture needed to support this safely.
This issue is scoped to the current permanent blockchain-backed messaging model first. Integration with the planned alternative messaging architecture in #194 must be treated as a separate follow-up discussion after that architecture is selected.
Details
Background
ADAMANT currently supports classic one-to-one chats where a message is a transaction:
Message transactions use transaction type 8 (CHAT_MESSAGE) from helpers/transactionTypes.js.
The encrypted payload is stored in transaction.asset.chat.message.
transaction.asset.chat.own_message stores the nonce needed for decryption.
transaction.asset.chat.type distinguishes legacy, ordinary, rich, and signal message payloads.
Message fees are calculated in logic/chat.js, currently using constants.fees.chat_message for modern messages and constants.fees.old_chat_message for legacy messages.
Chat data is stored in the chats table and exposed through sql/chats.js, modules/chats.js, modules/chatrooms.js, schema/chats.js, and schema/chatrooms.js.
Current chatroom APIs are pairwise: modules/chatrooms.js derives dialogs from sender/recipient pairs and validates request paths as U.../U....
Address validation currently accepts only U addresses in helpers/z_schema.js.
WebSocket subscriptions in modules/clientWs/transactionSubscription.js match transactions by sender/recipient address and transaction or asset chat type.
Group chats and channels require a protocol-level design before implementation because they affect transaction validation, address formats, fees, membership state, moderation state, node APIs, schemas, client interoperability, and possibly balances or fee distribution.
The AIP should define ADAMANT-native terms before specifying transaction formats:
Community: all allowed members can read and write.
Channel: all allowed members can read, but only administrators and/or moderators can publish.
Open group/channel: any user can join according to public protocol rules.
Closed group/channel: users can join only by invitation or administrator approval.
Moderated/administered group/channel: administrators and moderators can perform protocol-defined moderation actions.
Unmoderated group/channel: governance is based on prior agreement between participants; it must not be open, because there is no public moderator path for abuse response.
The AIP should be explicit about whether "group chat" is a generic umbrella term and whether G... and C... addresses distinguish communities and channels or only identify group-like entities with metadata specifying the mode.
Roles and permissions
Define a deterministic role model:
Administrator: can delete or archive the group according to protocol rules, appoint or remove administrators, appoint or remove moderators, change mutable settings, invite or approve members, moderate messages and members.
Moderator: can moderate messages and members within limits set by administrators.
User/member: can read and, in communities, write if membership and payment rules allow it.
The AIP should specify:
how administrators are appointed at creation;
whether the creator is always an administrator;
whether administrators can remove the creator;
whether role changes are reversible;
how role changes are ordered if conflicting transactions appear in the same block;
what happens if all administrators are removed or lose access;
how closed unmoderated groups change membership if no administrator exists.
Moderation and deletion model
The design must not claim that historical blockchain data can be erased. Message deletion and moderation should be defined as tombstone or filtering semantics over persistent transactions, consistent with #195.
The AIP should define:
message deletion by original sender;
message deletion by administrator or moderator;
member ban or mute;
group/channel deletion or closure;
whether deleted messages are hidden, replaced with a placeholder, or returned through a raw-history API flag;
whether moderation markers are private encrypted Rich messages, public node-indexable control transactions, or both;
how nodes and clients process moderation markers before rendering a group timeline;
whether nodes should reject new messages from banned users after the ban transaction is confirmed;
behavior for unconfirmed messages and WebSocket delivery around bans, moderation, and role changes.
Public moderation markers may be necessary for legal and abuse-response reasons in open communities and channels, but they leak moderation metadata. The AIP should compare private and public approaches, then justify the selected one.
Group identity and address model
The notes propose group or channel addresses such as G22324532453564364432534 or C22324532453564364432534. This is consensus and API visible, because current address validation accepts only U....
The AIP should compare at least these identity models:
Synthetic group address derived deterministically from the group creation transaction ID.
Group address derived from a group public key.
Multisignature-backed owner account plus a separate group address.
Full account-like group address with balances, transfers, username, and voting capabilities.
Recommended initial direction to evaluate:
Use a deterministic synthetic G... or C... address for group identity and routing.
Do not allow group addresses to forge, vote, or sign arbitrary transactions in the first protocol version.
If a group needs a treasury or betting/pool behavior, define it as an explicit group treasury sub-protocol with deterministic administrator or multisig withdrawal rules.
Treat full account-like behavior, voting, and login under a group address as a later high-risk extension, because it affects account semantics, authorization, balances, and governance.
The AIP must define whether group public usernames such as super_chat are mandatory at creation, globally unique, mutable, transferable, and protected from collision with user/delegate usernames.
Message and transaction model
The AIP should define whether group messages reuse transaction type 8 or introduce new transaction types. Candidate direction:
Add explicit group transaction types for consensus-visible state:
group/channel creation;
group settings update;
member invite, join request, approval, leave, removal, ban, mute;
role assignment and revocation;
subscription payment or renewal;
moderation/tombstone;
optional group treasury operation.
Define how a normal group message is represented:
either a new group-message transaction type;
or type 8 with a G... or C...recipientId and new validation rules.
Preserve existing one-to-one type 8 transaction bytes, IDs, signatures, and fees unless the AIP explicitly defines a height-gated protocol upgrade.
If existing type 8 is extended, the AIP must explain how old nodes and old clients behave when they see a G... or C... recipient. If new transaction types are added, the AIP must define transaction bytes, fee calculation, dbRead/dbSave, API schema fields, and block validation rules.
Encryption and read access
Classic ADAMANT messages are encrypted to a recipient account. Groups need a different key model.
The AIP should define:
group epoch keys or sender keys for encrypted group content;
how open groups expose read access without giving nodes plaintext;
how closed groups distribute keys to approved members;
how channels protect publisher/admin keys;
how member removal or ban rotates keys for future messages;
how old messages remain decryptable or become unavailable after membership changes;
how multi-device accounts receive group keys;
what metadata remains public on-chain even when payloads are encrypted.
The AIP should avoid inventing new cryptographic primitives. If the design needs modern group encryption beyond the current NaCl box model, it should evaluate MLS-style group epochs or a simpler explicitly scoped first version, then describe the security tradeoffs.
Fees, subscriptions, and economics
The AIP should specify all economic rules deterministically.
Creation:
group/channel creation is paid;
the fee goes to nodes through the standard fee path unless a future protocol upgrade says otherwise;
creation fee may depend on group type, openness, moderation mode, username registration, and treasury support.
Per-message fees:
standard message fee;
increased message fee;
possible fee exemptions for administrators or moderators;
channel mode where only administrators pay to publish;
mode where all writers pay;
mode where the administrator pays for user-visible free reading or subsidized messages.
Subscriptions:
free subscription;
paid subscription;
lifetime subscription;
monthly subscription;
yearly subscription;
renewal, expiration, refund, and grace-period behavior.
Distribution of extra message fees and subscriptions:
distributed to nodes as ordinary fees;
distributed to participants according to deterministic rules;
transferred to the group creator or administrator, for example paid news channels.
Any non-standard distribution changes account balances and must define exact apply/undo behavior, replay safety, rounding, ordering, and SQL/state coupling. Rewarding participants by attention or audience size is especially sensitive and must avoid spam incentives, self-dealing, and non-deterministic ranking.
Notifications
Notification preferences should likely be user-local settings, not consensus state:
notify only for administrator messages;
notify for all messages;
notify for no messages.
The AIP should define how clients store these preferences, for example encrypted KVS or local-only cache, and how WebSocket/push services respect them without leaking unnecessary social-graph metadata.
Proposed node architecture
The AIP should include an implementation architecture for this repository. A candidate architecture to evaluate:
Add a new consensus activation height for group/channel transaction validation.
Add group-specific transaction types or a clearly versioned extension of type 8.
Add logic modules for group creation, settings, membership, roles, subscriptions, moderation, and group messages.
Add deterministic state mirrors, for example mem_groups, mem_group_members, mem_group_roles, mem_group_subscriptions, mem_group_moderation, and optional mem_group_treasury.
Add SQL tables, migrations, and full transaction views for group state and group messages.
Update account/address validation to support G... and/or C... only after activation.
Update modules/chats.js and/or introduce modules/groupChats.js for listing and fetching group timelines.
Update modules/chatrooms.js to support pairwise dialogs and group/channel entries without breaking existing /api/chatrooms/:userId/:companionId behavior.
Update WebSocket subscription logic to support group addresses, group timelines, and moderation/control events.
Update transaction pool filtering so unconfirmed group messages respect current role, membership, subscription, and ban state.
Update adamant-schema for new transaction, group, membership, moderation, and API response shapes.
Update docs with endpoint behavior, examples, fees, and backwards compatibility notes.
The implementation should keep state mutations inside existing sequencing semantics (sequence, dbSequence, balancesSequence) and must not introduce non-deterministic ordering in validation, fee distribution, membership checks, or moderation checks.
Required design questions
Should this be one broad AIP, or should it be split into focused AIPs for group identity, membership/moderation, group messages, economics/subscriptions, and treasury behavior?
Are G... and C... both needed, or should one group address prefix plus metadata be used?
Can a group/channel be deleted, or only closed with a permanent tombstone?
Can unmoderated closed groups change membership after creation, and if yes, who authorizes it?
Should open groups require public moderation markers for abuse response?
Should group addresses hold balances in the first version?
Should group addresses ever vote or act like normal users?
How are group keys created, rotated, backed up, and recovered?
How do clients show historical messages after a member leaves, is removed, or is banned?
How are group/channel usernames reserved, renamed, transferred, or released?
How do paid subscriptions interact with bans and moderation?
How are extra fees rounded and distributed under replay and rollback?
Which APIs return raw blockchain history versus moderated/filtered timelines?
What is the migration and compatibility behavior for old nodes and clients?
This AIP should solve classic ADAMANT blockchain group chats and channels first, where messages and control actions are transactions.
The AIP must include a short compatibility section for #194, but should not finalize implementation details for that alternative architecture yet. Once #194 selects a relay, temporary sidechain, embedded protocol, or another design, group chats and channels in that architecture should be discussed separately and may require a companion AIP.
The draft includes backwards compatibility, security/privacy considerations, abuse/prohibited-content considerations, and test cases.
Companion issues or PRs are created for adamant, adamant-schema, docs, PWA, and iOS where needed.
Notes
This is a protocol/design task, not an immediate implementation task.
This feature touches consensus, transaction validation, address formats, balances, fees, APIs, schemas, client interoperability, privacy, and moderation. Maintainer review is required before implementation.
No transaction bytes, IDs, signatures, fees, rewards, delegate ranking, slot timing, account semantics, or SQL state should change without an explicit AIP, activation plan, replay strategy, and tests.
Summary
Draft an ADAMANT Improvement Proposal in Adamant-im/AIPs for ADAMANT Group Chats and Channels in the classic blockchain messaging model, where every message is a blockchain transaction.
The AIP should define interoperable group/community and channel semantics for ADAMANT clients and node APIs, including group identity, membership, roles, moderation, paid/free access, message fees, subscription economics, notifications, and the node architecture needed to support this safely.
This issue is scoped to the current permanent blockchain-backed messaging model first. Integration with the planned alternative messaging architecture in #194 must be treated as a separate follow-up discussion after that architecture is selected.
Details
Background
ADAMANT currently supports classic one-to-one chats where a message is a transaction:
8(CHAT_MESSAGE) fromhelpers/transactionTypes.js.transaction.asset.chat.message.transaction.asset.chat.own_messagestores the nonce needed for decryption.transaction.asset.chat.typedistinguishes legacy, ordinary, rich, and signal message payloads.logic/chat.js, currently usingconstants.fees.chat_messagefor modern messages andconstants.fees.old_chat_messagefor legacy messages.chatstable and exposed throughsql/chats.js,modules/chats.js,modules/chatrooms.js,schema/chats.js, andschema/chatrooms.js.modules/chatrooms.jsderives dialogs from sender/recipient pairs and validates request paths asU.../U....Uaddresses inhelpers/z_schema.js.modules/clientWs/transactionSubscription.jsmatch transactions by sender/recipient address and transaction or asset chat type.Group chats and channels require a protocol-level design before implementation because they affect transaction validation, address formats, fees, membership state, moderation state, node APIs, schemas, client interoperability, and possibly balances or fee distribution.
Source material to review
Product taxonomy to define
The AIP should define ADAMANT-native terms before specifying transaction formats:
The AIP should be explicit about whether "group chat" is a generic umbrella term and whether
G...andC...addresses distinguish communities and channels or only identify group-like entities with metadata specifying the mode.Roles and permissions
Define a deterministic role model:
The AIP should specify:
Moderation and deletion model
The design must not claim that historical blockchain data can be erased. Message deletion and moderation should be defined as tombstone or filtering semantics over persistent transactions, consistent with #195.
The AIP should define:
Public moderation markers may be necessary for legal and abuse-response reasons in open communities and channels, but they leak moderation metadata. The AIP should compare private and public approaches, then justify the selected one.
Group identity and address model
The notes propose group or channel addresses such as
G22324532453564364432534orC22324532453564364432534. This is consensus and API visible, because current address validation accepts onlyU....The AIP should compare at least these identity models:
Recommended initial direction to evaluate:
G...orC...address for group identity and routing.The AIP must define whether group public usernames such as
super_chatare mandatory at creation, globally unique, mutable, transferable, and protected from collision with user/delegate usernames.Message and transaction model
The AIP should define whether group messages reuse transaction type
8or introduce new transaction types. Candidate direction:8with aG...orC...recipientIdand new validation rules.8transaction bytes, IDs, signatures, and fees unless the AIP explicitly defines a height-gated protocol upgrade.If existing type
8is extended, the AIP must explain how old nodes and old clients behave when they see aG...orC...recipient. If new transaction types are added, the AIP must define transaction bytes, fee calculation,dbRead/dbSave, API schema fields, and block validation rules.Encryption and read access
Classic ADAMANT messages are encrypted to a recipient account. Groups need a different key model.
The AIP should define:
The AIP should avoid inventing new cryptographic primitives. If the design needs modern group encryption beyond the current NaCl box model, it should evaluate MLS-style group epochs or a simpler explicitly scoped first version, then describe the security tradeoffs.
Fees, subscriptions, and economics
The AIP should specify all economic rules deterministically.
Creation:
Per-message fees:
Subscriptions:
Distribution of extra message fees and subscriptions:
Any non-standard distribution changes account balances and must define exact apply/undo behavior, replay safety, rounding, ordering, and SQL/state coupling. Rewarding participants by attention or audience size is especially sensitive and must avoid spam incentives, self-dealing, and non-deterministic ranking.
Notifications
Notification preferences should likely be user-local settings, not consensus state:
The AIP should define how clients store these preferences, for example encrypted KVS or local-only cache, and how WebSocket/push services respect them without leaking unnecessary social-graph metadata.
Proposed node architecture
The AIP should include an implementation architecture for this repository. A candidate architecture to evaluate:
8.mem_groups,mem_group_members,mem_group_roles,mem_group_subscriptions,mem_group_moderation, and optionalmem_group_treasury.G...and/orC...only after activation.modules/chats.jsand/or introducemodules/groupChats.jsfor listing and fetching group timelines.modules/chatrooms.jsto support pairwise dialogs and group/channel entries without breaking existing/api/chatrooms/:userId/:companionIdbehavior.adamant-schemafor new transaction, group, membership, moderation, and API response shapes.docswith endpoint behavior, examples, fees, and backwards compatibility notes.The implementation should keep state mutations inside existing sequencing semantics (
sequence,dbSequence,balancesSequence) and must not introduce non-deterministic ordering in validation, fee distribution, membership checks, or moderation checks.Required design questions
G...andC...both needed, or should one group address prefix plus metadata be used?Relation to #194
This AIP should solve classic ADAMANT blockchain group chats and channels first, where messages and control actions are transactions.
The AIP must include a short compatibility section for #194, but should not finalize implementation details for that alternative architecture yet. Once #194 selects a relay, temporary sidechain, embedded protocol, or another design, group chats and channels in that architecture should be discussed separately and may require a companion AIP.
Proposed AIP structure
Checklist
adamant,adamant-schema,docs, PWA, and iOS after the AIP direction is accepted.Verification
The task is complete when:
Adamant-im/AIPs.adamant,adamant-schema,docs, PWA, and iOS where needed.Notes