[英]Blockchain substrate pallet_membership use cases?
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 https://paritytech.github.io/substrate/master/pallet_membership/index.html , it would be a way to allow users in my dapp to pay for membership.
I'm currently building a dapp that will be based on my own parachain, and I was wondering if by adding this pallet https://paritytech.github.io/substrate/master/pallet_membership/index.html , it would be a way允许我的 dapp 中的用户为会员付费。 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.
显然,我必须有一些通过我的 dapp 公开的外部功能,以便当他们点击并支付会员费用时,在运行时,会员托盘会将该用户添加为会员。 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.
我是否应该创建一个智能合约来处理成员逻辑并将其部署在边缘软件或其他已经存在的平行链上。
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.
显然,我必须有一些通过我的 dapp 公开的外部功能,以便当他们点击并支付会员费用时,在运行时,会员托盘会将该用户添加为会员。 Can anyone confirm my thoughts on this?
谁能证实我对此的看法?
You can easily do this.你可以很容易地做到这一点。
pallet_membership
is just a container for members. pallet_membership
只是成员的容器。 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.正如您将在
pallet_membership::Config
中发现的那样,可以将特殊来源定义为有权添加或删除成员的人。
You need a new pallet that will handle the payment to join new members.您需要一个新托盘来处理加入新会员的付款。 Let's call this
pallet_membership_payment
.让我们称之为
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.一旦
pallet_membership_payment
收到正确的付款,它就可以调用pallet_membership::add_member
来满足它所需的任何来源。 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.并不是说即使
EnsureRoot
add_member
如果按照这样编码, pallet_membership_payment
实际上仍然可以克服它。
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.
此外,这取决于智能合约支付 model(最终用户支付费用)为您工作如果是这样,那么它很简单。 You might have an easier time in a smart contract model.
您可能在智能合约 model 中过得更轻松。 But, if you need certain optimisations, less fees, more performance etc. you will probably have to consider being your own (para)chain.
但是,如果你需要某些优化、更少的费用、更高的性能等,你可能不得不考虑成为你自己的(平行)链。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.