Skip to content

🛒 ethBay off-chain blockchain-based marketplace

Notifications You must be signed in to change notification settings

sophiacodes/sweet

Repository files navigation

alt text

Marketplace dApp

What does it do?

A marketplace smart contract with basic transactions. Admin is the owner of the contract and must approve store applications before stores appear in the marketplace. Sellers and buyers can create a store (which must be approved by admin) in the marketplace to sell digital assets and can browse the marketplace, withdraw Ether from sells made, perform CRUD operations on their listed digital assets.

Run an Ethereum client

Ganache recommended, download Ganache and launch the application. This will generate a blockchain running locally on port 7545.

Or you can use Ganache CLI by npm install -g ganache-cli (if not already installed) and then ganache-cli <options>, which will run on port 8545.

Setting up the dApp

Install IPFS

ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["*"]' && ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]" && ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '["true"]' && ipfs daemon

In a new terminal window, do the following:

git clone [email protected]:sophiacodes/sweet.git
cd sweet
npm install -g truffle // If not already installed
npm i
truffle compile
truffle migrate

Running the tests

truffle test

Configure Metamask

Interact with the dApp in a browser is using MetaMask, a browser extension for both Chrome and Firefox.

Connect MetaMask to the local blockchain created by Ganache. Click the menu that shows "Main Network" and select Custom RPC. In the box titled "New RPC URL" enter http://127.0.0.1:7545 (if using Ganache Application) or enter http://127.0.0.1:8545 (if using Ganache-CLI) and click Save.

Running the dApp

npm start

The dApp will automagically open in a new tab in your browser on http://localhost:3000

alt text

alt text

By default in MetaMask the first account will belong to admin, you'll need to import other accounts who will be buyers/sellers.

Additional information

Image source CryptoKittes

This dApp is a demo which is WIP, thus incomplete and is NOT FOR PRODUCTION.