DevTeam.Space Product Development Blog

Explore our in-depth product development tutorials and new technology announcements published by our software development experts

All articles

Make Your Loyalty App More Secure Using Blockchain

Loyalty programs are a great way to increase customer retention. However, like all software, they are vulnerable to security breaches that, if severe enough, could result in a mass exodus of otherwise loyal customers.

Blockchain can help in transforming the security element of loyalty programs. If you are an entrepreneur planning to launch such a program, you need to know how to make your loyalty app more secure using blockchain. That’s exactly what I explain here.


The importance of loyalty programs
Why do some loyalty programs not work?
The advantages of using blockchain in loyalty programs
Examples of blockchain-powered loyalty apps and platforms
How to create a blockchain based app for loyalty programs
Planning to build a blockchain-powered loyalty app?

The importance of loyalty programs

Experts project the global market for loyalty programs to grow from $1.94 billion in 2016 to $7.035 billion in 2022, at a CAGR of 24.73%. You can read more about this estimate in “Global loyalty management market forecasts to 2022 segmented by type of solution, deployment, organization size, applications & geography”.

The importance of robust loyalty programs becomes clear from the below statistics:

  • Businesses lose up to $1.6 trillion per year due to customer churn.
  • While businesses have a 60-70% chance of selling to an existing customer, it reduces to 5-20% for new customers.
  • New customer acquisition can cost 16 times more than retaining existing customers, moreover, existing customers typically contribute to 65% of a company’s business.

Read more about these statistics in “32 loyalty program statistics that will make you rethink marketing”.

Why do some loyalty programs not work?

Despite their importance and a burgeoning market, loyalty programs often don’t work effectively. This is due to the following reasons:

  • Customers find it hard to join some loyalty programs.
  • Consumers often find quite a few loyalty programs hard to understand.
  • Some loyalty programs deliver sub-optimal user experience.
  • In some cases, rewards simply don’t appeal enough to customers.
  • Several businesses change the rules for their loyalty programs far too often.
  • The marketing is often not quite up-to-the-mark, moreover, a loyalty program may have insufficient differentiators.
  • Consumers often don’t know how many reward points they have acquired, furthermore, they often find it hard to redeem their points.

Read more about these reasons in “10 reasons customers are abandoning your loyalty program (and how to save them)”. Note carefully inefficiency, complex rules, and a lack of transparency affect loyalty programs.

How can blockchain help?

Blockchain, by its very design, boosts transparency, efficiency, and security. The technology achieves this due to its distinct characteristics, which are as follows:

  • Blockchain networks are decentralized, “Peer-to-Peer” (P2P) networks and public blockchains are open to anyone. Permissioned or private blockchains allow only trusted parties to join.
  • Every computer on the network, i.e., a “node”, has the entire transaction history, and effectively acts as a complete ledger. Hackers can’t shut this network down by attacking one server, therefore, we call it the “Distributed Ledger Technology” (DLT).
  • Blockchain uses decentralization, digital signatures, data encryption, and consensus algorithms to protect the data against tampering.
  • Blockchain smart contracts are open-source pieces of code that execute autonomously, moreover, the execution is irreversible. They improve transparency and automate contract administration.

I have explained these characteristics in “How to build your own blockchain using Node.js“. The focus on transparency, efficiency, and security put the technology in a unique position to improve loyalty programs.

The advantages of using blockchain in loyalty programs

There are various advantages of using blockchain in loyalty programs, and these are as follows:

  • Loyalty points as crypto tokens: Blockchain has introduced cryptographic tokens, and these can have wide implications in the global economy. Businesses can offer crypto tokens as loyalty points, and consumers can take advantage of these irrevocable stores of value.
  • Improved transparency: Consumers receiving crypto tokens as loyalty points can see a clear audit trail of the transaction. Businesses can’t suddenly take these loyalty points back, by citing a change of rules.
  • Clarity about the loyalty program rules: With blockchain, businesses need to use smart contracts to set the rules of their loyalty programs. These are transparent, and no one can tamper with them after their deployment. The rules of the program are always open for everyone to review.
  • Cost reduction: Businesses using blockchain to run their loyalty program take advantage of the immutable distributed ledger, which reduces the cost to maintain data.
  • Eliminate fraud: Tamper-proof loyalty records and immutable smart contracts can eliminate fraudulent transactions.
  • Flexibility: With crypto tokens, consumers can redeem a portion of their reward points. This increases flexibility. Consumers can also sell their crypto tokens for other cryptocurrencies like Bitcoin or Ether, or they can sell them for fiat currencies.

