Note
1st place for the
NEAR's BOS Bounty
andArthera'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/.
- Features
- Getting Started
- Custom BOS components
- Interaction with the Arthera Blockchain
- Video Showcase
- Document
- Custom hooks
- Feedback
- Extras
- Immutable React components stored on the blockchain
- Custom
BOS
implementation - Interaction from NEAR's
BOS
components with the Arthera Blockchain - Production ready smart contracts
- Clone the repo
git clone [email protected]:Jabolol/packet.git .
- Install dependencies
yarn
- Start the development server
yarn dev
- Fetch the
BOS
components (you'll need to havebos-cli
installed)
ID=c5d50293c3a3ed146051462e6e02e469acda10b517bfffeb3d34652076f0cb7c
cd components
bos components download $ID network-config mainnet
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 aYaypeg
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 aYaypeg
NFT. It's used to display the user's avatar. Supports multiple options such asgif
andillustration
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.
-
Enhanced Data Liquidity: Ensures mobile data is easily accessible and tradable, fostering a liquid market.
-
P2P Deutch Auctions: Engage in P2P interactions through Dutch auction mechanisms, guaranteeing fair pricing and democratized data trading.
-
Efficient Virtual Accounting: Minimizes gas fees with a virtual accounting system, while offering the ability to integrate with traditional accounting systems.
-
Decentralized Semi-Open Market: Empowers users with a decentralized market to autonomously manage their mobile data transactions.
-
Immutability and Transparency: Leverage the power of blockchain for secure, transparent, and immutable transactions.
Dive into our network's smart contract architecture:
- Diamond: 0x33568Db9cee48eCe446ff56da507A1dFE37006b3
- DiamondCutFacet: 0x03426abCD59086fF6c6952667983dc7E6D442AC4
- DiamondLoupeFacet: 0xAc0a54471ce272B0f8468e1b0f48fA26cD456EF7
- ExchangeFacet: 0xF14F7b69B6830008ED9Ce3134afEB37C6bf61d05
- OwnerFacet: 0xdcc3d56db70CE3E439E0674a6c92484eE3513fCD
- TeleoperatorFacet: 0x60437552677E1422E01bA6ac32F244cbAebfa55F
- UserFacet: 0xd26bfFaDDabf6aaEf9ca7c75ae02F90Ca3bEF3CB
Get started with Packet, and immerse yourself in a realm where mobile data becomes a tradable, accessible, and affordable commodity for all.
packet.mov
You can find the document here.
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 buyDataTokens
from the Arthera Blockchain. It uses thebuyData
method. -
useUserBalance
: A hook that enables the user to get their balance of their account from the Arthera Blockchain. It uses thebalanceOf
method. -
useHistory
: A hook that enables the user to get their history of transactions from the Arthera Blockchain. It listens for thetokenPurchased
events. -
useTotalUsers
: A hook that enables the user to get the all the user IDs registered in the smart contract. It uses thetotalUsers
method.
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!
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!