For info I am using the web version of: https://github.com/l3wi/mam.client.js

I am looking to use MAM for a web-only project. I really read all about setting up different channels. I have read all code but I don't see any way how to make different 'channels', other then the changeMode, which doesn't seem to impact how the merkle-tree's are constructed at all.

And as far I got it is that the merkle root defines the channel and the mode(public/private/restricted) defines the address used and relevant encryption.

Now my question is: Am I wrong with my assumptions or does this js library only support public/private/restricted differences?

PS I got it sort of working by generating new seeds using SEED+CHANNELID99999. But I know this is not the right way to do it.

2 Answers 2


I used code downloaded from here.


  • in public mode the publisher chooses a seed and keeps it secret.
  • Then he starts to publish messages on a channel represented by the first Merkle tree root generated with his seed.
  • The first message also contains the second Merkle tree root that will be used by the publisher to publish the second message and so forth.
  • In order to let a subscriber read his messages the publisher shall give him the channel i.e. the specific Merkle tree root belonging to chain generated with his seed from which he is allowed to read ahead all the messages (forward secrecy: he wont't be able to read the messages published before).

So to change the channel you have to change the seed used to generate all Merkle tree roots.

In private and restricted modes the mechanism is the same. In private mode hashes of Merkle tree roots will be used, in restricted mode the subscriber also needs an authorization key to read the messages.

  • Thanks for answering, so each seed can only have 3 channels then? I was under the assumption that you could have any amount of Channels with random identifiers.
    – ovanwijk
    Feb 16, 2018 at 16:39
  • With a seed you can publish on a channel, where different people can join from different points ahead. On this channel you can publish in one of the three given options: public, private or restricted.
    – blockmined
    Feb 16, 2018 at 16:52
  • But a channel implies you can open different channels. So deterministicly generate other seeds based on seed + channelname might not be such a bad idea at all.
    – ovanwijk
    Feb 16, 2018 at 20:10
  • If I understood well, yes, if you deterministically generate other seeds (that is other channels) from the initial seed.
    – blockmined
    Feb 17, 2018 at 8:51

I understand that multi-channel with a single seed is possible.

This blog post of MAM is very useful. It shows that the Merkle Tree needs enough leafs to hold many messages. This issue is with mam.client.js, they have hardcoded the count = 1, which means there is only one leaf per Merkle tree.


This means that as soon as you put 1 message in the 0-th generation Merkle tree, it is full and you need to move onto the next tree.

Multi-Channel MAM

The only solution for this would be to fork and/or make a Pull Request for the MAM library allowing the increase in the count of the Merkle tree.

Or, wait until MAM v2 library comes out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.