Read more about these advantages in “6 cases for blockchain loyalty tokens”.

Examples of blockchain-powered loyalty apps and platforms

Let’s review a few examples of loyalty apps and platforms based on blockchain, e.g.:

1. LoyalCoin

A blockchain-powered loyalty app, LoyalCoin has a crypto token with the same name, as well as a crypto wallet. It’s a single token system for all customer loyalty rewards, which makes it easier for consumers. LoyalCoin (LYL) is an ERC20 token.

You can use this token for other purposes too, and you are not confined to just one store. A mobile wallet helps consumers maintain their points securely. One can convert LoyalCoins to Bitcoin, Ether, or fiat currencies.

2. Loyyal

Loyyal is a loyalty program platform, and it’s based on blockchain. This is not just a loyalty app, rather it has a proprietary blockchain and its own smart contracts. Businesses can set up their loyalty programs on Loyyal, and get several advantages, e.g.:

  • They can extend their partner network.
  • Businesses can expand their marketing capabilities, provide personalized offers, run promotion campaigns, etc.
  • They can monitor the effectiveness and efficiency of their loyalty programs.
  • Loyyal offers API access to their platform, therefore, businesses can use it easily.

How to create a blockchain based app for loyalty programs

I will now explain the steps to make your loyalty app more secure using blockchain, which is as follows:

1. Determine the project scope

I recommend the following project scope:

  • Design a user-friendly UI, where you offer features like the ease of sign-up, the display of offers/merchant/stores, delivering personalized offers, integrating various offers/merchants, etc. You can read more about the required features in “Features of a great loyalty app user interface”.
  • Securing an app with blockchain requires a “Decentralized app” (DApp), which is a web app running on a decentralized blockchain. Include this in the scope statement.
  • The app should feature a crypto token. I recommend that you create an Ethereum-based ERC20 token since all popular crypto wallets work with this standard. Read “ERC20 token standard” for more information.

2. Choose a development approach

A practical development approach for this project would consist of the following:

  • Design and develop the UI as you would for any web app.
  • Develop a DApp, which is a web app where the front-end can be in any language, however, the backend must consist of smart contracts. DApps need a crypto token, and no user should control a majority of the tokens. Running on a decentralized blockchain, DApps store data on a blockchain, following cryptographic standards.
  • Use Ethereum as the platform for developing this DApp. Ethereum is the most popular public blockchain platform for developing DApps and smart contracts, and I have described it in “Best blockchain network hosts 2019 – Ethereum – Amazon etc.”.

3. Form a development team

You need the following roles in the project team:

  • Business analysts;
  • UI designers;
  • Web developers for the front-end;
  • Ethereum blockchain developers with Solidity skill;
  • Testers;
  • A project manager (PM).

Note that Ethereum blockchain development skills are niche. If your team needs guidance, they can check out the following training courses:

4. Create an Ethereum account

You can proceed with the UI design and development, and this process is the same as in a web app development. In parallel, you need to start the blockchain DApp development.

You are developing an Ethereum DApp using the “Ethereum Virtual Machine” (EVM), including smart contracts written in Solidity. Deploying and running this app requires you to pay the necessary fees. While that step comes at the time of deployment, at this point you need to create an Ethereum “External Owner Account” (EOA).

You can use a user-friendly wallet named eth-lightwallet for this. Download and install it, subsequently, you can set up your public and private keys easily. Remember to secure your private key.

5. Prepare to make your DApp scalable

Ethereum is a popular public blockchain network offering excellent decentralized security, however, at the time of writing this, it doesn’t scale well. All nodes need to participate in transaction validation since Ethereum uses the “Proof of Work” (POW) consensus algorithm. You can learn about “POW” in “Proof of work vs proof of stake comparison”.

