Frontrunner: Building on Injective
The Frontrunner team has made several important decisions on the technology side in order to provide the most efficient and seamless sports prediction product possible for our users. One of the key questions that we faced early on was, “Which blockchain should we build on?” It’s a question that many new Web3 products encounter, and upon researching some of the top layer 1 networks within the industry, we knew that we had to build Frontrunner on Injective. In this post, I’ll walk through our motivation for building on Injective, describe some of the technical details of our integrations, and discuss why, as we continue to progress, our excitement continues to grow about our future in the Injective ecosystem.
Why We Chose Injective
Like any vendor evaluation, our protocol investigation process began with some functional and non-functional requirements. Here are a few aspects we considered from the start (in no particular order):
|Orderbook-Based Prediction Market Feasibility||A central limit orderbook (CLOB) offers improved efficiency over other methods of providing liquidity like automated market makers (AMMs).||Injective is a sector-specific blockchain; its orderbook primitive provides an efficient and secure orderbook out of the box with Frequent Batch Auction execution.|
|Gas Fees||Users shouldn’t avoid the product due to fees; it’s even better if this can be a competitive advantage.||Injective has a zero gas fee model for traders. CLOBs are often difficult or impossible to implement on blockchains in a scalable way due to gas fees.|
|Integration Effort||Enable the team to focus as much as possible on product and UX; decrease time to market.||Using Injective’s natively-supported orderbook primitive and Binary Options markets significantly reduce complexity and engineering effort; no smart contracts are required.|
|Developer Experience||Happy engineers are effective engineers.||We were able to get up and running quickly with Injective’s Python, Golang, and Typescript SDKs (developer docs here).|
|Throughput Limits & Speed||This needs to be high enough to give us confidence that we can scale.||Injective supports 4K+ transactions per second and has ~1s block time.|
|Security||User trust; reduce risk of hacks.||Eliminating the need for smart contracts gets rid of what is often the most vulnerable part of any web3 product. Tendermint with proof-of-stake consensus is also proven and secure.|
In addition to the criteria above, we discovered a few additional points along the way that further convinced us to start developing on Injective:
- Injective is built on the Cosmos SDK and supports the inter-blockchain communication (IBC) protocol; this sets us up to incorporate multi-chain features in the future.
- The Injective Labs team is bright, responsive, and dedicated to working closely with builders like us.
Here is a simplified architecture diagram:
Transactions & Fund Flow
Frontrunner users connect their Metamask or Torus wallets in order to sign transactions. Any action that touches or moves a user’s funds (i.e. creating orders, canceling orders, etc.) will prompt the user’s wallet for a signature. Frontrunner never has custody of user funds.
Our architecture has evolved significantly since we started building on Injective, but a few core elements have been important throughout:
- Using the blockchain as a source of truth
- Pulling blockchain data for off-chain analytics
- Pulling sports data to trigger related actions
The Injective blockchain is the source of truth for real time data. Most data in the web app comes directly from the blockchain because Injective’s API is purpose-built to support UIs like Frontrunner’s. We decided early on to avoid dual sources of truth and pull directly from the blockchain where possible.
Separately, for operational ease and analytics, it’s important for us to store data from the blockchain in Frontrunner’s centralized data store. For that reason, Frontrunner backend tasks stream and poll blockchain data and push it into our core relational database.
Additional backend tasks pull sports game information including odds and game statuses. This enables Frontrunner to create desired markets and act as the pricing oracle.
The Frontrunner backend is primarily Python and makes heavy use of Injective’s Accounts RPC, Derivative Exchange RPC, and Explorer RPC. The Frontrunner web app is built with ReactJS and similarly makes use of Injective’s RPCs for user actions and pulling data.
As previously mentioned, one of the major benefits of building on Injective is that it is a sector-specific blockchain. For Frontrunner, this means that we are able to rely on Injective’s natively-supported Binary Options markets to represent our sports prediction markets without writing any smart contracts. This cannot be emphasized enough; for companies like Frontrunner that have the opportunity to build on a chain with native support for critical product foundations, a sector-specific chain is crucial for launch and growth.
Right now, our free-to-play contests are live with Preseason v2. We’ve proven that our sports prediction markets run seamlessly on Injective, and as we move towards mobile and mainnet in 2023, we’ll be adding many more markets (including additional sports and futures).
While avoiding smart contracts has been helpful early on, we also recognize that Injective smart contracts offer incredible flexibility for building further features on top of the orderbook primitive. Injective supports CosmWasm, a smart contract layer for Cosmos-based blockchains.
Having written Solidity in the past, I’m especially excited by CosmWasm’s design choices based on lessons learned from Ethereum. Some features we’re considering that will be possible on Injective include trading guilds, ETF-style props (e.g. bet on all of the New York teams), and additional sports derivatives like perpetuals, swaps, and more.
Beyond using smart contracts, we’re also looking forward to introducing multi-chain features with IBC and running our own Injective node for near-instant syncing with our backend.
We’re excited by what we’ve accomplished so far and confident that building on Injective will continue to be a winning strategy for Frontrunner.
Sign up at https://getfrontrunner.com and make your first trade today.
Frontrunner is a decentralized sports prediction market where users can buy shares of sports propositions and trade them like they would stocks. Unlike traditional sportsbooks where users place a bet and wait, Frontrunner gives users full control over their portfolios, allowing them to dynamically buy and sell positions as the odds change. By leveraging the power of free markets and the blockchain, we create transparent markets and liquid positions to reduce counterparty risk and fundamentally change the way that people invest in their sports knowledge and beliefs.
Website | Discord | Twitter | LinkedIn | Instagram | Facebook