How Flux Built a Fast, Inexpensive, and Decentralized Open Market Protocol on NEAR
Flux is an open market protocol that enables developers to create markets on anything. Yes, anything — any asset, commodity, real-world event, or anything else that can be imagined.
Flux is a secure trading experience that ensures markets function efficiently by compensating validators to resolve issues (with fees from open interest). Using Flux, stakeholders work together to build an ecosystem that is truly decentralized, user-friendly, and scalable.
Challenges Building on Ethereum
The Flux developer team didn’t begin their journey building on NEAR, but that’s where they launched. After 14 months of development, Flux protocol officially launched on the NEAR Mainnet in August 2020.
In the early stages of the project, the Flux team tried building on top of Ethereum, but ran into challenges with costs and security.
The Flux team launched the first app that allowed anyone to long or short a private company without holding the underlying equity and ran the Ethereum-powered Augur in the background. This innovative app faced a major hurdle with transaction fees. A Flux transaction cost between $10-15 to run on the Ethereum blockchain, an amount that was too expensive for regular users (interested in trading small amounts) or power users (who want to trade often). The Flux team knew they would never gain traction with gas prices that high.
To address the high gas price, the Flux team then implemented 0x to address the problem, but this approach came with its own set of trade-offs. Using 0x meant siloing liquidity in off-chain orderbooks. Not only would this be less secure, but it would mean that the Flux team itself would operate these order-books, which would have introduced new regulatory challenges.
So the Flux team set out to find a blockchain platform that allowed Flux to be:
- inexpensive to use
Finding the Right Blockchain Platform
NEAR ticked all those boxes. Because of its Nightshade dynamic sharding design and its Doomslug proof-of-stake consensus mechanism, NEAR allows the DApps and protocols built on top of it to be fast, inexpensive, and scalable. It’s more secure to program on NEAR as well, because the preferred programming language for NEAR smart contracts is Rust. Additionally, NEAR makes it easy for developers to prepay gas for its users and send $NEAR to users who might not even have an account yet, a feature called NEAR Drops.
Consider how Flux compares to Augur, its main competitor. Because Augur is built on Ethereum, its transaction fees are significantly higher than Flux’s. A recent case study showed that a user trying to predict the result of the 2020 US Presidential elections would have to pay between $44.72 and $63.93 in transaction fees on a $100 bet using Augur. The same bet would’ve cost less than $0.01 on Flux.
In addition, resolution times on Flux are significantly shorter than on Augur too. Because NEAR has a built-in random number generator called the Randomness Beacon, Flux was able to build a robust, decentralized oracle that provides a 30-minute resolution time for API data (and less than 5 minutes in Flux v2) and gives randomly chosen validators 24 hours to resolve arbitrary data. Trades on Augur require you to lock up your money between 3 to 7 days following initial resolutions.
“One of the biggest advantage is that NEAR has an on-chain random number generator. They call it the Randomness Beacon. This allows us to have this super-fast oracle.”
– Peter Mitchell, CEO of Flux
The Future of Flux
It only takes three lines of code to connect to the Flux SDK, and several developers teams have already started building verticals on Flux, from decentralized insurance and weather markets to esports to synthetic asset markets to fake news. Not only that, but the Flux App is also available for developers to test the verticals they’re interested in while providing users with the best UX available today. Developers can launch the open-source Flux App in seconds and begin iterating towards product-market fit and adoption.
Flux was built on NEAR, but this doesn’t mean that Flux has abandoned Ethereum entirely. On the contrary, the ETH <> NEAR Rainbow Bridge allows developers and users to move assets and data between both blockchains without added complexity.
Flux users will be able to draw liquidity from their web3 wallets on Ethereum to trade on Flux markets. This means that Flux can leverage the performance and significantly lower gas fees of NEAR on the one hand and the larger community and ecosystem of Ethereum on the other.
Phase 1 of Flux is currently live on the NEAR mainnet, where it’s being stress-tested by Quantstamp. The protocol will soon start onboarding its first few users. If you want that to be you, sign up for early access right here.
The NEAR Protocol makes building and deploying DApps and protocols easier, faster, and cheaper than any other blockchain.
Native usability is NEAR’s primary concern. Features such as its contract-based account model and NEAR Drops make NEAR significantly more usable for developers and end users. Additionally, NEAR has focused on bringing performance for applications. The dynamic sharding approach called Nightshade works on top of a proof-of-stake BFT consensus mechanism called Doomslug. This allows network throughput to scale as demand grows. It targets 1-second blocks so developers can build performant applications.