Skip to content

cbonoz/fevm22

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Datamarket

Datamarket is an open blockchain platform designed to enable anyone to create data purchase or checkout pages managed on the FEVM network.

This project was built for HackFEVM 2022, targeting the best new use of FEVM to build building blocks such as digital exchanges.

Note this project is currently a demo prototype and would require additional work to be production ready on FEVM mainnet.

Motivation

Decentralized exchanges, also known as DEXs, are peer-to-peer marketplaces where cryptocurrency traders make transactions directly without handing over management of their funds to an intermediary or custodian.

Existing data exchange platforms exist, like https://www.narrative.io/pricing, however either require long term commitments or having transactions mediated through a third party with high fees and staff overhead. With a tight pairing to Filecoin and support for deal-making, FEVM has the ability to support such native exchanges without introducing other networks or external bridges to facilitate storage.

How it works

Users create data pages which are purchase pages for secured IPFS datasets.

DataMarket is self-governing. If a bad or inaccurate dataset is uploaded and sold, a purchaser or potential purchaser can flag the dataset as being fraudulent. The dataset page is locked after three flags.

To ensure that the data provides user satisfaction, the owner of the listing is only paid out from the contract after three non-flagged successful sales, and each sale after that. This is done automatically via logic tied to the purchaseData contract method which releases the funds on the contract after the third purchase.

Each dataset cannot be modified after it is posted, but the price can be updated by the owner and the listing can be marked as inactive. A new page should be created if a dataset needs to be changed - this protects the mutability and trust of data collections that have already been deployed.

Using FEVM smart contracts, DataMarket can:

  1. Enable an immutable, append-only, history of interactions against DataMarket smartcontracts.
  2. Store the data in a scalable/low-cost way for data owners, where no single source has to be the custodian of the data log.
  3. Perform low-cost, high-volume, and fast transactions on the FEVM network.
  4. Be self-governing by the user base and flag or shut down any fraudulent pages by logic included in the FEVM smart contract.

Technologies used

FEVM: Serves as the primary smart contract network for the DataMarket application. FEVM enables fast and low-cost smart contract transactions that make it to deploy and interact with contracts in the field without heavy additional costs or time delays. Deployed DataContracts also enforce that the datasets be valid by enabling public users to flag suspicious listings.

IPFS: Record keeping and storage. IPFS is used as the main backend for all uploaded datasets attached to DataContracts. The url of the asset is provided to the user post-purchase.

WalletConnect: Serves as the wallet connector for authorizing DataMarket contract deploys and enabling users to connect their wallets securely to the DataMarket application.

The following contract events are emitted and can be listened to externally.

PurchaseCompleted: When a user completes the purchase on a data set page. PageFlagged: When a user flags a page as not having legitimate data.

Useful links

Running the app

Define the following environment variables.

    REACT_APP_STORAGE_KEY=  // Your web3.storage key, used for IPFS storage of datasets.
    REACT_APP_ACTIVE_CHAIN_ID= // (Optional) Can be adjusted to FEVM mainnet in the future, for now this field should be unset or set to 31415 for wallaby testnet.
    REACT_APP_WC_ID= // cloud.walletconnect.com app id (defaults to a demo app id).

yarn; yarn start

Datamarket should now be running on port 3000.

Potential future work

  • Add a usage fee that takes a small percentage of each purchase. This could be easily added to the checkout flow - for now the purchases are completely free.
  • Permanent data removal support from the filecoin network (uploaded sets remain live post-flagging currently).
  • Add a searchable interface to discover datasets deployed via the DataMarket application.
  • Reporting on Purchase and Flag events emitted from data exchanges.
  • Add support for user logins in addition to metamask (or wallet-based) logins.
  • Migration from mocks to interfacing with production Filecoin storage deals.

Screenshots / User flow

Home page

Connecting wallet

Creating a new data listing

Deployed listing

IPFS listing of a hosted asset

Purchase page for a dataset

Contract structure

Contract history

Deployed contract

About

DataMarket: A self-governing data exchange built on FEVM

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages