4

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

I used code downloaded from here.

Basically:

  • 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 '18 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. – Roberto Giorgetti Feb 16 '18 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 '18 at 20:10
  • If I understood well, yes, if you deterministically generate other seeds (that is other channels) from the initial seed. – Roberto Giorgetti Feb 17 '18 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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