1

Let me know if I am on the right train of thought. I'm currently building a dapp that will be based on my own parachain, and I was wondering if by adding this pallet, it would be a way to allow users in my dapp to pay for membership.

Obviously I would have to have some extrinsic functions that are exposed through my dapp so that when they click and pay for membership, in the runtime, the membership pallet will add that user as a member. Can anyone confirm my thoughts on this?

This leads up to another question. Should I just create a smart contract to handle membership logic and deploy it on edgeware or some other parachain that already exists?

Jasperan
  • 2,154
  • 1
  • 16
  • 40
  • 1
    Running a parachain is a bigger undertaking. In addition to building your dapp and attracting users, you also need to incentivise people to run your parachain nodes. Presumably, you'll want to interact with users from other chains so you'll need to make use of XCMP (Cross Chain Messaging Protocol). Unless your DApp is exceptionally high volume, it will probably be easier and more cost effective to first create a dapp on an existing parachain. You can migrate it to your own chain later on, if necessary. – forgetso Nov 30 '21 at 20:22
  • Thanks for the info! Quick question. Is there a standard way of allowing people to run a node for the parachain? Or do they just clone my github project and run the node on their PC? – michaelassaf Jan 14 '22 at 20:40
  • 1
    It would ideally just be a case of them copying your repo and running a docker file. Substrate comes with pre-made docker files that you can use as is or as a template. – forgetso Jan 16 '22 at 10:50

1 Answers1

4

obviously I would have to have some extrinsic functions that are exposed through my dapp so that when they click and pay for membership, in the runtime, the membership pallet will add that user as a member. Can anyone confirm my thoughts on this?

You can easily do this. pallet_membership is just a container for members. As you will find in the pallet_membership::Config, there are special origins that can be defined as those who have the authority to add or remove a member.

You need a new pallet that will handle the payment to join new members. Let's call this pallet_membership_payment. Once pallet_membership_payment has received the correct payment, it can call into pallet_membership::add_member with whatever origin is required to satisfy it. Not that even if the origin requirement of add_member is EnsureRoot, pallet_membership_payment can still practically get over it, if it is coded as such.


Should I just create a smart contract to handle membership logic and deploy it on edgeware or some other parachain that already exists.

The answer to this really depends on how much further logic does your application have next to handling this membership via fees. Also, it depends on the smart contract payment model (end user pays the fees) works for you If this is it, then it is pretty simple. You might have an easier time in a smart contract model. But, if you need certain optimisations, less fees, more performance etc. you will probably have to consider being your own (para)chain.

kianenigma
  • 1,365
  • 12
  • 20