All articles

How to Build Online Marketplace on Blockchain Like OpenBazaar?

An illustration of e-commerce store

Interested in how to build an online marketplace on blockchain? 

This is an important market that needs to be explored.

According to a study, “the global e-commerce market will grow at a CAGR of 11.1% from 2018 to reach $24.3 trillion by 2025”.

Besides all the huge profits to be made, innovating in this industry is your chance to help make a positive impact. Here’re a few amazing case studies of companies who hired DevTeam.Space to build their software products:

  1. Fun And Function – Toy eCommerce App
  2. SoBe – Furniture Retail eCommerce Web Application
  3. South Florals – Floral eCommerce Web Application



What is a decentralized online marketplace?
Blockchain gives advantages over centralized marketplaces:
Why build a decentralized online marketplace?
Build an online marketplace on blockchain using the Origami platform:
Blockchain marketplace development from scratch:
What is a DApp?
A team to build an online marketplace on blockchain?
Create your Ethereum account:
Install tools to build Ethereum DApp:
Code smart contracts:
Test, deploy and run smart contracts:
Examples of online decentralized marketplaces:

What is a decentralized online marketplace?

A decentralized online marketplace is an eCommerce platform operated on a blockchain.

These are the distinguishing characteristics:

  1. No middleman controls the trade between buyers and sellers;
  2. The terms of trade are determined by buyers and sellers, and no middlemen intervene;
  3. The terms of trade are open, transparent, and immutable;
  4. No tampering of transactions is possible;
  5. Payment between buyers and sellers is direct, no intermediary has any role to play;
  6. Transactions require no third-party payment system;
  7. Transactions are instantaneous, without depending on a third-party;
  8. The marketplace is global as soon as it‘s up;
  9. It‘s a permanent marketplace that can‘t be destroyed;
  10. No personal sensitive data is needed.

Read more about it in “4 Reasons Why Decentralized Marketplaces Are Inevitable”.

Blockchain gives advantages over centralized marketplaces:

An infographic depicting the advantages of blockchain for building marketplaces

A decentralized online marketplace, that is an online marketplace on blockchain,  has advantages over its centralized counterparts. Centralized online marketplaces have the following characteristics:

  1. A centralized company owns the platform, for e.g. Ebay, and takes a commission from sales;
  2. The infrastructure is centralized, and can be hacked;
  3. The company owning the marketplace can change terms and conditions (T&Cs) of trade at will;
  4. You need to rely on third-party payment systems;
  5. Your personal sensitive data is held by the centralized owner and they can sell it to third parties.

It‘s blockchain technology that gives a clear advantage to decentralized marketplaces. These advantages include:

  1. Blockchain is a decentralized distributed database, and all nodes are involved in maintaining the database. Each has a full record of the database. There’s no central server for hackers to destroy;
  2. It‘s a peer-to-peer (P2P) network, hence sellers can directly transact with buyers without intermediaries;
  3. T&Cs are coded in immutable smart contracts; besides they are transparent;
  4. Payment process uses cryptocurrencies thus eliminating third-party payment providers;
  5. Cryptographic hash functions, data encryption, and blockchain consensus algorithm make the system secure.

To know more about how blockchain provides these advantages, read “CREATING A PRIVATE DECENTRALIZED MARKETPLACE”.

Why build a decentralized online marketplace?

An illustration of keyboard, with a key reading Marketplace

The advantages of decentralized online marketplaces are clear.

To be successful a marketplace should have the following:

  • A network of buyers and sellers;
  • User and transaction history for Analytics;
  • A robust infrastructure.

Read more about these business and technical prerequisites in “The Impact Of Blockchain On Marketplace Platforms”.

I will show you that you can easily find the necessary tools and technology to build an online marketplace on blockchain.

Build an online marketplace on blockchain using the Origami platform:

The Origami Network is built on the Ethereum blockchain, and this protocol gives you readymade tools to build an online marketplace on blockchain. Their tools include:

  1. Origami Marketplace: It‘s a platform with four modules, and these are:
    1. Core API;
    2. Front-office;
    3. Admin portal for sellers;
    4. Admin portal for operators.
  2. Origami payment: Following are its‘ features:
    1. Secure escrow payments, suitable for both eCommerce and online marketplaces;
    2. An easy-to-use app and APIs that are secure and can be integrated easily;
    3. It accepts Bitcoin, Ethereum and Origami Tokens (ORI).
  3. Origami review: Customers that have completed an order can post a review. They need to sign with their private and certified key. Approved reviews are awarded with ORI tokens. Sellers can carry their positive reviews on all marketplaces in which they sell.

