Skip to content
/ packet Public

Decentralized mobile data marketplace and hackathon winner submission for Block & Change

Notifications You must be signed in to change notification settings

Jabolol/packet

Repository files navigation

Packet

Note

1st place for the NEAR's BOS Bounty and Arthera's Best DeFi App at Block & Change Madrid, sponsored by Telefónica

A decentralized Mobile Data Marketplace powered by NEAR's BOS and the Arthera Blockchain.

This marketplace enables users to buy and sell mobile data in a decentralized way. It allows users to buy and swap mobile data from other users, and sell their own mobile data to other users.

Swapping data is a new concept that allows users to exchange their data with other users, without worrying about the Carrier. This is possible thanks to the partnerships between them, allowing for a small fee to be charged for the exchange.

The production build of this project is deployed at https://packet.vercel.app/.

Contents

Features

  • Immutable React components stored on the blockchain
  • Custom BOS implementation
  • Interaction from NEAR's BOS components with the Arthera Blockchain
  • Production ready smart contracts

Getting Started

  1. Clone the repo
git clone git@github.com:Jabolol/packet.git .
  1. Install dependencies
yarn
  1. Start the development server
yarn dev
  1. Fetch the BOS components (you'll need to have bos-cli installed)
ID=c5d50293c3a3ed146051462e6e02e469acda10b517bfffeb3d34652076f0cb7c
cd components
bos components download $ID network-config mainnet

Custom BOS components

This project uses multiple custom, reusable BOS components, built from the ground up for this project. All the components are open source and stored on the blockchain. They can be forked from here

  • AppHero: The hero section of the app itself, the main dashboard. Dynamically gets the user address and displays miscelaneous data. It maps the ethereum address to a Yaypeg NFT and displays it as an avatar dynamically.

  • DataWidget: A widget that displays a numeric value and a label. It's used to display the amount of data the user has available and the amount of data the user has sold, for instance.

  • Hero: The hero section of the landing page. It enables users to connect their wallet and displays a brief description of the app.

  • ImageWidget: A widget that displays an image and a label. It's used to display an icon instead of a number, to show an abstract concept.

  • Yaypeg: A component that displays a Yaypeg NFT. It's used to display the user's avatar. Supports multiple options such as gif and illustration

Interaction with the Arthera Blockchain

Introduction

Welcome to Arthera, a dynamic blockchain network that acts as the foundation for Packet, an innovative protocol designed using the DiamondProxy pattern. Packet facilitates a semi-decentralized market for mobile data, allowing users to seamlessly buy, swap, and sell mobile data with maximized liquidity and user empowerment.

Advantages of Packet 🌟

  1. Enhanced Data Liquidity: Ensures mobile data is easily accessible and tradable, fostering a liquid market.

  2. P2P Deutch Auctions: Engage in P2P interactions through Dutch auction mechanisms, guaranteeing fair pricing and democratized data trading.

  3. Efficient Virtual Accounting: Minimizes gas fees with a virtual accounting system, while offering the ability to integrate with traditional accounting systems.

  4. Decentralized Semi-Open Market: Empowers users with a decentralized market to autonomously manage their mobile data transactions.

  5. Immutability and Transparency: Leverage the power of blockchain for secure, transparent, and immutable transactions.

Contract Architecture 🛠

Dive into our network's smart contract architecture:

Join the Revolution!

Get started with Packet, and immerse yourself in a realm where mobile data becomes a tradable, accessible, and affordable commodity for all.

Video Showcase

packet.mov

Document

You can find the document here.

Custom hooks

The BOS components interact with the Arthera Blockchain using custom hooks created with wagmi. The hooks are:

  • useBuyData: A hook that enables the user to buy DataTokens from the Arthera Blockchain. It uses the buyData method.

  • useUserBalance: A hook that enables the user to get their balance of their account from the Arthera Blockchain. It uses the balanceOf method.

  • useHistory: A hook that enables the user to get their history of transactions from the Arthera Blockchain. It listens for the tokenPurchased events.

  • useTotalUsers: A hook that enables the user to get the all the user IDs registered in the smart contract. It uses the totalUsers method.

Feedback

NEAR's BlockChain OS is a new technology, and being pioneers in this field is difficult yet rewarding. Not everything worked at the first try, and we had to make some changes to the BOS components to make them work. Nonetheless, once we got the hang of it, it was a breeze to work with.

The BOS components are a great way to build reusable components that can be used in multiple projects. They are easy to use and easy to deploy. The possibilities are endless.

One way to improve the experience would be to have TypeScript support, implement dark mode in the sandbox editor, and have another way to deploy the components without using the private keys but a expiring token instead.

When it cames to the Arthera Blockchain, we had to make some changes to the smart contracts to make them work with the BOS components. Apart from that, the integration was seamless. Nothing broke, and everything worked as expected!

Extras

I encountered a problem when trying to deploy the BOS components. useState and useEffect weren't working for me! After having a chat on NEARs Discord, I realized that the bos-gateway template was heavily outdated.

In order to spare someone else the trouble of finding out what was wrong, I created a Pull Request to update the template. You can find it here: deprecated-near-examples/bos-gateway-deprecated#3. No matter how small the change is, it can make a difference!

About

Decentralized mobile data marketplace and hackathon winner submission for Block & Change

Topics

Resources

Stars

Watchers

Forks