project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4

Crypto MarketPlace

MarketPlace to buy and sell items using web3. The project is a webpage that interacts with a smart contract to store items and sell or mark them as bought.

Crypto MarketPlace

Created At

ETHGlobal Lisbon

Project Description

This project provides a simple web interface to buy and sell items using the web3.

The project is based on a smart contract that stores the items. The smart contract stores items information like title, description, price, seller wallet address, etc.

There is a collection of smart contract methods to retrieve and change the state of items.

There is a webpage with a form to store new items on the smart contract, and the items listed to sell on the webpage also come from the smart contract.

When a customer buys an item it stores the user email in the item struct so it is possible to validate the ownership of the item, the smart contract is also responsible to send the value to the seller address.

The smart contract is deploy on the Linea Goerli test network.

The project also is using the MetaMaskSDK and etherjs.

How it's Made

The project defines a smart contract that stores items in a map (itemID => itemStruct), the item struct has information like title, description, price, seller wallet address, buyer email and also a flag to check if the item is sold.

The webpage loads the items by calling the smart contract method getAllItems().

If the item is not sold it shows a button to buy it, when clicked the button will then call the method pay(uint itemID, string memory buyer) that will store the buyer email into the item struct and transfer the value paid to the seller address.

As the smart contract is on the Linea network the project uses the MetaMaskSDK to prompt the user to change to the correct network.

background image mobile

Join the mailing list

Get the latest news and updates