What's the best Multichain structure to implement a multi retail Loyalty programs?

+2 votes
Hi!
We would like to implement the multi-retailer loyalty program using Multichain.

Based on a Customer ID (key) I need a variable number of accumulators (point, visits, purchase amount) and a variable number of clusters (Bronze, Silver, Gold etc) by Retailers.

Each Retailer should be able to query all Accumulators and all Clusters for a given Customer
Each Retailer should be able to add and modify only its own Accumulators and Clusters.

What's the suggested approach considering potential performance issues due to high volumes?

Best Regards
Alberto.
asked Aug 11, 2017 by Alberto

1 Answer

0 votes

Your accumulators sound like MultiChain assets, each of which is issued by a particular retailer. If you make the asset open, the retailer that issued each asset is able to issue more later on. Once owned, these accumulators can be freely transferred and exchanged between the customers and retailers.

The clusters sound like they should be implemented using MultiChain streams, where each retailer has their own stream which only they can write to, and which enables them to tag each customer ID (which can be simply the customer's blockchain address used for sending assets) to the appropriate cluster for that retailer.

Querying the clusters for a customer is easy – any retailer's node can subscribe to another retailer's stream, and retrieve the latest entry for each customer from the stream (use liststreamkeyitems with count=1).

Querying the accumulator balance for each customer will not be so easy using MultiChain directly, because each node would need to run importaddress on every address as soon as it is first used, and there could be scaling issues with more than a few 10,000s of addresses. We would recommend implementing an external database for this purpose, and keeping the database synced with the blockchain using either per-asset subscriptions and listassettransactions, or else parsing each block's content using getblock and verbose=4.

answered Aug 11, 2017 by MultiChain
...