0

I am very, very new to blockchain development and even newer to Ethereum. Have done / am doing some online course though...

Anyway, how would one handle the situation where you might have a scheme that has multiple members that sign up to it that are managed by an admin who runs the scheme? For example, I might setup a scheme where people could collect items for recycling, and in exchange get paid Ether based on what was collected and how much. Each member would have an account (i.e. address) who would be paid the appropriate amount.

In this case, I would want a single smart contract that would determine how much to pay, and transfer the funds.

My real question is what would be an acceptable design pattern for this? I see two options:

  • Store the addresses of the members in the smart contract (address vs member details struct mapping), and register and track the members in the smart contract itself. When we come to pay, we can lookup the member address, and if they pass some checks (e.g. their membership is not disabled), then transfer funds based on a calculation.
  • Manage the memberships outside of the smart contract, and only use the contract for the calculation of funds and the transfer.

I like the first options because the membership states and the contract lives and dies together (well, nothing dies in Blockchains!), but the downside I see is if you have many thousands of members, would storage become expensive in terms of Gas?

1 Answer 1

1

You should choose the first one because it's good, and it's in line with decentralization.

You don't have to worry about the gas charge. There is no gas charge for querying the data, but you can change the data to make the user pay.

If you change only one user's data at a time, you don't have to worry about the fuel bill, which won't be much.

But if you have to change a lot of data at a time, which can incur high gas bills, you should avoid doing it.

Your Answer

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

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