NEAR Protocol Recipes
Updated to 2023 latest SDK and libraries versions
Last updated
Updated to 2023 latest SDK and libraries versions
Last updated
It's been 2 years since we started the development of promptwars.xyz and its precursor app.pulsemarkets.org.
Pulse was one of the first, if not the first Prediction Markets dApp built for the NEAR Protocol ecosystem, originally featured in awesomenear.com (pre NEAR Horizon).
With app.pulsemarkets.org we explored Parimutuel Prediction Markets smart-contracts designs built for the NEAR Rust SDK, and it resulted in a solid, well-tested and even audited protocol that is documented here. The dApp and its protocol contracts featured fully decentralized betting rounds to predict BTC/USDT prices with Switchboard resolutions. While it worked and the UI was nice, it didn't get much traction.
We decided to iterate and update Pulse protocol contracts for a new game: Prompt Wars
The idea of the game is simple, decentralized by principle: get a random image, users write prompts that will render it and compare its pixels to get the approximate diff to determine the winner. All logic and storage should be on-chain, of course.
With the rules of the game set, the resulting NEAR Rust contracts, its typescript interfaces and UI widgets are an open-source collection that should help other NEAR devs to get started with the NEAR Protocol ecosystem or add its features to their existing dApps.
Why not stick with the BOS?
We started the development of the Rust contracts protocol and UI before the BOS was introduced, it gives us much more liberty regarding responsiveness, AB experiments, network switching, theming, etc. Plus there are some .env secret values and server-side logic that is better to keep within the same project.
Follow these links to learn about the walkthroughs and tutorials that should get you started with NEAR dApps development quick:
Increase user engagement with this React component that sets up a NEAR guest wallet for your visitors on their first load.
Give your visitors a frictionless experience on performing on-chain transactions and using smart-contracts without the need of their own wallet. Perfect for beginners and for new product launches! 👌
A React component to display their NEAR native and NEP141 tokens balance. Formatted with their corresponding decimals.
This widget integrates with the original Wallet Selector.
Iterate over contract addresses and fetch their data to render a data table. Learn this useful React hook pattern to implement this in your own dApp.
Create Rust LookupMap
data structures that store image IPFS URIs, text content and timestamps linked to NEAR wallet addresses.
Learn how to put & fetch these efficiently via the UI.
This React component displays new status badges when a timestamp threshold is met. Useful for time-based games.
Learn to use ft_transfer_call
function calls. This method needs a bit of Rust logic to make it work with the target contract.
Register the target address, transfer the minimum NEAR balance and make your dApp accept fungible token transfers to create engaging games with real money 🤑