I recommend the following workaround:

  • Use the “Software Development Kits” (SDKs) offered by Loom Network, and create your DApp on its own application-specific sidechain.
  • These side chains are called “DAppChains”, and you can use a consensus algorithm like “Proof of Stake” (PoS) on it. This will help in achieving scale.

You can read “How to scale an Ethereum Dapp” to learn about this.

6. Install the development tools

Your team needs the following tools for this project:

  • testrpc: This is a blockchain client, and it has a “Command Line Interface” (CLI) improving the ease-of-use. You can use these instructions to install and configure it.
  • js: You need an API solution to communicate with the Ethereum blockchain network, and Web3.js has an excellent JavaScript API for this. Read this guide to install it.
  • Truffle: The team needs a tool to compile, test, and deploy smart contracts. “Truffle” is an ideal tool, which also enables you to organize your projects in separate folders. Use this GitHub instruction to install it.
  • MetaMask: This browser extension, available for Firefox and Chrome, helps in communicating with the Ethereum network without running a full node. MetaMask is especially useful for testing smart contracts, and you can install it from its website. Remember to secure the password and the 12-words private seed.

7. Configuring the development tools

Programmers in your team need to perform the following configuration actions:

  • They need to start testrpc and run an instance.
  • The team needs to configure the “aconfig.js” file, in order to use Web3.js.
  • Their next step is to update the “config.js” file with the public and private key from eth-lightwallet. The instructions for these steps are available in “Getting started as an Ethereum web developer”.
  • By default, the MetaMask connection points to the Ethereum “mainnet”, i.e., main network. The team needs to change this to point to Ropsten, which is a “testnet”, i.e., test network. This step is important for testing your smart contracts, and you can read “Ultimate guide to convert a web app to a decentralized app Dapp” for guidance.

8. Code your smart contracts, and the crypto token for the DApp

At this point, you can concentrate on coding the smart contracts and the crypto token. You can consult the following resources:

  • Smart contracts are open-source pieces of code that transfer cryptographic assets from one address to another based on predetermined conditions. These are “If-Then-Else” statements, and you can study smart contracts of similar projects to get an idea of what you should code. I recommend that you study the smart contracts of Loyyal, and these are available in its GitHub repository.
  • You need to create a crypto token for the DApp, which boils down to coding more smart contracts! You can read “Create your own crypto-currency with Ethereum” to learn how you can create crypto tokens on Ethereum.

Code smart contracts using Solidity, on Remix IDE. “Remix” is a DApp, therefore, you don’t need to install it. Remember to keep the logic simple. This helps in debugging, moreover, simpler smart contracts require less Ether to run.

9. Test the smart contracts

Testing smart contracts involves the following tasks:

  • Buy dummy Ether, to test the smart contracts on Ropsten. You need to get this from the MetaMask Ether Faucet.
  • Check to see if the MetaMask connection to Ropsten is still open, and toggle to the Remix screen. Click the small “+” sign at the top left to deploy the smart contract on Ropsten.
  • Test the smart contract carefully, since you can’t modify it after you deploy it on the mainnet!

10. Deploy the smart contracts

The deployment of smart contracts on the Ethereum mainnet requires the following steps:

  • Buy real Ether from Coinbase, a user-friendly cryptocurrency exchange.
  • Check to make sure that the testrpc instance is still running.
  • Navigate to the Truffle directory where you had organized the smart contracts for this project.
  • Using the Ether you just bought, pay the “gas price” on the Ethereum mainnet for the smart contract deployment.
  • Issue the “Truffle deploy” command to deploy the smart contract on the mainnet, and make a note of the smart contract address.

Read “Blockchain software development using the Ethereum network” for more guidance. With this, you have completed the DApp development.

Planning to build a blockchain-powered loyalty app?

Note that blockchain is a relatively new technology, and blockchain skills are in high demand. You can anticipate that this project will be a complex one, despite using platforms, tools, and guidelines. A competent development team, led by a PM experienced in blockchain development projects is imperative. Consider taking professional help, however, read our guide “How to find the best software development company?” before you engage a development partner.