Companies have already built online marketplaces using this platform. Check out their code in GitHub and get started building your own Blockchain-Based Marketplace like OpenBazaar.

Blockchain marketplace development from scratch:

Developing from scratch is far more complicated.

To simplify your development, I recommend the approach of developing the marketplace as an Ethereum Distributed App (DApp). You can use the popular Ethereum blockchain platform to create this.

You will need to get an Ethereum account and wallet. Then you need to code smart contracts. Subsequently, you can then code a DApp that will use smart contracts you have just created.

You will be able to use Ethereum’s native cryptocurrency, i.e. Ether (ETH) for this DApp. If you need to see some examples of Ethereum DApps, visit the “State of the DApps” website.

The reason I recommend this approach is that you can develop your ’minimum viable product’ (MVP) quickly. You don’t need to create a new network, blockchain, cryptocurrency or wallet.

What is a DApp?

DApps are applications that fulfill all the following criteria:

  1. The backend code must run on a decentralized blockchain.
  2. The code is open-source.
  3. The app operates autonomously.
  4. While you can code the frontend in any language, the backend code must be smart contracts.
  5. It must use a crypto token.
  6. No one entity can control the majority of tokens.
  7. A consensus among users decides the future changes to the app.
  8. A standard cryptographic algorithm like the ’proof of work‘ (POW) must be used to create the crypto token.
  9. You must store the data in a blockchain adhering to the cryptographic standards.

Read more about it in “What is a Decentralized Application?”.

A team to develop an online marketplace on blockchain?

You need a development team with the following skills:

  1. UI/UX, to design the interfaces that buyers and sellers will use.
  2. Blockchain distributed apps (DApps) and smart contract development, to build the marketplace using blockchain;
  3. Testing;
  4. Project management with experience in blockchain development projects.

Note: Some of these are niche skills. If you can’t build such a team then strongly consider engaging development companies with relevant expertise.

I recommend following learning resources for your team:

  1. Ethereum Development Tutorial”;
  2. “Basic Solidity Course” for learning Solidity, i.e. the proprietary language to code smart contracts in Ethereum;
  3. DAPPS FOR BEGINNERS” website, which has valuable resources for developers building DApps.


Create your Ethereum account:

A graphic representation of an online marketplace and its elements

Since you are building your peer-to-peer blockchain-based marketplace as an Ethereum DApp, you need to first create an Ethereum account. Ethereum has two types of accounts, as follows:

  1. EOA: people joining their network open these;
  2. Contract accounts: These have smart contracts;

You need to open an EOA. I recommend that you use ’eth-lightwallet‘ by ConsenSys since you can easily generate the private key-public key pair with it. Read the “eth-lightwallet” documentation in GitHub for more instructions.

A word of caution here: never share your private key with anyone, and don‘t upload it to any website or the cloud. Malicious actors can steal your Ethers if they get hold of it. Once they are gone they are next to impossible to get back.

Install tools to build Ethereum DApp:

To make your own marketplace on blockchain you need to first install tools to build DApp.

  1. Install ’testrpc‘, i.e. the blockchain client we will use in this guide for Ethereum DApp development.
    1. It’s easy to use and has a command line interface (CLI). The default setting is not to mine blocks, but you can set block interval using the CLI for development purposes.
    2. It’s part of the Truffle toolset. Follow their GitHub instructions to install and use it.
  2. Install ’web3js‘, i.e. the tool to communicate with the blockchain network.
    1. This is an easy tool to use, there are specific instructions to configure files such as ’aconfig.js‘.
    2. You can also configure web APIs for communicating with blockchain easily by following instructions.
    3. Read their GitHub instructions to install and configure it.
  3. Install ’Truffle‘, i.e. the tool we will use to test and deploy smart contracts.
    1. It provides you with folders to maintain your smart contracts.
    2. You can easily combine this with your testing framework. It has scripts that will deploy smart contracts in the test environment, and run ’Truffle‘ tests. Of course, you can run regular tests too.
    3. You can deploy your smart contracts easily with this tool.
    4. Read their GitHub instructions to install and configure it.

You need to update your ’config.js‘ file before you proceed further. Open ’testrpc‘ and run an instance. Update your ’config.js‘ file with the public and private key information from your ’eth-lightwallet‘ wallet.

You can now communicate with the blockchain network. Read more about updating ’config.js‘ and communicating with blockchain in “Getting Started as an Ethereum Web Developer”.

