EOSIO POS contract: enabling e-commerce for everyone

cc32d9
3 min readJan 30, 2021

Recently I built and rolled out a Point-of-Sale smart contract on EOS, Telos, WAX, and 3 testnets. It will let anyone offer their goods and services on the blockchain, and accept payments in a token of their preference. Any project-specific token or wrapped BTC, USDT, and so on, will work.

The contract is inclusive, and it lets anyone start building their e-commerce solutions on top of it. I hope there will also be generic marketplaces where people can put out their goods for sale with a couple of clicks.

The buyer doesn’t need to do much: they only transfer the exact amount of tokens and specify the exact memo text that indicates the product. The smart contract rejects wrong amounts, wrong currency, or wrongly specified SKU (Stock Keeping Unit, or simply the name of product on sale). It also prevents from paying twice by accident.

The seller needs to follow a few simple steps to start operating:

  • Call updseller action in order to register as a seller, specifying the company name, website link, and whether post-sale tracking is needed.
  • Call newsku for every type of product on sale. In this action, the seller can also fill the initial stock.
  • Call addstock action to add more items on stock.
  • Call claim action and it will transfer the paid-in tokens to the seller’s account (0.5% commission is deducted from the payments at this stage). It will process only those payments which are final on the blockchain.

In addition, two optional features are available for the seller:

  • Item tracking: if tracking is enabled for the seller, after the payments are claimed, the items are not deleted from RAM, but are added to tracking table. With the action updtracking, the seller can update the status of the items. For example, the seller can mark the items as ready for shipment, shipped, delivered. Once the delivery is complete, the seller frees up the RAM with deltracking action.
  • User verification with challenges and responses: The user is logged in to a webshop, and there was a payment on the blockchain. How will the seller know that the logged-in user has paid? The challenge-response feature will help in that: the webshop shows a challenge string to the user, and the user sends respond action with this string. The webshop can immediately verify that the challenge was responded correctly, and proceed with delivering the goods.

Content moderation, seller reputation, and dispute resolution are left out of the smart contract scope. It is up to the organizers of marketplaces to take care of buyer protection. My older project may help them with that.

Use cases

  • Retail sales: in easiest use case, the seller defines their products, adds enough stock of them, and ships them to buyers, like a normal web shop.
  • Subscription: the seller can offer service packages, and track their usage on chain.
  • NFT or other token sale: the seller can run a smart contract that sends tokens to the buyer automatically.
  • Invoicing: each SKU may have just one item on stock, and the SKU name would be the invoice number.
  • Cross-chain token swap: the seller may send a token on a different chain, like Ethereum or Polkadot.

--

--

cc32d9

Telegram: cc32d9, Discord: cc32d9#8327, EOS account: "cc32dninexxx"