Skip to content

Data Marketplace with Programmable Access Control

MindPress Data Marketplace

1. Overview

MindPress Data Marketplace is a demo built on the BNB Smart Chain and BNB Greenfield storage chains. It uses the image trading scenario as an example to demonstrate the use of BNB Greenfield’s latest release (V1.6&V1.7), such as cross-chain programmability, delegate upload, and sponsor-paid storage fees. With these features, developers can easily create a web3 decentralized trading platform based on the BNB Chain ecosystem with a great user experience and comprehensive functions such as storage, trading, and content permission management, thereby accelerating project development and marketing.

2. Features

As an image stock, sellers can upload and list photos for sale, while buyers can search for images they like, buy, and download the original files.

Seller

  • Upload objects (e.g. images) to BNB Greenfield: Sellers can upload multiple images to BNB Greenfield at once under the BSC network.
  • List objects on the BNB Smart Chain: Sellers can list their uploaded images for sale on the BSC network and begin selling download/view permissions to buyers to earn money.

Buyer

  • Search objects: Buyers can search for objects by name and category ID to find what they want.
  • Buy objects: Buyers can purchase objects and obtain download/view permission.
  • Download objects: Buyers can download/view their purchased objects.

3. Benefits after Greenfield V1.6&1.7 updates

# Before After Code Related Greenfield Features
Network Switch ❌Users have to switch between BNB Greenfield and BNB Smart Chain to upload objects and make the trading operation. No network switch: Users can finish all the operations on BSC network. https://github.com/bnb-chain/greenfield-cosmos-sdk/pull/417
Payment Method ❌Users have to pay the storage fee and download quota fee by themselves. Flexible payment method: Projects can choose to pay storage and download quota fees by themselves, allowing users to use this platform for free and lowering the user threshold, thereby expanding the number of users and facilitating promotion. https://github.com/bnb-chain/greenfield/pull/582
Upload Objects ❌Users must upload objects to DCellar before returning to MindPress to list them because the upload process is quite complex to embed in MindPress. Easy to upload: Users can upload multiple large objects in MindPress at once without requiring a signature or incurring fees because the upload process is greatly simplified by the delegate upload feature. https://github.com/bnb-chain/greenfield/pull/581
List Objects ❌Users have to execute 2-3 transactions to complete the list workflow, which also requires switching networks back and forth. Easy to list: Users need only 2 transactions to complete the list operation to start selling. https://github.com/bnb-chain/greenfield-contracts/pull/140

4. Demo Video

4.1 Buyer workflow

Search and filter search
Buy Images search

4.2 Seller Workflow

Upload Images search
List Images search

5. Environment Support

6. Technical Design

6.1 Overview

The BNB Greenfield offers resources such as buckets, objects, and groups that can be mirrored on the BNB Smart Chain (BSC) as non-fungible tokens (NFTs) following the ERC-721 standard. Buckets store objects, the basic units with data and metadata. Groups consist of accounts with similar permissions. These resources, including group members’ permissions as ERC-1155 tokens, can be mirrored on the BSC.

Smart contracts on BSC can directly control mirrored resources, affecting storage formats, access permissions, and other data aspects on Greenfield. This integration boosts flexibility and accessibility, streamlining data management on both platforms. For more on mirroring implementation, refer to this document.

In the context of the MindPress Data Marketplace, users have the ability to store images on the Greenfield network and sell them on the BSC. Let’s take the example of Alice selling a picture of a carrot on MindPress. To sell carrot images, Alice needs to follow these steps:

image10

  1. Create a bucket, and upload the carrot image to this bucket on BNB Greenfield.
  2. Create a group and grant this group permission to view the carrot image.
  3. List the group on the MindPress Data Marketplace smart contract to sell access permissions on the BSC network.

Since the carrot image is private, Bob will be denied access to it by default. image8

Bob needs to buy permission to join the group. After becoming a member, he can view/download the carrot image.

image2

6.2 Architecture

6.2.1 Greenfield Cross Chain Design

The true strength of the Greenfield ecosystem resides in its cutting-edge platform engineered not just for data storage, but also for fostering value creation from data assets and its associated economy. To empower data on Greenfield more effectively, a robust cross-chain mechanism has been introduced, enabling versatile cross-chain programming capabilities. image4

The first layer is the Cross-Chain Communication Layer, which is responsible for handling and verifying the communication packages between BSC and BNB Greenfield.

The second layer is the Resource Mirror Layer, which handles the resource assets defined on BNB Greenfield and mirrors them onto BSC.

The top layer of the cross-chain system is the Application Layer. This layer consists of smart contracts that are developed by the community on BSC, enabling them to operate the mirrored resource entities on the Resource Mirror Layer.

6.2.2 MindPress Workflow

MindPress Data Marketplace is built on the cross-chain mechanism of BNB Greenfield and BSC, enabling users to flexibly manipulate data stored on Greenfield on the BSC side, facilitating data circulation and value creation. Below, we delve into the technical principles of the key processes involved in MindPress.

  • Create Space

The MindPress contract will do the following operations:

  1. help the user to create a bucket to store the uploaded images and the paymaster of the bucket is set to mindpress contract.
  2. set the flow rate limit for the bucket to give the initial free charge.

image7

  • List Object

Users should go through the following 2 transactions to list an object:

  1. Send a list request to the MindPress contract with the object ID, group name and price, MindPress will create a new group where all members of the group have access to the object.
  2. Send a cross-chain put-policy transaction to bind the object and the created group.

image9

  • Buy Object

    To purchase an object, the user simply sends a purchase request and pays the appropriate fee in BNB. The mindpress contract will send a cross-chain package to add the user into the access group.

image5

6.3 Technical Considerations

  • CrossChain Design: Application data is stored on the BSC chain. Objects/buckets and their access rights are recorded on the Greenfield chain. Relayers automatically relay cross-chain packages and acknowledgments between BSC and Greenfield. MindPress contracts can update the application state through Greenfield contract callbacks.
  • Stateless Design: The MindPress Data Marketplace is engineered to be stateless. The data query and object permission control involved in the application can only be interacted with through the BSC chain.

6.4 Upcoming Changes

  • Delist objects
  • List process optimization from 2 steps to 1 step

7. Getting Started

MindPress consists of three engineering projects:

8. Contributing

Thank you for considering using and contributing to MindPress! We welcome developers to utilize our open-source codebase and encourage collaboration to improve and extend its functionality. If you have any questions, feel free to reach out to us for assistance. Happy coding!

9. License

The library is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the LICENSE file.

10. Disclaimer

The software and related documentation are under active development, all subject to potential future change without notification and not ready for production use. The code and security audit have not been fully completed and are not ready for any bug bounty. We advise you to be careful and experiment on the network at your own risk. Stay safe out there.