Base Protocol Integrates Chainlink Live on Mainnet for Crypto Market Cap Data

Base Protocol
5 min readNov 17, 2020

--

We’re pleased to announce that Base Protocol has launched a new kind of synthetic crypto asset (BASE) live on mainnet that’s pegged to the total market cap of all cryptocurrencies as reported by Chainlink’s market-leading decentralized oracle network. This creates a single, trustless investment vehicle for users wanting exposure to the entire crypto industry, akin to a decentralized synthetic ETF.

Priced at a ratio of 1:1 trillion, you can calculate the target BASE price by taking the current total crypto market cap and dividing by one trillion (e.g., $400B/1T = $0.40). The BASE smart contracts use an elastic rebase mechanism to expand or contract the total token supply and move the market price to reflect the target.

So if the total crypto market cap increases from $400B to $450B, our protocol reduces circulating supply until the target market price reaches $0.45. To accomplish this, we required a secure and reliable oracle to get accurate crypto market cap data into our smart contracts as a means of properly triggering the rebase mechanism.

BASE’s engineering team has been watching Chainlink closely for months. In truth, we haven’t found another provider in the space that comes close to the level of decentralization, customer service, and blockchain agnosticism that Chainlink is capable of providing today. When it came time to start developing our project’s architecture, we were already sold on implementing a Chainlink oracle integration.

Because of this long-held sentiment, our engineers had been consuming the Chainlink documentation and YouTube tutorials for some time. As a result, we were able to quickly set up a Chainlink node of our own that is still aggregating market cap data on testnet from eleven different market cap APIs and relaying the data to our own FluxAggregator.sol smart contract to this day.

Chainlink’s architecture is incredibly flexible and powerful because even if you’re only running a single node, you can aggregate results from multiple data sources into a single data feed. By default, the Chainlink node takes the median of those results, ensuring the data feed is stable and tamper-resistant. Any suspicious outlier results are discarded automatically, even without a large group of oracles sourcing and aggregating the data streams.

This open-source capability was incredibly important for testing our proof-of-concept deployment because market cap values vary so much across API providers. If we had used a single API, our testing would have been subject to fluctuations that would impact how we build the rebase model. Instead, the clear documentation and Chainlink resources let us start right away and spin up true-to-form oracle feeds for our rebasing smart contracts, ultimately reducing the integration work needed when transitioning to mainnet.

How We Built Our Standalone Proof-of-Concept Crypto Market Cap Oracle

For developers who are interested in the process, let’s get into the weeds. We started by creating a web/API scraper (in Chainlink developer parlance, that would be an external adapter bridged to our node). We built the adapter in Node.js and ensured that it could fetch data from 11 relevant aggregator APIs and websites. For the sites that didn’t offer APIs, we relied on headless Chrome.

With the bridge adapter in place, we turned our attention to our Chainlink node. In our case, the standard Docker image was sufficient (a simple deployment of the smartcontract/chainlink:latest image to a basic AWS EC2 instance). We then took the Flux Monitor job spec from Chainlink’s public Github repository (a JSON file), tweaked it for our needs, and added it to our node using Chainlink’s CLI.

In our case, we included the following feeds: CoinGecko, CoinMarketCap, Coin Tracker, Live Coin Watch, OnChainFX, Coin Lore, Coin Codex, TradingView, Coin Paprika, Nomics, and Coin Checkup. Our Chainlink node has been pushing an aggregated data point from these API providers into our testnet smart contract for weeks.

Ramping Up the Chainlink Integration to Mainnet

Moving to a live mainnet launch for a protocol responsible for millions of dollars in value requires more than a single oracle. We began to work with the Chainlink team to ensure that the mainnet integration gains the benefits of decentralization and has the proper monitoring capabilities setup to maintain the data feed during even the most volatile market conditions. As a result, we’re now able to focus solely on our core protocol, while Chainlink ensures the reliability of the underlying decentralized oracle data feed that our product relies so heavily upon.

“We’re thrilled to be able to quickly build a working proof-of-concept oracle and then handoff those responsibilities to a highly capable team of secure Chainlink node operators to maintain it moving forward,” said BASE Protocol’s Head of Development Chris Peña. “It’s truly a testament to the extensive documentation and resources put together by the Chainlink community, allowing anyone to build and test Chainlink oracles, while leveraging the seasoned expertise of the Chainlink team and the decentralized security of the Chainlink Network to productize it and scale the oracles so they can securely support more DeFi value.”

About Chainlink

Chainlink is the most widely used and secure way to power universal smart contracts. With Chainlink, developers can connect any blockchain with high quality data sources from other blockchains as well as real world data. Managed by a global, decentralized community of hundreds of thousands of people, Chainlink is introducing a fairer model for contracts. Its network currently secures billions of dollars in value for smart contracts across the decentralized finance (DeFi), insurance and gaming ecosystems, among others.

Chainlink is trusted to deliver definitive truth by hundreds of organizations to provide continuous, reliable data feeds. To learn more, visit chain.link and follow @chainlink on Twitter.

Website | Twitter | Discord | Reddit | YouTube | Telegram | Events | GitHub | Price Feeds | DeFi

About Base Protocol

BASE is a token whose price is pegged to the total market cap of all cryptocurrencies. BASE acts like an S&P 500, but for crypto.

BASE launches on Uniswap on November 30th.

Learn more about Base Protocol here.

Apply to join the BASE presale here.

See how the Base Protocol utilizes its Chainlink oracle here.

--

--

Base Protocol

The Base Protocol ($BASE) is a crypto asset whose price is pegged to the total market cap of all cryptocurrencies. This blog is managed by its founders.