Code smart contracts:

I assume that you have already created the UI/UX in your journey to create an online marketplace based on decentralized Blockchain technology. You now need to code your smart contracts.

A smart contract is a piece of code running on a decentralized blockchain, which enables functions like taking control of an entity based on conditions. It uses “If-Then-Else” conditions and automates the transfer of assets, for e.g. cryptocurrencies. Read more about them in “What Is A Smart Contract?”.

A smart contract must fulfill all of these criteria:

  1. Automatic execution of code without any intervention.
  2. The execution and outcome are verifiable on a blockchain.
  3. You can‘t alter the code.
  4. You can‘t reverse the execution results.

You need to code them using Solidity language. Keep the code simple. The more processing logic it has, the higher will be the computing power requirement. Also, since the code is immutable and the outcome is irreversible, you need to avoid bugs, which is another reason to keep the code simple.

I recommend that you check out the smart contract templates that CyberMiles have developed. These are suitable for eCommerce, and you might find them useful for your Peer-To-Peer marketplace powered by blockchain.

Test, deploy and run smart contracts:

A stylized illustration of a handshake

Use ’Truffle‘ to test and deploy your smart contracts. You need to invoke smart contracts using hexadecimal strings. Get help in Ethereum contract ’application binary interface‘ (ABI) libraries on this.

Buy some Ether and store it in your account. Execute any of the following types of transactions with your smart contracts:

  1. Transfer Ether to another address;
  2. Call a contract function that updates the network state;
  3. Call a function that updates the network state and accepts payment.

You will need to pay some miner fees, so budget Ether for that. Read more testing, deploying and executing smart contracts in “Getting Started as an Ethereum Web Developer”.

You have built your blockchain-based marketplace MVP!

Following are a few optional enhancement projects:

  1. Accept digital currencies like Bitcoin;
  2. Build or your own cryptocurrency and wallet for use in this marketplace;
  3. Add a decentralized cryptocurrency exchange to your marketplace.


The cost to build the Blockchain-Based marketplace:

The cost to build a marketplace on blockchain MVP will vary depending on your geography and associated manpower costs. Also, note that Ethereum DApp development is a niche skill and it’s hard to find experienced developers because they are in high demand. The manpower cost may go up because of this.

I recommend that you budget 5-7 resources for a duration of 2 months while factoring in that the project initiation and deployment phases will require fewer resources. I also reiterate that you should take professional help if you don‘t have the relevant skills in your organization.

Examples of online decentralized marketplaces:

Check out the following decentralized marketplaces:

  1. OpenBazaar: It‘s the most famous blockchain-based marketplace. A group of developers had built it in April 2014 during a Bitcoin Hackathon in Toronto. Later other developers took it up and received venture capital (VC) funding.
  • All users on this platform have a personal keypair.
  • They use it to digitally sign transactions and to anonymize data.
  • It‘s an anonymous marketplace.
  • They use escrow contracts that require multi-signature from both buyer and seller. Funds are released only if both of them sign. Read the Bitcoin Stack Exchange thread “How do I use Multisig transactions to handle escrow needs?” to know more about this technology.
  • Read their open-source code in GitHub to study the project in detail.
  1. ModulTrade: A marketplace that helps small businesses to grow their global trade, they solve a crucial problem that these businesses face.
  • There is often a letter-of-credit requirement for global trade, and banks charge high fees to act as escrow. Small businesses often find their trade financial proposals rejected. ModulTrade uses smart contracts that will do the job of escrow and let small businesses trade globally.
  • Check their open-source code in GitHub to understand the platform better.
  1. Ink Protocol: This network allows sellers to bring their reputation from other marketplaces so that they can sell easily.
  • It’s typically hard to sell in online marketplaces unless you have a good reputation. In the centralized world, it isn’t possible to use a reputation built on one marketplace in another. Ink Protocol makes it easy.
  • Their reputation system uses proof of payment. The buyer can leave feedback for the seller including a rating and comment after every transaction.
  • The feedback with the transaction ID is open for all to see in the public Ethereum blockchain.
  • See their open-source code in GitHub to know more about the project.

That’s about it. With these tools, you can create your very own blockchain-based eCommerce marketplace.

DevTeam.Space is a vetted community of expert dev teams supported by an AI-powered agile process.

Companies like Samsung, Airbus, NEC, and startups rely on us to build great online products. We can help you too, by helping you to hire and effortlessly manage expert developers.

LinkedIn Facebook Twitter Facebook Messenger Whatsapp Skype Telegram